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
This commit is contained in:
parent
3c1b58ab2a
commit
57b64368ef
1 changed files with 16 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue