[Pkg-bazaar-commits] ./bzr-gtk/unstable r499: fix seahorse detection in older versions of dbus-python

Sabin Iacob (m0n5t3r) iacobs at m0n5t3r.info
Fri Apr 10 07:50:35 UTC 2009


------------------------------------------------------------
revno: 499
committer: Sabin Iacob (m0n5t3r) <iacobs at m0n5t3r.info>
branch nick: bzr-gtk
timestamp: Thu 2008-06-05 02:07:26 +0300
message:
  fix seahorse detection in older versions of dbus-python
modified:
  seahorse.py
    ------------------------------------------------------------
    revno: 487.4.3
    committer: Sabin Iacob (m0n5t3r) <iacobs at m0n5t3r.info>
    branch nick: bug228922
    timestamp: Thu 2008-05-29 12:48:15 +0300
    message:
      merge trunk
    added:
      olive-gtk.1
    modified:
      NEWS
      __init__.py
      branch.py
      branchview/treeview.py
      checkout.py
      commit.py
      conflicts.py
      diff.py
      errors.py
      genpot.sh
      initialize.py
      merge.py
      nautilus-bzr.py
      olive/__init__.py
      olive/add.py
      olive/bookmark.py
      olive/guifiles.py
      olive/info.py
      olive/menu.py
      olive/mkdir.py
      olive/move.py
      olive/remove.py
      olive/rename.py
      po/olive-gtk.pot
      push.py
      revbrowser.py
      status.py
      tags.py
      tests/test_diff.py
      ui.py
    ------------------------------------------------------------
    revno: 487.4.4
    committer: Sabin Iacob (m0n5t3r) <iacobs at m0n5t3r.info>
    branch nick: bug228922
    timestamp: Thu 2008-05-29 12:48:48 +0300
    message:
      gracefully handle old versions of dbus-python (it appears that DBusException.get_bus_name was introduced in 0.81.1)
    modified:
      seahorse.py
-------------- next part --------------
=== modified file 'seahorse.py'
--- a/seahorse.py	2008-05-23 08:23:59 +0000
+++ b/seahorse.py	2008-05-29 09:48:48 +0000
@@ -30,15 +30,19 @@
 
 bus = dbus.SessionBus()
 
-try: 
-    crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
-                            CRYPTO_INTERFACE)
-    openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
-                             OPENPGP_INTERFACE)
-except dbus.exceptions.DBusException, e:
-    if e.get_dbus_name() == 'org.freedesktop.DBus.Error.ServiceUnknown':
-        raise ImportError
-    raise
+if hasattr(bus, 'list_activatable_names'):
+    bus_names = bus.list_activatable_names()
+else:
+    bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
+    bus_names = bus_object.ListNames(dbus_interface='org.freedesktop.DBus')
+
+if BUS_NAME not in bus_names:
+    raise ImportError
+
+crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
+                        CRYPTO_INTERFACE)
+openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
+                         OPENPGP_INTERFACE)
 
 FLAG_VALID = 0x0001
 FLAG_CAN_ENCRYPT = 0x0002



More information about the Pkg-bazaar-commits mailing list