File NetworkManager-gnome-no-firewalld.patch of Package NetworkManager-gnome
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(-)
diff --git a/configure.ac b/configure.ac
index d6ca9e6..fce24e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,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
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 462e546..03f9746 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -62,6 +62,7 @@ enum {
N_COLUMNS
};
+#if HAVE_FIREWALLD
static void populate_firewall_zones_ui (CEPageGeneral *self);
static void
@@ -114,17 +115,19 @@ get_zones_from_firewall (CEPageGeneral *self)
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 HAVE_FIREWALLD
GtkWidget *align;
GtkLabel *label;
- builder = CE_PAGE (self)->builder;
-
/*-- Firewall zone --*/
priv->firewall_zone = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new ());
@@ -138,6 +141,7 @@ general_private_init (CEPageGeneral *self)
/* 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"));
@@ -159,8 +163,10 @@ dispose (GObject *object)
priv->remote_settings = NULL;
}
+#if HAVE_FIREWALLD
g_strfreev (priv->zones);
priv->zones = NULL;
+#endif
G_OBJECT_CLASS (ce_page_general_parent_class)->dispose (object);
}
@@ -180,6 +186,7 @@ vpn_checkbox_toggled (GtkToggleButton *button, gpointer user_data)
ce_page_changed (CE_PAGE (user_data));
}
+#if HAVE_FIREWALLD
static void
populate_firewall_zones_ui (CEPageGeneral *self)
{
@@ -218,6 +225,7 @@ populate_firewall_zones_ui (CEPageGeneral *self)
stuff_changed (NULL, self);
}
+#endif
static void
populate_ui (CEPageGeneral *self)
@@ -230,9 +238,11 @@ populate_ui (CEPageGeneral *self)
GtkTreeIter iter;
gboolean global_connection = TRUE;
+#if HAVE_FIREWALLD
/* 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);
@@ -294,7 +304,9 @@ finish_setup (CEPageGeneral *self, gpointer unused, GError *error, gpointer user
populate_ui (self);
+#if HAVE_FIREWALLD
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);
--
2.1.0