summaryrefslogtreecommitdiff
path: root/libnm/nm-active-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/nm-active-connection.c')
-rw-r--r--libnm/nm-active-connection.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c
index 94a9cc5f0f..b3dcf61915 100644
--- a/libnm/nm-active-connection.c
+++ b/libnm/nm-active-connection.c
@@ -24,7 +24,7 @@
#include "nm-dbus-interface.h"
#include "nm-active-connection.h"
#include "nm-object-private.h"
-#include "nm-types-private.h"
+#include "nm-types.h"
#include "nm-device.h"
#include "nm-device-private.h"
#include "nm-connection.h"
@@ -32,9 +32,9 @@
#include "nm-glib-compat.h"
#include "nm-dbus-helpers-private.h"
-static GType _nm_active_connection_type_for_path (DBusGConnection *connection,
+static GType _nm_active_connection_type_for_path (GDBusConnection *connection,
const char *path);
-static void _nm_active_connection_type_for_path_async (DBusGConnection *connection,
+static void _nm_active_connection_type_for_path_async (GDBusConnection *connection,
const char *path,
NMObjectTypeCallbackFunc callback,
gpointer user_data);
@@ -48,7 +48,7 @@ G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJEC
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
typedef struct {
- DBusGProxy *proxy;
+ GDBusProxy *proxy;
char *connection;
char *id;
@@ -89,12 +89,12 @@ enum {
};
static GType
-_nm_active_connection_type_for_path (DBusGConnection *connection,
+_nm_active_connection_type_for_path (GDBusConnection *connection,
const char *path)
{
- DBusGProxy *proxy;
+ GDBusProxy *proxy;
GError *error = NULL;
- GValue value = G_VALUE_INIT;
+ GVariant *ret;
GType type;
proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties");
@@ -106,13 +106,16 @@ _nm_active_connection_type_for_path (DBusGConnection *connection,
/* Have to create an NMVpnConnection if it's a VPN connection, otherwise
* a plain NMActiveConnection.
*/
- if (dbus_g_proxy_call (proxy,
- "Get", &error,
- G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- G_TYPE_STRING, "Vpn",
- G_TYPE_INVALID,
- G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
- if (g_value_get_boolean (&value))
+ ret = g_dbus_proxy_call_sync (proxy,
+ "Get",
+ g_variant_new ("(ss)", NM_DBUS_INTERFACE_ACTIVE_CONNECTION, "Vpn"),
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL, &error);
+ if (ret) {
+ gboolean is_vpn;
+
+ g_variant_get (ret, "(b)", &is_vpn);
+ if (is_vpn)
type = NM_TYPE_VPN_CONNECTION;
else
type = NM_TYPE_ACTIVE_CONNECTION;
@@ -128,24 +131,27 @@ _nm_active_connection_type_for_path (DBusGConnection *connection,
}
typedef struct {
- DBusGConnection *connection;
+ GDBusConnection *connection;
NMObjectTypeCallbackFunc callback;
gpointer user_data;
} NMActiveConnectionAsyncData;
static void
-async_got_type (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+async_got_type (GObject *source, GAsyncResult *result, gpointer user_data)
{
+ GDBusProxy *proxy = G_DBUS_PROXY (source);
NMActiveConnectionAsyncData *async_data = user_data;
- GValue value = G_VALUE_INIT;
- const char *path = dbus_g_proxy_get_path (proxy);
+ GVariant *ret;
+ const char *path = g_dbus_proxy_get_object_path (proxy);
GError *error = NULL;
GType type;
- if (dbus_g_proxy_end_call (proxy, call, &error,
- G_TYPE_VALUE, &value,
- G_TYPE_INVALID)) {
- if (g_value_get_boolean (&value))
+ ret = g_dbus_proxy_call_finish (proxy, result, &error);
+ if (ret) {
+ gboolean is_vpn;
+
+ g_variant_get (ret, "(b)", &is_vpn);
+ if (is_vpn)
type = NM_TYPE_VPN_CONNECTION;
else
type = NM_TYPE_ACTIVE_CONNECTION;
@@ -161,13 +167,13 @@ async_got_type (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
}
static void
-_nm_active_connection_type_for_path_async (DBusGConnection *connection,
+_nm_active_connection_type_for_path_async (GDBusConnection *connection,
const char *path,
NMObjectTypeCallbackFunc callback,
gpointer user_data)
{
NMActiveConnectionAsyncData *async_data;
- DBusGProxy *proxy;
+ GDBusProxy *proxy;
async_data = g_slice_new (NMActiveConnectionAsyncData);
async_data->connection = connection;
@@ -175,11 +181,12 @@ _nm_active_connection_type_for_path_async (DBusGConnection *connection,
async_data->user_data = user_data;
proxy = _nm_dbus_new_proxy_for_connection (connection, path, "org.freedesktop.DBus.Properties");
- dbus_g_proxy_begin_call (proxy, "Get",
- async_got_type, async_data, NULL,
- G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
- G_TYPE_STRING, "Vpn",
- G_TYPE_INVALID);
+ g_dbus_proxy_call (proxy,
+ "Get",
+ g_variant_new ("(ss)", NM_DBUS_INTERFACE_ACTIVE_CONNECTION, "Vpn"),
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL,
+ async_got_type, async_data);
}
/**