diff options
author | Dan Winship <danw@gnome.org> | 2014-09-11 16:27:13 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-09-25 09:29:20 -0400 |
commit | 2237ea3ddbe602446ac87a8a055a6d719c4a0f6c (patch) | |
tree | 4891a7570618c68905f9375c43f65c71bc21eb9b /libnm/nm-client.h | |
parent | 6ca10677d67c129d43b82e5563e20c4c5f2e5727 (diff) |
libnm: make sync/async APIs more GLib-like
Make synchronous APIs take GCancellables, and make asynchronous APIs
use GAsyncReadyCallbacks and have names ending in "_async", with
"_finish" functions to retrieve the results.
Also, make nm_client_activate_connection_finish(),
nm_client_add_and_activate_finish(), and
nm_remote_settings_add_connection_finish() be (transfer full) rather
than (transfer none), because the refcounting semantics become
slightly confusing in some edge cases otherwise.
Diffstat (limited to 'libnm/nm-client.h')
-rw-r--r-- | libnm/nm-client.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/libnm/nm-client.h b/libnm/nm-client.h index 107355327..2c9de4367 100644 --- a/libnm/nm-client.h +++ b/libnm/nm-client.h @@ -176,32 +176,32 @@ const GPtrArray *nm_client_get_devices (NMClient *client); NMDevice *nm_client_get_device_by_path (NMClient *client, const char *object_path); NMDevice *nm_client_get_device_by_iface (NMClient *client, const char *iface); -typedef void (*NMClientActivateFn) (NMClient *client, - NMActiveConnection *active_connection, - GError *error, - gpointer user_data); - -void nm_client_activate_connection (NMClient *client, - NMConnection *connection, - NMDevice *device, - const char *specific_object, - NMClientActivateFn callback, - gpointer user_data); - -typedef void (*NMClientAddActivateFn) (NMClient *client, - NMActiveConnection *connection, - const char *new_connection_path, - GError *error, - gpointer user_data); - -void nm_client_add_and_activate_connection (NMClient *client, - NMConnection *partial, - NMDevice *device, - const char *specific_object, - NMClientAddActivateFn callback, - gpointer user_data); - -void nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active); +void nm_client_activate_connection_async (NMClient *client, + NMConnection *connection, + NMDevice *device, + const char *specific_object, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +NMActiveConnection *nm_client_activate_connection_finish (NMClient *client, + GAsyncResult *result, + GError **error); + +void nm_client_add_and_activate_connection_async (NMClient *client, + NMConnection *partial, + NMDevice *device, + const char *specific_object, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +NMActiveConnection *nm_client_add_and_activate_connection_finish (NMClient *client, + GAsyncResult *result, + GError **error); + +gboolean nm_client_deactivate_connection (NMClient *client, + NMActiveConnection *active, + GCancellable *cancellable, + GError **error); gboolean nm_client_networking_get_enabled (NMClient *client); void nm_client_networking_set_enabled (NMClient *client, gboolean enabled); |