/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 commit.py

  • Committer: Jelmer Vernooij
  • Date: 2007-03-21 00:24:51 UTC
  • Revision ID: jelmer@samba.org-20070321002451-y75m5r289ul1dppb
Don't obtain handle to network manager until it's actually needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
try:
36
36
    import dbus
37
37
    import dbus.glib
38
 
    bus = dbus.SystemBus()
39
 
    proxy_obj = bus.get_object('org.freedesktop.NetworkManager', 
40
 
                              '/org/freedesktop/NetworkManager')
41
 
    dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.NetworkManager')
42
 
    have_nm = True
 
38
    have_dbus = True
43
39
except ImportError:
44
 
    have_nm = False
 
40
    have_dbus = False
45
41
 
46
42
class CommitDialog(gtk.Dialog):
47
43
    """ New implementation of the Commit dialog. """
151
147
            self._check_local = gtk.CheckButton(_("_Only commit locally"),
152
148
                                                use_underline=True)
153
149
            self.vbox.pack_start(self._check_local, False, False)
154
 
            if have_nm:
 
150
            if have_dbus:
 
151
                bus = dbus.SystemBus()
 
152
                proxy_obj = bus.get_object('org.freedesktop.NetworkManager', 
 
153
                              '/org/freedesktop/NetworkManager')
 
154
                dbus_iface = dbus.Interface(
 
155
                        proxy_obj, 'org.freedesktop.NetworkManager')
155
156
                # 3 is the enum value for STATE_CONNECTED
156
157
                self._check_local.set_active(dbus_iface.state() != 3)
157
158