Merge pull request #12 from qarkai/gdbus

Port to GDBus
This commit is contained in:
Sean Davis 2020-08-23 15:25:59 -04:00 committed by GitHub
commit 8944dce8b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -14,7 +14,6 @@
### Build Requirements ### Build Requirements
- gir1.2-gtk-3.0 - gir1.2-gtk-3.0
- python3 - python3
- python3-dbus
- python3-distutils - python3-distutils
- [python3-distutils-extra](https://launchpad.net/python-distutils-extra) - [python3-distutils-extra](https://launchpad.net/python-distutils-extra)
- python3-gi - python3-gi
@ -23,7 +22,6 @@
### Runtime Requirements ### Runtime Requirements
- chfn - chfn
- python3-cairo - python3-cairo
- python3-dbus
- python3-gi - python3-gi
- python3-pexpect - python3-pexpect

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)."""