Fix hard dependency on AccountsService (lp 1311938) (debian 745548)
This commit is contained in:
parent
71f1a53274
commit
323ae84363
|
@ -223,6 +223,15 @@ class MugshotWindow(Window):
|
|||
face = os.path.join(home, '.face')
|
||||
logger.debug('Checking AccountsService for profile image')
|
||||
image = self.accounts_service_get_user_image()
|
||||
|
||||
# AccountsService may not be supported or desired.
|
||||
if image is None:
|
||||
logger.debug("AccountsService is not supported.")
|
||||
self.updated_image = face
|
||||
self.set_user_image(face)
|
||||
|
||||
# If it is supported, process and compare to ~/.face
|
||||
else:
|
||||
logger.debug('Found profile image: %s' % str(image))
|
||||
|
||||
if os.path.isfile(face):
|
||||
|
@ -435,6 +444,7 @@ class MugshotWindow(Window):
|
|||
|
||||
def accounts_service_get_user_image(self):
|
||||
"""Get user profile image using AccountsService."""
|
||||
try:
|
||||
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
|
||||
result = bus.call_sync('org.freedesktop.Accounts',
|
||||
'/org/freedesktop/Accounts',
|
||||
|
@ -447,19 +457,22 @@ class MugshotWindow(Window):
|
|||
None)
|
||||
(path,) = result.unpack()
|
||||
|
||||
variant = GLib.Variant('(s)',
|
||||
('org.freedesktop.Accounts.User',)
|
||||
)
|
||||
result = bus.call_sync('org.freedesktop.Accounts',
|
||||
path,
|
||||
'org.freedesktop.DBus.Properties',
|
||||
'GetAll',
|
||||
GLib.Variant('(s)',
|
||||
('org.freedesktop.Accounts.User',)
|
||||
),
|
||||
variant,
|
||||
GLib.VariantType.new('(a{sv})'),
|
||||
Gio.DBusCallFlags.NONE,
|
||||
-1,
|
||||
None)
|
||||
(props,) = result.unpack()
|
||||
return props['IconFile']
|
||||
except GLib.GError:
|
||||
return None
|
||||
|
||||
def accounts_service_set_user_image(self, filename):
|
||||
"""Set user profile image using AccountsService."""
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-04-22 06:13-0400\n"
|
||||
"POT-Creation-Date: 2014-05-14 07:11-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -61,7 +61,7 @@ msgstr ""
|
|||
msgid "Browse…"
|
||||
msgstr ""
|
||||
|
||||
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:573
|
||||
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:591
|
||||
msgid "Mugshot"
|
||||
msgstr ""
|
||||
|
||||
|
@ -131,37 +131,37 @@ msgid "Retry"
|
|||
msgstr ""
|
||||
|
||||
#. Password was incorrect, complain.
|
||||
#: ../mugshot/MugshotWindow.py:327
|
||||
#: ../mugshot/MugshotWindow.py:341
|
||||
msgid "Authentication Failed"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:328
|
||||
#: ../mugshot/MugshotWindow.py:342
|
||||
msgid "User details were not updated."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:495
|
||||
#: ../mugshot/MugshotWindow.py:513
|
||||
msgid "Update Pidgin buddy icon?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:496
|
||||
#: ../mugshot/MugshotWindow.py:514
|
||||
msgid "Would you also like to update your Pidgin buddy icon?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:574
|
||||
#: ../mugshot/MugshotWindow.py:592
|
||||
msgid "Enter your password to change user details."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:576
|
||||
#: ../mugshot/MugshotWindow.py:594
|
||||
msgid ""
|
||||
"This is a security measure to prevent unwanted updates\n"
|
||||
"to your personal information."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:727
|
||||
#: ../mugshot/MugshotWindow.py:745
|
||||
msgid "Update LibreOffice user details?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:728
|
||||
#: ../mugshot/MugshotWindow.py:746
|
||||
msgid "Would you also like to update your user details in LibreOffice?"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue