Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for pool:aarch64
SUSE:SLE-15-SP4:Update
gnome-control-center
gnome-control-center-bring-back-firewall-zone.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-control-center-bring-back-firewall-zone.patch of Package gnome-control-center
Index: gnome-control-center-41.0/panels/network/connection-editor/ce-page-ethernet.c =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/ce-page-ethernet.c +++ gnome-control-center-41.0/panels/network/connection-editor/ce-page-ethernet.c @@ -27,6 +27,7 @@ #include "ce-page.h" #include "ce-page-ethernet.h" +#include "firewall-helpers.h" #include "ui-helpers.h" struct _CEPageEthernet @@ -38,8 +39,11 @@ struct _CEPageEthernet GtkSpinButton *mtu_spin; GtkWidget *mtu_label; GtkEntry *name_entry; + GtkLabel *firewall_heading; + GtkComboBoxText *firewall_combo; NMClient *client; + NMConnection *connection; NMSettingConnection *setting_connection; NMSettingWired *setting_wired; }; @@ -80,6 +84,7 @@ static void connect_ethernet_page (CEPageEthernet *self) { NMSettingWired *setting = self->setting_wired; + NMSettingConnection *sc; char **mac_list; const char *s_mac_str; const gchar *name; @@ -109,6 +114,10 @@ connect_ethernet_page (CEPageEthernet *s g_signal_connect_object (self->name_entry, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->mtu_spin, "value-changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); + + sc = nm_connection_get_setting_connection (self->connection); + firewall_ui_setup (sc, GTK_WIDGET (self->firewall_combo), GTK_WIDGET (self->firewall_heading), NULL); + g_signal_connect_swapped (self->firewall_combo, "changed", G_CALLBACK (ce_page_changed), self); } static void @@ -136,6 +145,8 @@ ui_to_setting (CEPageEthernet *self) g_object_set (self->setting_connection, NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name_entry), NULL); + + firewall_ui_to_setting (self->setting_connection, GTK_WIDGET (self->firewall_combo)); } static const gchar * @@ -180,6 +191,16 @@ ce_page_ethernet_validate (CEPage } static void +ce_page_ethernet_dispose (GObject *object) +{ + CEPageEthernet *self = CE_PAGE_ETHERNET (object); + + g_clear_object (&self->connection); + + G_OBJECT_CLASS (ce_page_ethernet_parent_class)->dispose (object); +} + +static void ce_page_ethernet_init (CEPageEthernet *self) { gtk_widget_init_template (GTK_WIDGET (self)); @@ -188,8 +209,11 @@ ce_page_ethernet_init (CEPageEthernet *s static void ce_page_ethernet_class_init (CEPageEthernetClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + object_class->dispose = ce_page_ethernet_dispose; + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/ethernet-page.ui"); gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, cloned_mac_combo); @@ -197,6 +221,8 @@ ce_page_ethernet_class_init (CEPageEther gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, mtu_spin); gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, mtu_label); gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, name_entry); + gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, firewall_heading); + gtk_widget_class_bind_template_child (widget_class, CEPageEthernet, firewall_combo); } static void @@ -215,6 +241,7 @@ ce_page_ethernet_new (NMConnection * self = CE_PAGE_ETHERNET (g_object_new (ce_page_ethernet_get_type (), NULL)); self->client = client; + self->connection = g_object_ref (connection); self->setting_connection = nm_connection_get_setting_connection (connection); self->setting_wired = nm_connection_get_setting_wired (connection); Index: gnome-control-center-41.0/panels/network/connection-editor/ce-page-security.c =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/ce-page-security.c +++ gnome-control-center-41.0/panels/network/connection-editor/ce-page-security.c @@ -27,6 +27,7 @@ #include "ce-page.h" #include "ce-page-security.h" +#include "firewall-helpers.h" #include "wireless-security.h" #include "ws-dynamic-wep.h" #include "ws-leap.h" @@ -42,6 +43,8 @@ struct _CEPageSecurity GtkBox *box; GtkComboBox *security_combo; GtkLabel *security_label; + GtkComboBox *firewall_combo; + GtkWidget *firewall_heading; NMConnection *connection; const gchar *security_setting; @@ -176,6 +179,7 @@ security_combo_changed (CEPageSecurity * gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (sec)); gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label)); + gtk_size_group_add_widget (self->group, self->firewall_heading); wireless_security_add_to_size_group (sec, self->group); gtk_container_add (GTK_CONTAINER (self->box), g_object_ref (GTK_WIDGET (sec))); @@ -230,6 +234,7 @@ finish_setup (CEPageSecurity *self) { NMSettingWireless *sw; NMSettingWirelessSecurity *sws; + NMSettingConnection *sc; gboolean is_adhoc = FALSE; g_autoptr(GtkListStore) sec_model = NULL; GtkTreeIter iter; @@ -396,6 +401,10 @@ finish_setup (CEPageSecurity *self) gtk_combo_box_set_active (self->security_combo, active < 0 ? 0 : (guint32) active); + sc = nm_connection_get_setting_connection (self->connection); + firewall_ui_setup (sc, GTK_WIDGET (self->firewall_combo), self->firewall_heading, NULL); + g_signal_connect_swapped (self->firewall_combo, "changed", G_CALLBACK (ce_page_changed), self); + security_combo_changed (self); g_signal_connect_object (self->security_combo, "changed", G_CALLBACK (security_combo_changed), self, G_CONNECT_SWAPPED); @@ -431,6 +440,7 @@ ce_page_security_validate (CEPage { CEPageSecurity *self = CE_PAGE_SECURITY (page); NMSettingWireless *sw; + NMSettingConnection *sc; g_autoptr(WirelessSecurity) sec = NULL; gboolean valid = FALSE; const char *mode; @@ -471,6 +481,9 @@ ce_page_security_validate (CEPage valid = TRUE; } + sc = nm_connection_get_setting_connection (connection); + firewall_ui_to_setting (sc, GTK_WIDGET (CE_PAGE_SECURITY (self)->firewall_combo)); + return valid; } @@ -493,6 +506,8 @@ ce_page_security_class_init (CEPageSecur gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, box); gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, security_label); gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, security_combo); + gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, firewall_heading); + gtk_widget_class_bind_template_child (widget_class, CEPageSecurity, firewall_combo); } static void Index: gnome-control-center-41.0/panels/network/connection-editor/ce-page-vpn.c =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/ce-page-vpn.c +++ gnome-control-center-41.0/panels/network/connection-editor/ce-page-vpn.c @@ -35,6 +35,8 @@ struct _CEPageVpn GtkLabel *failure_label; GtkEntry *name_entry; + GtkLabel *firewall_heading; + GtkComboBoxText *firewall_combo; NMConnection *connection; NMSettingConnection *setting_connection; @@ -125,6 +127,9 @@ connect_vpn_page (CEPageVpn *self) name = nm_setting_connection_get_id (self->setting_connection); gtk_entry_set_text (self->name_entry, name); g_signal_connect_object (self->name_entry, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED); + + firewall_ui_setup (self->setting_connection, GTK_WIDGET (self->firewall_combo), GTK_WIDGET (self->firewall_heading), NULL); + g_signal_connect_swapped (self->firewall_combo, "changed", G_CALLBACK (ce_page_changed), self); } static void @@ -160,6 +165,7 @@ ce_page_vpn_validate (CEPage *pag g_object_set (self->setting_connection, NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name_entry), NULL); + firewall_ui_to_setting (self->setting_connection, GTK_WIDGET (self->firewall_combo)); if (!nm_setting_verify (NM_SETTING (self->setting_connection), NULL, error)) return FALSE; @@ -188,6 +194,8 @@ ce_page_vpn_class_init (CEPageVpnClass * gtk_widget_class_bind_template_child (widget_class, CEPageVpn, failure_label); gtk_widget_class_bind_template_child (widget_class, CEPageVpn, name_entry); + gtk_widget_class_bind_template_child (widget_class, CEPageVpn, firewall_heading); + gtk_widget_class_bind_template_child (widget_class, CEPageVpn, firewall_combo); } static void Index: gnome-control-center-41.0/panels/network/connection-editor/ethernet-page.ui =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/ethernet-page.ui +++ gnome-control-center-41.0/panels/network/connection-editor/ethernet-page.ui @@ -159,6 +159,36 @@ </packing> </child> <child> + <object class="GtkLabel" id="firewall_heading"> + <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">firewall_combo</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="firewall_combo"> + <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> + <child> <placeholder/> </child> <child> Index: gnome-control-center-41.0/panels/network/connection-editor/firewall-helpers.c =================================================================== --- /dev/null +++ gnome-control-center-41.0/panels/network/connection-editor/firewall-helpers.c @@ -0,0 +1,125 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2013 Red Hat, Inc. + */ + +#include "config.h" + +#include <glib/gi18n.h> +#include <gio/gio.h> + +#include "firewall-helpers.h" + +typedef struct { + gchar *zone; + GtkWidget *combo; + GtkWidget *label; +} GetZonesReplyData; + +static void +get_zones_reply (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + GDBusConnection *bus = G_DBUS_CONNECTION (source); + GetZonesReplyData *d = user_data; + GVariant *ret; + GError *error = NULL; + const gchar **zones; + gint idx; + gint i; + + ret = g_dbus_connection_call_finish (bus, res, &error); + + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (d->combo), + C_("Firewall zone", "Default")); + gtk_widget_set_tooltip_text (d->combo, _("The zone defines the trust level of the connection")); + + idx = 0; + if (error) { + gtk_widget_hide (d->combo); + gtk_widget_hide (d->label); + g_error_free (error); + } + else { + gtk_widget_show (d->combo); + gtk_widget_show (d->label); + g_variant_get (ret, "(^a&s)", &zones); + + for (i = 0; zones[i]; i++) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (d->combo), + zones[i]); + if (g_strcmp0 (d->zone, zones[i]) == 0) + idx = i + 1; + } + if (d->zone && idx == 0) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (d->combo), + d->zone); + idx = i + 1; + } + g_variant_unref (ret); + } + gtk_combo_box_set_active (GTK_COMBO_BOX (d->combo), idx); + + g_free (d->zone); + g_free (d); +} + +void +firewall_ui_setup (NMSettingConnection *setting, + GtkWidget *combo, + GtkWidget *label, + GCancellable *cancellable) +{ + GDBusConnection *bus; + GetZonesReplyData *d; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + + 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", + "/org/fedoraproject/FirewallD1", + "org.fedoraproject.FirewallD1.zone", + "getZones", + NULL, + NULL, + 0, + G_MAXINT, + cancellable, + get_zones_reply, d); + g_object_unref (bus); +} + +void +firewall_ui_to_setting (NMSettingConnection *setting, GtkWidget *combo) +{ + gchar *zone; + + zone = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo)); + if (g_strcmp0 (zone, C_("Firewall zone", "Default")) == 0) { + g_free (zone); + zone = NULL; + } + + g_object_set (setting, NM_SETTING_CONNECTION_ZONE, zone, NULL); + g_free (zone); +} Index: gnome-control-center-41.0/panels/network/connection-editor/firewall-helpers.h =================================================================== --- /dev/null +++ gnome-control-center-41.0/panels/network/connection-editor/firewall-helpers.h @@ -0,0 +1,33 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * (C) Copyright 2013 Red Hat, Inc. + */ + +#ifndef _FIREWALL_HELPERS_H_ +#define _FIREWALL_HELPERS_H_ + +#include <NetworkManager.h> +#include <gtk/gtk.h> + +void firewall_ui_setup (NMSettingConnection *setting, + GtkWidget *combo, + GtkWidget *label, + GCancellable *cancellable); +void firewall_ui_to_setting (NMSettingConnection *setting, + GtkWidget *combo); + + +#endif /* _FIREWALL_HELPERS_H_ */ Index: gnome-control-center-41.0/panels/network/connection-editor/meson.build =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/meson.build +++ gnome-control-center-41.0/panels/network/connection-editor/meson.build @@ -12,6 +12,7 @@ sources = files( 'ce-page-vpn.c', 'ce-page-wifi.c', 'ce-page.c', + 'firewall-helpers.c', 'net-connection-editor.c', 'vpn-helpers.c' ) Index: gnome-control-center-41.0/panels/network/connection-editor/security-page.ui =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/security-page.ui +++ gnome-control-center-41.0/panels/network/connection-editor/security-page.ui @@ -47,6 +47,37 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> + <object class="GtkLabel" id="firewall_heading"> + <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">firewall_combo</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="firewall_combo"> + <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> + <child> <placeholder/> </child> </object> Index: gnome-control-center-41.0/panels/network/connection-editor/vpn-page.ui =================================================================== --- gnome-control-center-41.0.orig/panels/network/connection-editor/vpn-page.ui +++ gnome-control-center-41.0/panels/network/connection-editor/vpn-page.ui @@ -51,6 +51,45 @@ </packing> </child> <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="firewall_heading"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Firewall _Zone</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">firewall_combo</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="firewall_combo"> + <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="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkLabel" id="failure_label"> <property name="visible">True</property> <property name="can_focus">False</property>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor