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

77 lines
3.5 KiB
Diff

Index: gnome-control-center-3.20.1/panels/network/cc-network-panel.c
===================================================================
--- gnome-control-center-3.20.1.orig/panels/network/cc-network-panel.c
+++ gnome-control-center-3.20.1/panels/network/cc-network-panel.c
@@ -1286,10 +1286,23 @@ panel_check_network_manager_version (CcN
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->priv->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);
@@ -1312,9 +1325,22 @@ panel_check_network_manager_version (CcN
gtk_widget_show_all (box);
g_free (markup);
+ } else if (g_strcmp0 (state, "active") == 0) {
+ GtkWidget *w;
+
+ w = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "devices_toolbar"));
+ gtk_widget_hide (w);
+ w = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "label_NM_warning"));
+ gtk_widget_show (w);
} else {
manager_running (panel->priv->client, NULL, panel);
}
+
+ g_object_unref (connection);
+ g_object_unref (proxy);
+ g_variant_unref (variant);
}
static void
Index: gnome-control-center-3.20.1/panels/network/network.ui
===================================================================
--- gnome-control-center-3.20.1.orig/panels/network/network.ui
+++ gnome-control-center-3.20.1/panels/network/network.ui
@@ -127,6 +127,19 @@
<property name="position">1</property>
</packing>
</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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>