/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: 2012-07-09 15:23:26 UTC
  • mto: This revision was merged to the branch mainline in revision 794.
  • Revision ID: jelmer@samba.org-20120709152326-dzxb8zoz0btull7n
Remove bzr-notify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
KEY_TYPE_SSH = 'ssh'
30
30
 
31
31
try:
32
 
    dbus.validate_bus_name(BUS_NAME)
33
 
except ValueError:
34
 
    # Seahorse isn't installed
35
 
    raise ImportError
36
 
except AttributeError:
37
 
    # Outdated version of DBus that doesn't have validate_bus_name
38
 
    raise ImportError
39
 
 
40
 
bus = dbus.SessionBus()
41
 
 
42
 
crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
43
 
                        CRYPTO_INTERFACE)
44
 
openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
45
 
                         OPENPGP_INTERFACE)
 
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
except dbus.exceptions.DBusException, e:
 
38
    get_name = getattr(e, 'get_dbus_name', None)
 
39
    if get_name is not None:
 
40
        name = get_name()
 
41
    else:
 
42
        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
    # DBus sometimes fails like this, just treat it as if seahorse is not
 
50
    # 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"):
 
54
        raise ImportError
 
55
    else:
 
56
        raise
46
57
 
47
58
FLAG_VALID = 0x0001
48
59
FLAG_CAN_ENCRYPT = 0x0002
72
83
        if key not in keyset:
73
84
            keyset[key] = Key(key)
74
85
 
75
 
        return keyset[key]
 
86
        return (cleartext, keyset[key])
 
87
 
 
88
    return (cleartext, None)
 
89
 
76
90
 
77
91
class Key:
78
92