[gnome-control-center] network: Add firewall zone support for vpn
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Add firewall zone support for vpn
- Date: Tue, 5 Mar 2013 02:46:08 +0000 (UTC)
commit 377fbad2182a4698c457834fcca7f1d3f56d4472
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 2 19:37:13 2013 -0500
network: Add firewall zone support for vpn
At the same time, we add 'make available to all users'
https://bugzilla.gnome.org/show_bug.cgi?id=694577
panels/network/connection-editor/ce-page-vpn.c | 32 ++++++++++++
panels/network/connection-editor/vpn-page.ui | 65 +++++++++++++++++++++++-
2 files changed, 95 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index 1eed050..9b497ed 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -28,9 +28,24 @@
#include "ce-page-vpn.h"
#include "vpn-helpers.h"
+#include "firewall-helpers.h"
G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
+static void
+all_user_changed (GtkToggleButton *b, CEPageVpn *page)
+{
+ gboolean all_users;
+ NMSettingConnection *sc;
+
+ sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ all_users = gtk_toggle_button_get_active (b);
+
+ g_object_set (sc, "permissions", NULL, NULL);
+ if (!all_users)
+ nm_setting_connection_add_permission (sc, "user", g_get_user_name (), NULL);
+}
+
/* Hack to make the plugin-provided editor widget fit in better with
* the control center by changing
*
@@ -105,10 +120,23 @@ static void
connect_vpn_page (CEPageVpn *page)
{
const gchar *name;
+ GtkWidget *widget;
name = nm_setting_connection_get_id (page->setting_connection);
gtk_entry_set_text (page->name, name);
g_signal_connect_swapped (page->name, "changed", G_CALLBACK (ce_page_changed), page);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder,
+ "all_user_check"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
+ nm_setting_connection_get_num_permissions (page->setting_connection)
== 0);
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (all_user_changed), page);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone"));
+ firewall_ui_setup (page->setting_connection, widget, CE_PAGE (page)->cancellable);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
+
}
static gboolean
@@ -117,10 +145,14 @@ validate (CEPage *page,
GError **error)
{
CEPageVpn *self = CE_PAGE_VPN (page);
+ GtkWidget *widget;
g_object_set (self->setting_connection,
NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name),
NULL);
+ widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone"));
+ firewall_ui_to_setting (self->setting_connection, widget);
+
if (!nm_setting_verify (NM_SETTING (self->setting_connection), NULL, error))
return FALSE;
diff --git a/panels/network/connection-editor/vpn-page.ui b/panels/network/connection-editor/vpn-page.ui
index 050bc0b..02ebb76 100644
--- a/panels/network/connection-editor/vpn-page.ui
+++ b/panels/network/connection-editor/vpn-page.ui
@@ -22,6 +22,7 @@
<property name="xalign">1</property>
<property name="label" translatable="yes">_Name</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_name</property>
</object>
<packing>
<property name="expand">False</property>
@@ -50,6 +51,61 @@
</packing>
</child>
<child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="heading_zone">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Firewall _Zone</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">combo_zone</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="combo_zone">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="all_user_check">
+ <property name="label" translatable="yes">Make available to other _users</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="failure_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -62,9 +118,14 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
- <object class="GtkSizeGroup" id="sizegroup1"/>
+ <object class="GtkSizeGroup" id="sizegroup1">
+ <widgets>
+ <widget name="heading_name"/>
+ <widget name="heading_zone"/>
+ </widgets>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]