network: Move firewall zone to security

This is where people expect it (whether that is correct or not).

https://bugzilla.gnome.org/show_bug.cgi?id=745702
This commit is contained in:
Matthias Clasen 2015-03-05 15:31:59 -05:00
parent 58542b31d2
commit 2093f6c7ea
5 changed files with 48 additions and 38 deletions

View file

@ -29,6 +29,7 @@
#include "wireless-security.h" #include "wireless-security.h"
#include "ce-page-security.h" #include "ce-page-security.h"
#include "firewall-helpers.h"
G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE) G_DEFINE_TYPE (CEPageSecurity, ce_page_security, CE_TYPE_PAGE)
@ -148,6 +149,7 @@ security_combo_changed (GtkComboBox *combo,
gtk_container_remove (GTK_CONTAINER (parent), sec_widget); gtk_container_remove (GTK_CONTAINER (parent), sec_widget);
gtk_size_group_add_widget (page->group, page->security_heading); gtk_size_group_add_widget (page->group, page->security_heading);
gtk_size_group_add_widget (page->group, page->firewall_heading);
wireless_security_add_to_size_group (sec, page->group); wireless_security_add_to_size_group (sec, page->group);
gtk_container_add (GTK_CONTAINER (vbox), sec_widget); gtk_container_add (GTK_CONTAINER (vbox), sec_widget);
@ -204,6 +206,7 @@ finish_setup (CEPageSecurity *page)
NMConnection *connection = CE_PAGE (page)->connection; NMConnection *connection = CE_PAGE (page)->connection;
NMSettingWireless *sw; NMSettingWireless *sw;
NMSettingWirelessSecurity *sws; NMSettingWirelessSecurity *sws;
NMSettingConnection *sc;
gboolean is_adhoc = FALSE; gboolean is_adhoc = FALSE;
GtkListStore *sec_model; GtkListStore *sec_model;
GtkTreeIter iter; GtkTreeIter iter;
@ -354,6 +357,13 @@ finish_setup (CEPageSecurity *page)
page->security_combo = combo; page->security_combo = combo;
page->firewall_heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_zone"));
page->firewall_combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone"));
sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
firewall_ui_setup (sc, page->firewall_combo, CE_PAGE (page)->cancellable);
g_signal_connect_swapped (page->firewall_combo, "changed", G_CALLBACK (ce_page_changed), page);
security_combo_changed (combo, page); security_combo_changed (combo, page);
g_signal_connect (combo, "changed", g_signal_connect (combo, "changed",
G_CALLBACK (security_combo_changed), page); G_CALLBACK (security_combo_changed), page);
@ -365,6 +375,7 @@ validate (CEPage *page,
GError **error) GError **error)
{ {
NMSettingWireless *sw; NMSettingWireless *sw;
NMSettingConnection *sc;
WirelessSecurity *sec; WirelessSecurity *sec;
gboolean valid = FALSE; gboolean valid = FALSE;
const char *mode; const char *mode;
@ -409,6 +420,9 @@ validate (CEPage *page,
valid = TRUE; valid = TRUE;
} }
sc = nm_connection_get_setting_connection (connection);
firewall_ui_to_setting (sc, CE_PAGE_SECURITY (page)->firewall_combo);
return valid; return valid;
} }

View file

@ -45,6 +45,8 @@ struct _CEPageSecurity
GtkComboBox *security_combo; GtkComboBox *security_combo;
GtkWidget *security_heading; GtkWidget *security_heading;
GtkComboBox *firewall_combo;
GtkWidget *firewall_heading;
GtkSizeGroup *group; GtkSizeGroup *group;
gboolean adhoc; gboolean adhoc;
}; };

View file

@ -30,7 +30,6 @@
#include <net/if_arp.h> #include <net/if_arp.h>
#include "firewall-helpers.h"
#include "ce-page-wifi.h" #include "ce-page-wifi.h"
#include "ui-helpers.h" #include "ui-helpers.h"
@ -130,8 +129,6 @@ connect_wifi_page (CEPageWifi *page)
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page); g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone")); widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone"));
firewall_ui_setup (sc, widget, CE_PAGE (page)->cancellable);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
} }
static void static void
@ -143,7 +140,6 @@ ui_to_setting (CEPageWifi *page)
GByteArray *cloned_mac = NULL; GByteArray *cloned_mac = NULL;
GtkWidget *entry; GtkWidget *entry;
const gchar *utf8_ssid; const gchar *utf8_ssid;
NMSettingConnection *sc;
entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid")); entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_ssid"));
utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry)); utf8_ssid = gtk_entry_get_text (GTK_ENTRY (entry));
@ -160,10 +156,6 @@ ui_to_setting (CEPageWifi *page)
entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac")); entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "entry_cloned_mac"));
cloned_mac = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, NULL); cloned_mac = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, NULL);
sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "combo_zone"));
firewall_ui_to_setting (sc, entry);
g_object_set (page->setting, g_object_set (page->setting,
NM_SETTING_WIRELESS_SSID, ssid, NM_SETTING_WIRELESS_SSID, ssid,
NM_SETTING_WIRELESS_BSSID, bssid, NM_SETTING_WIRELESS_BSSID, bssid,

View file

@ -63,6 +63,38 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="heading_zone">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</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="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="combo_zone">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object> </object>
</child> </child>
<child type="tab"> <child type="tab">

View file

@ -172,35 +172,5 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="heading_zone">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</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="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</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="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object> </object>
</interface> </interface>