/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: matkor
  • Date: 2007-08-23 10:17:40 UTC
  • mto: This revision was merged to the branch mainline in revision 265.
  • Revision ID: matkor@laptop-hp-20070823101740-s17kf9qa383wiuje
Code for "branch update" menuitem and toolbox. Typo fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import os.path
28
28
 
29
 
import bzrlib.errors as errors
30
 
from bzrlib import osutils
 
29
from bzrlib import errors, osutils
 
30
from bzrlib.trace import mutter
31
31
 
32
32
from dialog import error_dialog, question_dialog
33
33
from errors import show_bzr_error
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:
155
 
                # 3 is the enum value for STATE_CONNECTED
156
 
                self._check_local.set_active(dbus_iface.state() != 3)
157
 
        
 
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')
 
156
                try:
 
157
                    # 3 is the enum value for STATE_CONNECTED
 
158
                    self._check_local.set_active(dbus_iface.state() != 3)
 
159
                except dbus.DBusException, e:
 
160
                    # Silently drop errors. While DBus may be 
 
161
                    # available, NetworkManager doesn't necessarily have to be
 
162
                    mutter("unable to get networkmanager state: %r" % e)
 
163
                
158
164
        # Create the file list
159
165
        self._create_file_view()
160
166
        # Create the pending merges