summaryrefslogtreecommitdiff
path: root/panels/network/net-device-mobile.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-04-29 16:05:54 +0200
committerBastien Nocera <hadess@hadess.net>2016-05-27 18:23:33 +0200
commit9183d3494788486600856df5115f11486ecb20a8 (patch)
treef76225fbaafa71646a2a6f078908292e838797c4 /panels/network/net-device-mobile.c
parent8400d3ed81d15c7406e14908437033a72348fd95 (diff)
downloadgnome-control-center-9183d3494788486600856df5115f11486ecb20a8.tar.gz
network: Port to libnm 1.2
We also remove support for WiMAX (now unsupported by NetworkManager), and InfiniBand (Enterprise feature), and the use of the deprecated NM_SETTING_WIRELESS_SEC property. With help from network-manager-applet patches by Jiří Klimeš and Dan Winship. https://bugzilla.gnome.org/show_bug.cgi?id=765910
Diffstat (limited to 'panels/network/net-device-mobile.c')
-rw-r--r--panels/network/net-device-mobile.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 71379f909..408b2dc99 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -25,17 +25,12 @@
#include <glib-object.h>
#include <glib/gi18n.h>
-#include <nm-client.h>
-#include <nm-device.h>
-#include <nm-device-modem.h>
-#include <nm-remote-connection.h>
-#include <nm-mobile-providers.h>
+#include <NetworkManager.h>
+#include <libmm-glib.h>
+#include <nma-mobile-providers.h>
#include "panel-common.h"
#include "network-dialogs.h"
-
-#include <libmm-glib.h>
-
#include "net-device-mobile.h"
#define NET_DEVICE_MOBILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_MOBILE, NetDeviceMobilePrivate))
@@ -95,16 +90,16 @@ device_mobile_proxy_add_to_notebook (NetObject *object,
}
static void
-connection_activate_cb (NMClient *client,
- NMActiveConnection *connection,
- GError *error,
+connection_activate_cb (GObject *source_object,
+ GAsyncResult *res,
gpointer user_data)
{
- NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (user_data);
+ GError *error = NULL;
- if (connection == NULL) {
+ if (!nm_client_activate_connection_finish (NM_CLIENT (source_object), res, &error)) {
/* failed to activate */
- nm_device_mobile_refresh_ui (device_mobile);
+ nm_device_mobile_refresh_ui (user_data);
+ g_error_free (error);
}
}
@@ -118,7 +113,6 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
NMConnection *connection;
NMDevice *device;
NMClient *client;
- NMRemoteSettings *remote_settings;
CcNetworkPanel *panel;
GtkWidget *toplevel;
@@ -133,7 +127,6 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
if (device == NULL)
goto out;
client = net_object_get_client (NET_OBJECT (device_mobile));
- remote_settings = net_object_get_remote_settings (NET_OBJECT (device_mobile));
/* get entry */
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
@@ -145,22 +138,20 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)));
cc_network_panel_connect_to_3g_network (toplevel,
client,
- remote_settings,
device);
goto out;
}
/* activate the connection */
g_debug ("try to switch to connection %s", object_path);
- connection = (NMConnection*) nm_remote_settings_get_connection_by_path (remote_settings,
- object_path);
+ connection = (NMConnection*) nm_client_get_connection_by_path (client, object_path);
if (connection != NULL) {
nm_device_disconnect (device, NULL, NULL);
- nm_client_activate_connection (client,
- connection,
- device, NULL,
- connection_activate_cb,
- device_mobile);
+ nm_client_activate_connection_async (client,
+ connection,
+ device, NULL, NULL,
+ connection_activate_cb,
+ device_mobile);
goto out;
}
out:
@@ -216,8 +207,8 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
/* is this already activated? */
if (active_connection != NULL &&
- g_strcmp0 (nm_connection_get_path (connection),
- nm_active_connection_get_connection (active_connection)) == 0) {
+ g_strcmp0 (nm_connection_get_uuid (connection),
+ nm_active_connection_get_uuid (active_connection)) == 0) {
priv->updating_device = TRUE;
gtk_combo_box_set_active_iter (combobox, &treeiter);
priv->updating_device = FALSE;
@@ -434,7 +425,6 @@ device_off_toggled (GtkSwitch *sw,
GParamSpec *pspec,
NetDeviceMobile *device_mobile)
{
- const gchar *path;
const GPtrArray *acs;
gboolean active;
gint i;
@@ -451,21 +441,23 @@ device_off_toggled (GtkSwitch *sw,
connection = net_device_get_find_connection (NET_DEVICE (device_mobile));
if (connection == NULL)
return;
- nm_client_activate_connection (client,
- connection,
- net_device_get_nm_device (NET_DEVICE (device_mobile)),
- NULL, NULL, NULL);
+ nm_client_activate_connection_async (client,
+ connection,
+ net_device_get_nm_device (NET_DEVICE (device_mobile)),
+ NULL, NULL, NULL, NULL);
} else {
+ const gchar *uuid;
+
connection = net_device_get_find_connection (NET_DEVICE (device_mobile));
if (connection == NULL)
return;
- path = nm_connection_get_path (connection);
+ uuid = nm_connection_get_uuid (connection);
client = net_object_get_client (NET_OBJECT (device_mobile));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
- if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
- nm_client_deactivate_connection (client, a);
+ if (strcmp (nm_active_connection_get_uuid (a), uuid) == 0) {
+ nm_client_deactivate_connection (client, a, NULL, NULL);
break;
}
}