diff options
author | Ajay Garg <ajay@activitycentral.com> | 2012-02-19 08:12:10 (GMT) |
---|---|---|
committer | Anish Mangal <anish@activitycentral.com> | 2012-04-27 10:02:36 (GMT) |
commit | b7097c101acaa579a8e23e8b3af6b3d489bc0b69 (patch) | |
tree | 30220c29e637a32ef9d91c0751aea50aee122d1e | |
parent | 5dab6837bed41e95319decb313572496a92f2cc8 (diff) |
au#911, au#1074: Add launcher for nm-connection-editor in My Settings
-rw-r--r-- | extensions/cpsection/network/model.py | 10 | ||||
-rw-r--r-- | extensions/cpsection/network/view.py | 37 |
2 files changed, 47 insertions, 0 deletions
diff --git a/extensions/cpsection/network/model.py b/extensions/cpsection/network/model.py index 9592fdd..11ed615 100644 --- a/extensions/cpsection/network/model.py +++ b/extensions/cpsection/network/model.py @@ -190,3 +190,13 @@ def set_ssids(ssids): if len(ssid) > 0: f.write(ssid + '\n') f.close() + +def launch_nm_connection_editor(): + environment = os.environ.copy() + environment['PATH'] = '%s:/usr/sbin' % (environment['PATH'], ) + + try: + subprocess.Popen(['-c', 'sudo nm-connection-editor --type=802-11-wireless'], + shell=True) + except: + _logger.exception('Error running nm-connection-editor') diff --git a/extensions/cpsection/network/view.py b/extensions/cpsection/network/view.py index e55a48d..48ecfd1 100644 --- a/extensions/cpsection/network/view.py +++ b/extensions/cpsection/network/view.py @@ -758,6 +758,40 @@ class Network(SectionView): workspace.pack_start(proxy, expand=False) proxy.show() + separator_nm_connection_editor = gtk.HSeparator() + workspace.pack_start(separator_nm_connection_editor, False) + separator_nm_connection_editor.show() + + label_nm_connection_editor = gtk.Label(_('NetworkManager' + ' Connection Editor')) + label_nm_connection_editor.set_alignment(0, 0) + workspace.pack_start(label_nm_connection_editor, expand=False) + label_nm_connection_editor.show() + + box_nm_connection_editor = gtk.VBox() + box_nm_connection_editor.set_border_width(style.DEFAULT_SPACING * 2) + box_nm_connection_editor.set_spacing(style.DEFAULT_SPACING) + + info = gtk.Label(_("Press the 'Launch' button, to launch the" + " Connection Editor.")) + info.set_alignment(0, 0) + info.set_line_wrap(True) + box_nm_connection_editor.pack_start(info, expand=False) + + launch_button = gtk.Button() + launch_button.set_alignment(0, 0) + launch_button.set_label(_('Launch')) + launch_button.connect('clicked', self.__launch_button_clicked_cb) + box_launch_button = gtk.HBox() + box_launch_button.set_homogeneous(False) + box_launch_button.pack_start(launch_button, expand=False) + box_launch_button.show_all() + + box_nm_connection_editor.pack_start(box_launch_button, expand=False) + workspace.pack_start(box_nm_connection_editor, expand=False) + box_nm_connection_editor.show_all() + + scrolled = gtk.ScrolledWindow() scrolled.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) scrolled.add_with_viewport(workspace) @@ -859,3 +893,6 @@ class Network(SectionView): def __save_button_clicked_cb(self, save_button): self._model.set_ssids(self._widget_table._get_entries()) save_button.set_sensitive(False) + + def __launch_button_clicked_cb(self, launch_button): + self._model.launch_nm_connection_editor() |