/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to seahorse.py

  • Committer: Jelmer Vernooij
  • Date: 2008-06-27 16:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 506.
  • Revision ID: jelmer@samba.org-20080627165356-t5ip7cyqivwye2ro
Make handle-patch not dependend on the users name being abentley and install it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
try:
32
32
    bus = dbus.SessionBus()
33
 
    crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
34
 
                            CRYPTO_INTERFACE)
35
 
    openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
36
 
                             OPENPGP_INTERFACE)
37
33
except dbus.exceptions.DBusException, e:
38
34
    get_name = getattr(e, 'get_dbus_name', None)
39
35
    if get_name is not None:
40
36
        name = get_name()
41
37
    else:
42
38
        name = getattr(e, '_dbus_error_name', None)
43
 
 
44
 
    if name is None:
45
 
        args = getattr(e, 'args', None) # This is case for old python-dbus-0.62
46
 
        if args == ("Unable to determine the address of the message bus (try 'man dbus-launch' and 'man dbus-daemon' for help)",):
47
 
            raise ImportError
48
 
 
49
39
    # DBus sometimes fails like this, just treat it as if seahorse is not
50
40
    # available rather than crashing.
51
 
    if name in ("org.freedesktop.DBus.Error.Spawn.ExecFailed", 
52
 
                "org.freedesktop.DBus.Error.ServiceUnknown",
53
 
                "org.freedesktop.DBus.Error.NotSupported"):
 
41
    if name == "org.freedesktop.DBus.Error.Spawn.ExecFailed":
54
42
        raise ImportError
55
43
    else:
56
44
        raise
57
45
 
 
46
if hasattr(bus, 'list_activatable_names'):
 
47
    bus_names = bus.list_activatable_names()
 
48
else:
 
49
    bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
 
50
    bus_names = bus_object.ListNames(dbus_interface='org.freedesktop.DBus')
 
51
 
 
52
if BUS_NAME not in bus_names:
 
53
    raise ImportError
 
54
 
 
55
crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
 
56
                        CRYPTO_INTERFACE)
 
57
openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
 
58
                         OPENPGP_INTERFACE)
 
59
 
58
60
FLAG_VALID = 0x0001
59
61
FLAG_CAN_ENCRYPT = 0x0002
60
62
FLAG_CAN_SIGN = 0x0004
83
85
        if key not in keyset:
84
86
            keyset[key] = Key(key)
85
87
 
86
 
        return (cleartext, keyset[key])
87
 
 
88
 
    return (cleartext, None)
89
 
 
 
88
        return keyset[key]
90
89
 
91
90
class Key:
92
91