gnome-control-center/gnome-control-center-disable-error-message-for-NM.patch

102 lines
4.5 KiB
Diff
Raw Normal View History

diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index ad019a380..9b5119b77 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -64,8 +64,10 @@ struct _CcNetworkPanel
/* widgets */
GtkWidget *box_proxy;
GtkWidget *box_vpn;
+ GtkWidget *box_vpn1;
GtkWidget *box_wired;
GtkWidget *empty_listbox;
+ GtkWidget *label_NM_warning;
/* wireless dialog stuff */
CmdlineOperation arg_operation;
@@ -734,10 +736,23 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
GtkWidget *label;
gchar *markup;
const gchar *version;
+ const gchar *state;
+ GDBusConnection *connection;
+ GDBusProxy *proxy;
+ GVariant *variant;
+
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+ proxy = g_dbus_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1/unit/wickedd_2ddhcp6_2eservice",
+ "org.freedesktop.systemd1.Unit",
+ NULL, NULL);
+ variant = g_dbus_proxy_get_cached_property (proxy, "ActiveState");
+ state = g_variant_get_string (variant, NULL);
/* parse running version */
version = nm_client_get_version (panel->client);
- if (version == NULL) {
+ if (version == NULL && g_strcmp0 (state, "inactive") == 0) {
gtk_container_remove (GTK_CONTAINER (panel), gtk_bin_get_child (GTK_BIN (panel)));
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
@@ -760,9 +775,17 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
gtk_widget_show_all (box);
g_free (markup);
+ } else if (g_strcmp0 (state, "active") == 0) {
+ gtk_widget_hide (panel->box_vpn1);
+ gtk_widget_hide (panel->box_wired);
+ gtk_widget_show (panel->label_NM_warning);
} else {
manager_running (panel->client, NULL, panel);
}
+
+ g_object_unref (connection);
+ g_object_unref (proxy);
+ g_variant_unref (variant);
}
static void
@@ -816,9 +839,11 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_proxy);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_vpn);
+ gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_vpn1);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_wired);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, empty_listbox);
gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, sizegroup);
+ gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, label_NM_warning);
gtk_widget_class_bind_template_callback (widget_class, create_connection_cb);
}
diff --git a/panels/network/network.ui b/panels/network/network.ui
index 93b770d0d..0a35c3270 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -79,7 +79,7 @@
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="box_vpn1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -168,6 +168,14 @@
<property name="orientation">vertical</property>
</object>
</child>
+ <child>
+ <object class="GtkLabel" id="label_NM_warning">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Please use YaST2 to configure your network.</property>
+ </object>
+ </child>
</object>
</child>
</object>
--
2.13.4