[gnome-control-center] network: Remove net_object_edit virtual method



commit 62af171d8b19b58845618682a1d1addb72af6d81
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Oct 18 15:42:05 2019 +1300

    network: Remove net_object_edit virtual method
    
    It didn't need to be virtual and was only used in two cases

 panels/network/net-device-mobile.c | 12 +++++++++++-
 panels/network/net-device-simple.c | 12 +++++++++++-
 panels/network/net-device-wifi.c   | 24 ------------------------
 panels/network/net-device.c        | 19 -------------------
 panels/network/net-object.c        |  8 --------
 panels/network/net-object.h        |  2 --
 panels/network/net-vpn.c           | 12 ++----------
 7 files changed, 24 insertions(+), 65 deletions(-)
---
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 13689475e..4079a2347 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -529,7 +529,17 @@ device_off_toggled (NetDeviceMobile *self)
 static void
 edit_connection (NetDeviceMobile *self)
 {
-        net_object_edit (NET_OBJECT (self));
+        const gchar *uuid;
+        g_autofree gchar *cmdline = NULL;
+        g_autoptr(GError) error = NULL;
+        NMConnection *connection;
+
+        connection = net_device_get_find_connection (NET_DEVICE (self));
+        uuid = nm_connection_get_uuid (connection);
+        cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
+        g_debug ("Launching '%s'\n", cmdline);
+        if (!g_spawn_command_line_async (cmdline, &error))
+                g_warning ("Failed to launch nm-connection-editor: %s", error->message);
 }
 
 static void
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index 5c7bd9522..f30767033 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -168,7 +168,17 @@ device_off_toggled (NetDeviceSimple *self)
 static void
 edit_connection (NetDeviceSimple *self)
 {
-        net_object_edit (NET_OBJECT (self));
+        const gchar *uuid;
+        g_autofree gchar *cmdline = NULL;
+        g_autoptr(GError) error = NULL;
+        NMConnection *connection;
+
+        connection = net_device_get_find_connection (NET_DEVICE (self));
+        uuid = nm_connection_get_uuid (connection);
+        cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
+        g_debug ("Launching '%s'\n", cmdline);
+        if (!g_spawn_command_line_async (cmdline, &error))
+                g_warning ("Failed to launch nm-connection-editor: %s", error->message);
 }
 
 static void
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 5d7a91d10..1cf65dc59 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -984,29 +984,6 @@ net_device_wifi_finalize (GObject *object)
         G_OBJECT_CLASS (net_device_wifi_parent_class)->finalize (object);
 }
 
-static void
-device_wifi_edit (NetObject *object)
-{
-        const gchar *uuid;
-        g_autofree gchar *cmdline = NULL;
-        g_autoptr(GError) error = NULL;
-        NetDeviceWifi *device = NET_DEVICE_WIFI (object);
-        NMClient *client;
-        NMRemoteConnection *connection;
-
-        client = net_object_get_client (object);
-        connection = nm_client_get_connection_by_path (client, device->selected_connection_id);
-        if (connection == NULL) {
-                g_warning ("failed to get remote connection");
-                return;
-        }
-        uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
-        cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
-        g_debug ("Launching '%s'\n", cmdline);
-        if (!g_spawn_command_line_async (cmdline, &error))
-                g_warning ("Failed to launch nm-connection-editor: %s", error->message);
-}
-
 static void
 net_device_wifi_get_property (GObject    *object,
                               guint       prop_id,
@@ -1036,7 +1013,6 @@ net_device_wifi_class_init (NetDeviceWifiClass *klass)
         object_class->get_property = net_device_wifi_get_property;
         parent_class->add_to_stack = device_wifi_proxy_add_to_stack;
         parent_class->refresh = device_wifi_refresh;
-        parent_class->edit = device_wifi_edit;
 
         g_object_class_install_property (object_class,
                                          PROP_SCANNING,
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index bfa676b13..213f91d55 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -173,23 +173,6 @@ net_device_get_nm_device (NetDevice *self)
         return priv->nm_device;
 }
 
-static void
-net_device_edit (NetObject *object)
-{
-        const gchar *uuid;
-        g_autofree gchar *cmdline = NULL;
-        g_autoptr(GError) error = NULL;
-        NetDevice *self = NET_DEVICE (object);
-        NMConnection *connection;
-
-        connection = net_device_get_find_connection (self);
-        uuid = nm_connection_get_uuid (connection);
-        cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
-        g_debug ("Launching '%s'\n", cmdline);
-        if (!g_spawn_command_line_async (cmdline, &error))
-                g_warning ("Failed to launch nm-connection-editor: %s", error->message);
-}
-
 /**
  * net_device_get_property:
  **/
@@ -265,12 +248,10 @@ net_device_class_init (NetDeviceClass *klass)
 {
         GParamSpec *pspec;
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
-        NetObjectClass *parent_class = NET_OBJECT_CLASS (klass);
 
         object_class->finalize = net_device_finalize;
         object_class->get_property = net_device_get_property;
         object_class->set_property = net_device_set_property;
-        parent_class->edit = net_device_edit;
 
         pspec = g_param_spec_object ("nm-device", NULL, NULL,
                                      NM_TYPE_DEVICE,
diff --git a/panels/network/net-object.c b/panels/network/net-object.c
index 0e2e2fc79..ff3a371dc 100644
--- a/panels/network/net-object.c
+++ b/panels/network/net-object.c
@@ -178,14 +178,6 @@ net_object_refresh (NetObject *self)
                 klass->refresh (self);
 }
 
-void
-net_object_edit (NetObject *self)
-{
-        NetObjectClass *klass = NET_OBJECT_GET_CLASS (self);
-        if (klass->edit != NULL)
-                klass->edit (self);
-}
-
 /**
  * net_object_get_property:
  **/
diff --git a/panels/network/net-object.h b/panels/network/net-object.h
index b6eb2d5f2..4434326b9 100644
--- a/panels/network/net-object.h
+++ b/panels/network/net-object.h
@@ -43,7 +43,6 @@ struct _NetObjectClass
                                                         GtkSizeGroup    *heading_size_group);
         void                     (*delete)              (NetObject       *object);
         void                     (*refresh)             (NetObject       *object);
-        void                     (*edit)                (NetObject       *object);
 };
 
 const gchar     *net_object_get_id                      (NetObject      *object);
@@ -59,7 +58,6 @@ void             net_object_emit_changed                (NetObject      *object)
 void             net_object_emit_removed                (NetObject      *object);
 void             net_object_delete                      (NetObject      *object);
 void             net_object_refresh                     (NetObject      *object);
-void             net_object_edit                        (NetObject      *object);
 GtkWidget       *net_object_add_to_stack                (NetObject      *object,
                                                          GtkStack       *stack,
                                                          GtkSizeGroup   *heading_size_group);
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 6266a35ae..14cda792b 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -248,12 +248,6 @@ device_off_toggled (NetVpn *self)
         }
 }
 
-static void
-edit_connection (NetVpn *self)
-{
-        net_object_edit (NET_OBJECT (self));
-}
-
 static void
 editor_done (NetVpn *self)
 {
@@ -262,9 +256,8 @@ editor_done (NetVpn *self)
 }
 
 static void
-vpn_proxy_edit (NetObject *object)
+edit_connection (NetVpn *self)
 {
-        NetVpn *self = NET_VPN (object);
         GtkWidget *window;
         NetConnectionEditor *editor;
         NMClient *client;
@@ -272,7 +265,7 @@ vpn_proxy_edit (NetObject *object)
 
         window = gtk_widget_get_toplevel (GTK_WIDGET (self->options_button));
 
-        client = net_object_get_client (object);
+        client = net_object_get_client (NET_OBJECT (self));
 
         editor = net_connection_editor_new (GTK_WINDOW (window),
                                             self->connection,
@@ -384,7 +377,6 @@ net_vpn_class_init (NetVpnClass *klass)
         parent_class->add_to_stack = vpn_proxy_add_to_stack;
         parent_class->delete = vpn_proxy_delete;
         parent_class->refresh = vpn_proxy_refresh;
-        parent_class->edit = vpn_proxy_edit;
 
         pspec = g_param_spec_object ("connection", NULL, NULL,
                                      NM_TYPE_CONNECTION,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]