Port set_pidgin_buddyicon_dbus to GDBus

This commit is contained in:
Arkadiy Illarionov 2020-07-22 21:35:27 +03:00
parent dbaac31630
commit 0980d58415
1 changed files with 8 additions and 8 deletions

View File

@ -23,10 +23,9 @@ import os
import shutil import shutil
import subprocess import subprocess
import dbus
import pexpect import pexpect
from gi.repository import Gtk, GdkPixbuf, GLib # pylint: disable=E0611 from gi.repository import Gio, Gtk, GdkPixbuf, GLib # pylint: disable=E0611
from mugshot_lib import Window, SudoDialog, AccountsServiceAdapter, helpers from mugshot_lib import Window, SudoDialog, AccountsServiceAdapter, helpers
@ -466,14 +465,15 @@ class MugshotWindow(Window):
def set_pidgin_buddyicon_dbus(self, filename=None): def set_pidgin_buddyicon_dbus(self, filename=None):
"""Set the pidgin buddy icon via dbus.""" """Set the pidgin buddy icon via dbus."""
logger.debug('Updating pidgin buddy icon via dbus') logger.debug('Updating pidgin buddy icon via dbus')
bus = dbus.SessionBus() bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
obj = bus.get_object("im.pidgin.purple.PurpleService", purple = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
"/im/pidgin/purple/PurpleObject") "im.pidgin.purple.PurpleService",
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") "/im/pidgin/purple/PurpleObject",
"im.pidgin.purple.PurpleInterface", None)
# To make the change instantly visible, set the icon to none first. # To make the change instantly visible, set the icon to none first.
purple.PurplePrefsSetPath('/pidgin/accounts/buddyicon', '') purple.PurplePrefsSetPath('(ss)', '/pidgin/accounts/buddyicon', '')
if filename: if filename:
purple.PurplePrefsSetPath('/pidgin/accounts/buddyicon', filename) purple.PurplePrefsSetPath('(ss)', '/pidgin/accounts/buddyicon', filename)
def set_pidgin_buddyicon_xml(self, filename=None): def set_pidgin_buddyicon_xml(self, filename=None):
"""Set the buddyicon used by pidgin to filename (via the xml file).""" """Set the buddyicon used by pidgin to filename (via the xml file)."""