network: Remove net_object_edit virtual method

It didn't need to be virtual and was only used in two cases
This commit is contained in:
Robert Ancell 2019-10-18 15:42:05 +13:00 committed by Georges Basile Stavracas Neto
parent 926063acb3
commit 62af171d8b
7 changed files with 24 additions and 65 deletions

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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,

View file

@ -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:
**/

View file

@ -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);

View file

@ -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,