/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-09 17:47:28 UTC
  • Revision ID: jelmer@samba.org-20070309174728-gljlmt9b7fu0rrn9
Add simple test for tortoise_bzr

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
 
    have_dbus = True
 
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
39
43
except ImportError:
40
 
    have_dbus = False
 
44
    have_nm = False
41
45
 
42
46
class CommitDialog(gtk.Dialog):
43
47
    """ New implementation of the Commit dialog. """
86
90
        
87
91
        # Create the widgets
88
92
        self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
 
93
        self._check_strict = gtk.CheckButton(_("_Allow unknown files"),
 
94
                                             use_underline=True)
89
95
        self._expander_files = gtk.Expander(_("File(s) to commit"))
90
96
        self._vpaned_main = gtk.VPaned()
91
97
        self._scrolledwindow_files = gtk.ScrolledWindow()
147
153
            self._check_local = gtk.CheckButton(_("_Only commit locally"),
148
154
                                                use_underline=True)
149
155
            self.vbox.pack_start(self._check_local, False, False)
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
 
                
 
156
            if have_nm:
 
157
                # 3 is the enum value for STATE_CONNECTED
 
158
                self._check_local.set_active(dbus_iface.state() != 3)
 
159
        self.vbox.pack_start(self._check_strict, False, False)
 
160
        
164
161
        # Create the file list
165
162
        self._create_file_view()
166
163
        # Create the pending merges
223
220
            local = self._check_local.get_active()
224
221
        else:
225
222
            local = False
226
 
 
227
 
        if list(self.wt.unknowns()) != []:
228
 
            response = question_dialog(_("Commit with unknowns?"),
229
 
               _("Unknown files exist in the working tree. Commit anyway?"))
230
 
            if response == gtk.RESPONSE_NO:
231
 
                return
232
223
        
233
224
        try:
234
225
            self.wt.commit(message,
235
226
                       allow_pointless=False,
236
 
                       strict=False,
 
227
                       strict=self._check_strict.get_active(),
237
228
                       local=local,
238
229
                       specific_files=specific_files)
239
230
        except errors.PointlessCommit:
242
233
            if response == gtk.RESPONSE_YES:
243
234
                self.wt.commit(message,
244
235
                               allow_pointless=True,
245
 
                               strict=False,
 
236
                               strict=self._check_strict.get_active(),
246
237
                               local=local,
247
238
                               specific_files=specific_files)
248
239
        self.response(gtk.RESPONSE_OK)