network: Hide firewall zone combo when firewalld is not running

Currently, if firewalld is not running, then the firewall zone combo is
always insensitive. This would make sense if firewalld was great and we
were to consider it a distro bug to not have firewalld running and
enabled, then users would be able to see the option is disabled and
think "maybe my distro has done something wrong."

But in actuality, firewalld is not really great, only Fedora ships it
and we're not really recommending it to other distros. So hide the combo
if it's not running, else it's just broken on $NOTFEDORA.

https://bugzilla.gnome.org/show_bug.cgi?id=763477
This commit is contained in:
Michael Catanzaro 2016-03-10 14:30:58 -06:00
parent 2ff6913c13
commit 5036ff0f80
5 changed files with 15 additions and 5 deletions

View file

@ -68,6 +68,7 @@ connect_ethernet_page (CEPageEthernet *page)
const GByteArray *s_mac;
char *s_mac_str;
GtkWidget *widget;
GtkWidget *heading;
const gchar *name;
name = nm_setting_connection_get_id (page->setting_connection);
@ -118,7 +119,8 @@ connect_ethernet_page (CEPageEthernet *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"));
firewall_ui_setup (sc, widget, CE_PAGE (page)->cancellable);
heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_zone"));
firewall_ui_setup (sc, widget, heading, CE_PAGE (page)->cancellable);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
}

View file

@ -361,7 +361,7 @@ finish_setup (CEPageSecurity *page)
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);
firewall_ui_setup (sc, GTK_WIDGET (page->firewall_combo), page->firewall_heading, CE_PAGE (page)->cancellable);
g_signal_connect_swapped (page->firewall_combo, "changed", G_CALLBACK (ce_page_changed), page);
security_combo_changed (combo, page);

View file

@ -121,6 +121,7 @@ connect_vpn_page (CEPageVpn *page)
{
const gchar *name;
GtkWidget *widget;
GtkWidget *heading;
name = nm_setting_connection_get_id (page->setting_connection);
gtk_entry_set_text (page->name, name);
@ -134,7 +135,8 @@ connect_vpn_page (CEPageVpn *page)
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);
heading = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "heading_zone"));
firewall_ui_setup (page->setting_connection, widget, heading, CE_PAGE (page)->cancellable);
g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
}

View file

@ -27,6 +27,7 @@
typedef struct {
gchar *zone;
GtkWidget *combo;
GtkWidget *label;
} GetZonesReplyData;
static void
@ -50,11 +51,13 @@ get_zones_reply (GObject *source,
idx = 0;
if (error) {
gtk_widget_set_sensitive (d->combo, FALSE);
gtk_widget_hide (d->combo);
gtk_widget_hide (d->label);
g_error_free (error);
}
else {
gtk_widget_set_sensitive (d->combo, TRUE);
gtk_widget_show (d->combo);
gtk_widget_show (d->label);
g_variant_get (ret, "(^a&s)", &zones);
for (i = 0; zones[i]; i++) {
@ -79,6 +82,7 @@ get_zones_reply (GObject *source,
void
firewall_ui_setup (NMSettingConnection *setting,
GtkWidget *combo,
GtkWidget *label,
GCancellable *cancellable)
{
GDBusConnection *bus;
@ -89,6 +93,7 @@ firewall_ui_setup (NMSettingConnection *setting,
d = g_new0 (GetZonesReplyData, 1);
d->zone = g_strdup (nm_setting_connection_get_zone (setting));
d->combo = combo;
d->label = label;
g_dbus_connection_call (bus,
"org.fedoraproject.FirewallD1",

View file

@ -24,6 +24,7 @@
void firewall_ui_setup (NMSettingConnection *setting,
GtkWidget *combo,
GtkWidget *label,
GCancellable *cancellable);
void firewall_ui_to_setting (NMSettingConnection *setting,
GtkWidget *combo);