editor: fix populating firewall zone in general page

This commit is contained in:
Jiří Klimeš 2012-12-11 15:36:46 +01:00 committed by Dan Winship
parent c74e8177fd
commit f438335235
2 changed files with 86 additions and 1 deletions

80
fix-firewall-zone.patch Normal file
View File

@ -0,0 +1,80 @@
From 50f30bc33cb928cac2b061a390fdd0f0720ad716 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 11 Dec 2012 15:24:34 +0100
Subject: [PATCH] editor: fix populating firewall zone in general page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/connection-editor/page-general.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 3ab9049..2597971 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -77,10 +77,10 @@ zones_reply (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
G_TYPE_STRV, &priv->zones,
G_TYPE_INVALID);
+ priv->got_zones = TRUE;
+
if (priv->setup_finished)
populate_firewall_zones_ui (self);
- else
- priv->got_zones = TRUE;
g_clear_error (&error);
g_object_unref (proxy);
@@ -94,6 +94,7 @@ get_zones_from_firewall (CEPageGeneral *self)
DBusGConnection *bus;
DBusGProxy *proxy;
+ /* Initialize got_zones to TRUE for cases there's no FirewallD */
priv->got_zones = TRUE;
bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
@@ -193,7 +194,7 @@ populate_firewall_zones_ui (CEPageGeneral *self)
guint32 combo_idx = 0, idx;
s_zone = nm_setting_connection_get_zone (setting);
-
+
/* Always add "fake" 'Default' zone for default firewall settings */
#if GTK_CHECK_VERSION (2,24,0)
gtk_combo_box_text_append_text (priv->firewall_zone, FIREWALL_ZONE_DEFAULT);
@@ -355,17 +356,22 @@ ui_to_setting (CEPageGeneral *self)
GtkTreeIter iter;
gboolean autoconnect = FALSE, everyone = FALSE;
+ /* We can't take and save zone until the combo was properly initialized. Zones
+ * are received from FirewallD asynchronously; got_zones indicates we are ready.
+ */
+ if (priv->got_zones) {
#if GTK_CHECK_VERSION (2,24,0)
- zone = gtk_combo_box_text_get_active_text (priv->firewall_zone);
+ zone = gtk_combo_box_text_get_active_text (priv->firewall_zone);
#else
- zone = gtk_combo_box_get_active_text (priv->firewall_zone);
+ zone = gtk_combo_box_get_active_text (priv->firewall_zone);
#endif
- if (g_strcmp0 (zone, FIREWALL_ZONE_DEFAULT) == 0)
- zone = NULL;
- g_object_set (priv->setting, NM_SETTING_CONNECTION_ZONE, zone, NULL);
+ if (g_strcmp0 (zone, FIREWALL_ZONE_DEFAULT) == 0)
+ zone = NULL;
+ g_object_set (priv->setting, NM_SETTING_CONNECTION_ZONE, zone, NULL);
- g_free (zone);
+ g_free (zone);
+ }
if ( gtk_toggle_button_get_active (priv->dependent_vpn_checkbox)
&& gtk_combo_box_get_active_iter (priv->dependent_vpn, &iter))
--
1.7.11.7

View File

@ -11,7 +11,7 @@
Name: network-manager-applet
Summary: A network control and status applet for NetworkManager
Version: 0.9.7.0
Release: 5%{snapshot}%{?dist}
Release: 6%{snapshot}%{?dist}
Group: Applications/System
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -21,6 +21,7 @@ Source: http://ftp.gnome.org/pub/GNOME/sources/network-manager-applet/0.9/%{name
Patch0: nm-applet-no-notifications.patch
Patch1: nm-applet-wifi-dialog-ui-fixes.patch
Patch2: applet-ignore-deprecated.patch
Patch3: fix-firewall-zone.patch
Requires: NetworkManager >= %{nm_version}
Requires: NetworkManager-glib >= %{nm_version}
@ -107,6 +108,7 @@ nm-applet, nm-connection-editor, and the GNOME control center.
%patch0 -p1 -b .no-notifications
%patch1 -p1 -b .applet-wifi-ui
%patch2 -p1 -b .no-deprecated
%patch3 -p1 -b .fix-firewall-zone
%build
autoreconf -i -f
@ -223,6 +225,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%{_datadir}/gir-1.0/NMGtk-1.0.gir
%changelog
* Tue Dec 11 2012 Jiří Klimeš <jklimes@redhat.com> - 0.9.7.0-6.git20121211
- editor: fix populating Firewall zone in 'General' tab
* Tue Dec 11 2012 Jiří Klimeš <jklimes@redhat.com> - 0.9.7.0-5.git20121211
- Update to git snapshot (git20121211)