/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-29 18:12:29 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629181229-1l2m4cf7vvbyh8qg
Simplify progress bar code, use embedded progress bar inside viz window.

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()
 
32
    bus = dbus.SessionBus()
 
33
except dbus.exceptions.DBusException, e:
 
34
    get_name = getattr(e, 'get_dbus_name', None)
 
35
    if get_name is not None:
 
36
        name = get_name()
 
37
    else:
 
38
        name = getattr(e, '_dbus_error_name', None)
 
39
    # DBus sometimes fails like this, just treat it as if seahorse is not
 
40
    # available rather than crashing.
 
41
    if name == "org.freedesktop.DBus.Error.Spawn.ExecFailed":
 
42
        raise ImportError
 
43
    else:
 
44
        raise
 
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
41
54
 
42
55
crypto = dbus.Interface(bus.get_object(BUS_NAME, CRYPTO_PATH), 
43
56
                        CRYPTO_INTERFACE)