/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: Mateusz Korniak
  • Date: 2007-07-21 13:16:33 UTC
  • mto: This revision was merged to the branch mainline in revision 248.
  • Revision ID: matkor@laptop-hp-20070721131633-t40kxs20j1q2fvvc
Context menu "Remove and delete added"
Acts like "Remove" but also deletes file locally.

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. """
90
86
        
91
87
        # Create the widgets
92
88
        self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
93
 
        self._check_strict = gtk.CheckButton(_("_Allow unknown files"),
94
 
                                             use_underline=True)
95
89
        self._expander_files = gtk.Expander(_("File(s) to commit"))
96
90
        self._vpaned_main = gtk.VPaned()
97
91
        self._scrolledwindow_files = gtk.ScrolledWindow()
153
147
            self._check_local = gtk.CheckButton(_("_Only commit locally"),
154
148
                                                use_underline=True)
155
149
            self.vbox.pack_start(self._check_local, False, False)
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
 
        
 
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
                
161
164
        # Create the file list
162
165
        self._create_file_view()
163
166
        # Create the pending merges
220
223
            local = self._check_local.get_active()
221
224
        else:
222
225
            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
223
232
        
224
233
        try:
225
234
            self.wt.commit(message,
226
235
                       allow_pointless=False,
227
 
                       strict=self._check_strict.get_active(),
 
236
                       strict=False,
228
237
                       local=local,
229
238
                       specific_files=specific_files)
230
239
        except errors.PointlessCommit:
233
242
            if response == gtk.RESPONSE_YES:
234
243
                self.wt.commit(message,
235
244
                               allow_pointless=True,
236
 
                               strict=self._check_strict.get_active(),
 
245
                               strict=False,
237
246
                               local=local,
238
247
                               specific_files=specific_files)
239
248
        self.response(gtk.RESPONSE_OK)