From 57b64368eff47943eba88375d75dce4f95bdeb39 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 7 Oct 2013 16:57:20 +0200 Subject: [PATCH] network: Merge two similar functions Merge connection_add_activate_cb() and connection_activate_cb(), the code is too similar. https://bugzilla.gnome.org/show_bug.cgi?id=709555 --- panels/network/net-device-wifi.c | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index 66f570c38..fb52264fe 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -629,6 +629,20 @@ connect_to_hidden_network (NetDeviceWifi *device_wifi) cc_network_panel_connect_to_hidden_network (toplevel, client, remote_settings); } +static void +connection_add_or_activate_cb (NMActiveConnection *connection, + GError *error, + NetDeviceWifi *device_wifi) +{ + if (connection == NULL) { + /* failed to activate */ + g_debug ("Failed to add and/or activate connection '%d': %s", + error->code, + error->message); + nm_device_wifi_refresh_ui (device_wifi); + } +} + static void connection_add_activate_cb (NMClient *client, NMActiveConnection *connection, @@ -636,15 +650,7 @@ connection_add_activate_cb (NMClient *client, GError *error, gpointer user_data) { - NetDeviceWifi *device_wifi = user_data; - - if (connection == NULL) { - /* failed to activate */ - g_debug ("Failed to add and activate connection '%d': %s", - error->code, - error->message); - nm_device_wifi_refresh_ui (device_wifi); - } + connection_add_or_activate_cb (connection, error, user_data); } static void @@ -653,15 +659,7 @@ connection_activate_cb (NMClient *client, GError *error, gpointer user_data) { - NetDeviceWifi *device_wifi = user_data; - - if (connection == NULL) { - /* failed to activate */ - g_debug ("Failed to activate connection '%d': %s", - error->code, - error->message); - nm_device_wifi_refresh_ui (device_wifi); - } + connection_add_or_activate_cb (connection, error, user_data); } static gboolean