From 13e9bee8d32dde4f59e23c054ed9a96ca10cd4b0 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Wed, 1 Oct 2014 00:30:38 +0200
Subject: [PATCH] build: Allow to build without firewalld support

Not all distributions ship firewalld (e.g. openSUSE). The firewall zone
configuration in nm-connection-editor gives warnings about dbus service
not reachable.

Add a --without-firewalld option to configure to build without those
features. Default, if not specified, is to enable firewalld support,
as-is.

https://bugzilla.gnome.org/show_bug.cgi?id=737687
---
 configure.ac                         |  5 +++++
 src/connection-editor/page-general.c | 16 ++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

Index: network-manager-applet-1.0.0/configure.ac
===================================================================
--- network-manager-applet-1.0.0.orig/configure.ac
+++ network-manager-applet-1.0.0/configure.ac
@@ -151,6 +151,11 @@ esac
 
 AM_CONDITIONAL(HAVE_GBT, test x"$have_gbt" = "xyes")
 
+AC_ARG_WITH([firewalld],
+	    AS_HELP_STRING([--with-firewalld|--without-firewalld], [Enable firewalld integration support]),
+	    with_firewalld="$withval",with_firewalld=yes)
+AM_CONDITIONAL(HAVE_FIREWALLD, test x"with_firewalld" = "xyes")
+
 dnl ModemManager1 with libmm-glib
 AC_ARG_WITH(modem-manager-1, AS_HELP_STRING([--with-modem-manager-1], [Enable new ModemManager1 interface support]),,[with_modem_manager_1=auto])
 if (test "${with_modem_manager_1}" != "no"); then
Index: network-manager-applet-1.0.0/src/connection-editor/page-general.c
===================================================================
--- network-manager-applet-1.0.0.orig/src/connection-editor/page-general.c
+++ network-manager-applet-1.0.0/src/connection-editor/page-general.c
@@ -63,6 +63,7 @@ enum {
 	N_COLUMNS
 };
 
+#if 0
 static void populate_firewall_zones_ui (CEPageGeneral *self);
 
 static void
@@ -115,17 +116,19 @@ get_zones_from_firewall (CEPageGeneral *
 		dbus_g_connection_unref (bus);
 	}
 }
+#endif
 
 static void
 general_private_init (CEPageGeneral *self)
 {
 	CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
 	GtkBuilder *builder;
+	builder = CE_PAGE (self)->builder;
+
+#if 0
 	GtkWidget *align;
 	GtkLabel *label;
 
-	builder = CE_PAGE (self)->builder;
-
 	/*-- Firewall zone --*/
 	priv->firewall_zone = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new ());
 
@@ -139,6 +142,7 @@ general_private_init (CEPageGeneral *sel
 	/* Set mnemonic widget for device Firewall zone label */
 	label = GTK_LABEL (gtk_builder_get_object (builder, "firewall_zone_label"));
 	gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->firewall_zone));
+#endif
 
 	/*-- Dependent VPN connection --*/
 	priv->dependent_vpn_checkbox = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "dependent_vpn_checkbox"));
@@ -155,8 +159,9 @@ dispose (GObject *object)
 	CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (object);
 
 	g_clear_object (&priv->remote_settings);
+#if 0
 	g_clear_pointer (&priv->zones, g_strfreev);
-
+#endif
 	G_OBJECT_CLASS (ce_page_general_parent_class)->dispose (object);
 }
 
@@ -175,6 +180,7 @@ vpn_checkbox_toggled (GtkToggleButton *b
 	ce_page_changed (CE_PAGE (user_data));
 }
 
+#if 0
 static void
 populate_firewall_zones_ui (CEPageGeneral *self)
 {
@@ -213,6 +219,7 @@ populate_firewall_zones_ui (CEPageGenera
 
 	stuff_changed (NULL, self);
 }
+#endif
 
 static void
 populate_ui (CEPageGeneral *self)
@@ -225,9 +232,11 @@ populate_ui (CEPageGeneral *self)
 	GtkTreeIter iter;
 	gboolean global_connection = TRUE;
 
+#if 0
 	/* Zones are filled when got them from firewalld */
 	if (priv->got_zones)
 		populate_firewall_zones_ui (self);
+#endif
 
 	/* Secondary UUID (VPN) */
 	vpn_uuid = nm_setting_connection_get_secondary (setting, 0);
@@ -289,7 +298,9 @@ finish_setup (CEPageGeneral *self, gpoin
 
 	populate_ui (self);
 
+#if 0
 	g_signal_connect (priv->firewall_zone, "changed", G_CALLBACK (stuff_changed), self);
+#endif
 
 	any_dependent_vpn = !!nm_setting_connection_get_num_secondaries (priv->setting);
 	gtk_toggle_button_set_active (priv->dependent_vpn_checkbox, any_dependent_vpn);
