Rev 568: Always try to use seahorse, not just when it has already been started by the in file:///data/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Wed Jul 23 01:07:29 BST 2008


At file:///data/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 568
revision-id: jelmer at samba.org-20080723000709-1nppgvt1r4afdjgq
parent: jelmer at samba.org-20080722224017-z0no05hmnpno25bx
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2008-07-23 02:07:09 +0200
message:
  Always try to use seahorse, not just when it has already been started by the 
  user.
modified:
  seahorse.py                    crypt.py-20080401000513-m7ksudqlvqbdfejf-1
=== modified file 'seahorse.py'
--- a/seahorse.py	2008-06-29 19:07:23 +0000
+++ b/seahorse.py	2008-07-23 00:07:09 +0000
@@ -30,6 +30,10 @@
 
 try:
     bus = dbus.SessionBus()
+    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:
     get_name = getattr(e, 'get_dbus_name', None)
     if get_name is not None:
@@ -38,25 +42,12 @@
         name = getattr(e, '_dbus_error_name', None)
     # DBus sometimes fails like this, just treat it as if seahorse is not
     # available rather than crashing.
-    if name == "org.freedesktop.DBus.Error.Spawn.ExecFailed":
+    if name in ("org.freedesktop.DBus.Error.Spawn.ExecFailed", 
+                "org.freedesktop.DBus.Error.ServiceUnknown"):
         raise ImportError
     else:
         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
 FLAG_CAN_SIGN = 0x0004




More information about the bazaar-commits mailing list