[Pkg-bazaar-commits] ./bzr-gtk/unstable r158: If available, use NetworkManager to find out whether a commit should be local or not.
Jelmer Vernooij
jelmer at samba.org
Fri Apr 10 07:49:33 UTC 2009
------------------------------------------------------------
revno: 158
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-02-03 17:53:23 +0100
message:
If available, use NetworkManager to find out whether a commit should be local or not.
modified:
commit.py
-------------- next part --------------
=== modified file 'commit.py'
--- a/commit.py 2007-02-03 14:19:44 +0000
+++ b/commit.py 2007-02-03 16:53:23 +0000
@@ -32,6 +32,17 @@
from dialog import error_dialog, question_dialog
from errors import show_bzr_error
+try:
+ import dbus
+ import dbus.glib
+ bus = dbus.SystemBus()
+ proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
+ '/org/freedesktop/NetworkManager')
+ dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.NetworkManager')
+ have_nm = True
+except ImportError:
+ have_nm = False
+
class CommitDialog(gtk.Dialog):
""" New implementation of the Commit dialog. """
def __init__(self, wt, wtpath, notbranch, selected=None, parent=None):
@@ -79,9 +90,6 @@
# Create the widgets
self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
- if self._is_checkout:
- self._check_local = gtk.CheckButton(_("_Only commit locally"),
- use_underline=True)
self._check_strict = gtk.CheckButton(_("_Allow unknown files"),
use_underline=True)
self._expander_files = gtk.Expander(_("File(s) to commit"))
@@ -140,7 +148,9 @@
self._vpaned_main.add2(self._vbox_message)
self.vbox.pack_start(self._vpaned_main, True, True)
- if self._is_checkout:
+ if self._is_checkout and not have_nm:
+ self._check_local = gtk.CheckButton(_("_Only commit locally"),
+ use_underline=True)
self.vbox.pack_start(self._check_local, False, False)
self.vbox.pack_start(self._check_strict, False, False)
@@ -198,7 +208,10 @@
return
if self._is_checkout:
- local = self._check_local.get_active()
+ if have_nm:
+ local = (dbus_iface.state() != 3)
+ else:
+ local = self._check_local.get_active()
else:
local = False
More information about the Pkg-bazaar-commits
mailing list