/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: John Arbash Meinel
  • Date: 2007-10-02 18:08:58 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002180858-dtnzn5aclokxw0fp
Add the 'Only Commit Locally' checkbox, we may want to put it elsewhere, though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        self._fill_in_pending()
127
127
        self._fill_in_diff()
128
128
        self._fill_in_files()
 
129
        self._fill_in_checkout()
129
130
 
130
131
    def _fill_in_pending(self):
131
132
        if not self._pending:
241
242
    def _fill_in_diff(self):
242
243
        self._diff_view.set_trees(self._wt, self._basis_tree)
243
244
 
 
245
    def _fill_in_checkout(self):
 
246
        if not self._is_checkout:
 
247
            self._check_local.hide()
 
248
            return
 
249
        if have_dbus:
 
250
            bus = dbus.SystemBus()
 
251
            proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
 
252
                                       '/org/freedesktop/NetworkManager')
 
253
            dbus_iface = dbus.Interface(proxy_obj,
 
254
                                        'org.freedesktop.NetworkManager')
 
255
            try:
 
256
                # 3 is the enum value for STATE_CONNECTED
 
257
                self._check_local.set_active(dbus_iface.state() != 3)
 
258
            except dbus.DBusException, e:
 
259
                # Silently drop errors. While DBus may be
 
260
                # available, NetworkManager doesn't necessarily have to be
 
261
                mutter("unable to get networkmanager state: %r" % e)
 
262
        self._check_local.show()
 
263
 
244
264
    def _compute_delta(self):
245
265
        self._delta = self._wt.changes_from(self._basis_tree)
246
266
 
279
299
        self._construct_file_list()
280
300
        self._construct_pending_list()
281
301
 
 
302
        self._check_local = gtk.CheckButton(_("_Only commit locally"),
 
303
                                            use_underline=True)
 
304
        self._left_pane_box.pack_end(self._check_local, False, False)
 
305
        self._check_local.set_active(False)
 
306
 
282
307
        self._hpane.pack1(self._left_pane_box, resize=False, shrink=False)
283
308
        self._left_pane_box.show()
284
309
 
521
546
        self._do_commit()
522
547
 
523
548
    def _do_commit(self):
524
 
        buf = self._global_message_text_view.get_buffer()
525
 
        start, end = buf.get_bounds()
526
 
        message = buf.get_text(start, end).decode('utf-8')
 
549
        message = self._get_global_commit_message()
527
550
 
528
551
        if message == '':
529
552
            response = self._question_dialog(
539
562
        # else:
540
563
        #     specific_files = None
541
564
 
542
 
        # if self._is_checkout:
543
 
        #     local = self._check_local.get_active()
544
 
        # else:
545
 
        #     local = False
 
565
        local = self._check_local.get_active()
546
566
 
547
567
        # if list(self._wt.unknowns()) != []:
548
568
        #     response = question_dialog(_("Commit with unknowns?"),
550
570
        #     if response == gtk.RESPONSE_NO:
551
571
        #         return
552
572
 
553
 
        local = False
554
573
        specific_files = None
 
574
        rev_id = None
555
575
        try:
556
576
            rev_id = self._wt.commit(message,
557
577
                       allow_pointless=False,
570
590
        self.committed_revision_id = rev_id
571
591
        self.response(gtk.RESPONSE_OK)
572
592
 
 
593
    def _get_global_commit_message(self):
 
594
        buf = self._global_message_text_view.get_buffer()
 
595
        start, end = buf.get_bounds()
 
596
        return buf.get_text(start, end).decode('utf-8')
 
597
 
 
598
    def _set_global_commit_message(self, message):
 
599
        """Just a helper for the test suite."""
 
600
        self._global_message_text_view.get_buffer().set_text(message)
 
601
 
573
602
    @staticmethod
574
603
    def _rev_to_pending_info(rev):
575
604
        """Get the information from a pending merge."""