summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-01-13 13:03:02 -0600
committerDan Williams <dcbw@redhat.com>2011-01-13 13:03:02 -0600
commitb5f3aa7120c2cff17d515087e675b5f16f1a06c7 (patch)
tree6bb907b0857c19dcdbc21c57de5e12a1cee710b3 /libnm-glib
parent2d9cd80c870d6eb209605d927c0b4144c85a25cb (diff)
downloadNetworkManager-b5f3aa7120c2cff17d515087e675b5f16f1a06c7.tar.gz
libnm-glib: pass NMClient as first callback argument to activation callbacks
Better matches glib style.
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/nm-client.c26
-rw-r--r--libnm-glib/nm-client.h12
2 files changed, 18 insertions, 20 deletions
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index b00f65b692..ff8b999e6c 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2010 Red Hat, Inc.
+ * Copyright (C) 2007 - 2011 Red Hat, Inc.
*/
#include <dbus/dbus-glib.h>
@@ -1080,6 +1080,7 @@ nm_client_get_device_by_path (NMClient *client, const char *object_path)
}
typedef struct {
+ NMClient *client;
NMClientActivateDeviceFn act_fn;
NMClientAddActivateFn add_act_fn;
gpointer user_data;
@@ -1094,7 +1095,7 @@ activate_cb (DBusGProxy *proxy,
ActivateDeviceInfo *info = (ActivateDeviceInfo *) user_data;
if (info->act_fn)
- info->act_fn (info->user_data, path, error);
+ info->act_fn (info->client, path, error, info->user_data);
else if (error)
nm_warning ("Device activation failed: (%d) %s", error->code, error->message);
@@ -1122,28 +1123,22 @@ nm_client_activate_connection (NMClient *client,
gpointer user_data)
{
ActivateDeviceInfo *info;
- char *internal_so = (char *) specific_object;
g_return_if_fail (NM_IS_CLIENT (client));
g_return_if_fail (NM_IS_DEVICE (device));
g_return_if_fail (connection_path != NULL);
- /* NULL specific object must be translated into "/" because D-Bus does
- * not have any idea of NULL object paths.
- */
- if (internal_so == NULL)
- internal_so = "/";
-
info = g_slice_new (ActivateDeviceInfo);
info->act_fn = callback;
info->user_data = user_data;
+ info->client = client;
org_freedesktop_NetworkManager_activate_connection_async (NM_CLIENT_GET_PRIVATE (client)->client_proxy,
- connection_path,
- nm_object_get_path (NM_OBJECT (device)),
- internal_so,
- activate_cb,
- info);
+ connection_path,
+ nm_object_get_path (NM_OBJECT (device)),
+ specific_object ? specific_object : "/",
+ activate_cb,
+ info);
}
static void
@@ -1156,7 +1151,7 @@ add_activate_cb (DBusGProxy *proxy,
ActivateDeviceInfo *info = (ActivateDeviceInfo *) user_data;
if (info->add_act_fn)
- info->add_act_fn (info->user_data, connection_path, active_path, error);
+ info->add_act_fn (info->client, connection_path, active_path, error, info->user_data);
else if (error)
nm_warning ("Connection add and activate failed: (%d) %s", error->code, error->message);
@@ -1201,6 +1196,7 @@ nm_client_add_and_activate_connection (NMClient *client,
info = g_slice_new (ActivateDeviceInfo);
info->add_act_fn = callback;
info->user_data = user_data;
+ info->client = client;
if (partial)
hash = nm_connection_to_hash (partial);
diff --git a/libnm-glib/nm-client.h b/libnm-glib/nm-client.h
index eae04c5d2c..bdc5ab81fb 100644
--- a/libnm-glib/nm-client.h
+++ b/libnm-glib/nm-client.h
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2010 Red Hat, Inc.
+ * Copyright (C) 2007 - 2011 Red Hat, Inc.
*/
#ifndef NM_CLIENT_H
@@ -107,9 +107,10 @@ NMClient *nm_client_new (void);
const GPtrArray *nm_client_get_devices (NMClient *client);
NMDevice *nm_client_get_device_by_path (NMClient *client, const char *object_path);
-typedef void (*NMClientActivateDeviceFn) (gpointer user_data,
+typedef void (*NMClientActivateDeviceFn) (NMClient *client,
const char *object_path,
- GError *error);
+ GError *error,
+ gpointer user_data);
void nm_client_activate_connection (NMClient *client,
const char *connection_path,
@@ -118,10 +119,11 @@ void nm_client_activate_connection (NMClient *client,
NMClientActivateDeviceFn callback,
gpointer user_data);
-typedef void (*NMClientAddActivateFn) (gpointer user_data,
+typedef void (*NMClientAddActivateFn) (NMClient *client,
const char *connection_path,
const char *active_path,
- GError *error);
+ GError *error,
+ gpointer user_data);
void nm_client_add_and_activate_connection (NMClient *client,
NMConnection *partial,