[gnome-control-center] network: Merge two similar functions



commit 57b64368eff47943eba88375d75dce4f95bdeb39
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 7 16:57:20 2013 +0200

    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 |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 66f570c..fb52264 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -630,17 +630,13 @@ connect_to_hidden_network (NetDeviceWifi *device_wifi)
 }
 
 static void
-connection_add_activate_cb (NMClient *client,
-                            NMActiveConnection *connection,
-                            const char *path,
-                            GError *error,
-                            gpointer user_data)
+connection_add_or_activate_cb (NMActiveConnection *connection,
+                               GError *error,
+                               NetDeviceWifi *device_wifi)
 {
-        NetDeviceWifi *device_wifi = user_data;
-
         if (connection == NULL) {
                 /* failed to activate */
-                g_debug ("Failed to add and activate connection '%d': %s",
+                g_debug ("Failed to add and/or activate connection '%d': %s",
                          error->code,
                          error->message);
                 nm_device_wifi_refresh_ui (device_wifi);
@@ -648,20 +644,22 @@ connection_add_activate_cb (NMClient *client,
 }
 
 static void
+connection_add_activate_cb (NMClient *client,
+                            NMActiveConnection *connection,
+                            const char *path,
+                            GError *error,
+                            gpointer user_data)
+{
+        connection_add_or_activate_cb (connection, error, user_data);
+}
+
+static void
 connection_activate_cb (NMClient *client,
                         NMActiveConnection *connection,
                         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


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