diff options
author | Dan Winship <danw@gnome.org> | 2012-07-17 09:41:15 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-07-17 09:43:15 -0400 |
commit | 320464490e97c74c5f04651efef0341d6f04b1c5 (patch) | |
tree | 7703504d1d7666b0e8c26432e5350aac53b1d8fe /libnm-glib | |
parent | a03e7fb74f792062110d9a1ff15e7df87bfd787d (diff) | |
download | NetworkManager-320464490e97c74c5f04651efef0341d6f04b1c5.tar.gz |
libnm-glib: fix GAsyncInitable implementations
If a class implements init_async, it should implement init_finish too,
rather than assuming the default implementation will do the right
thing (which it briefly didn't in glib 2.33).
Diffstat (limited to 'libnm-glib')
-rw-r--r-- | libnm-glib/nm-client.c | 12 | ||||
-rw-r--r-- | libnm-glib/nm-object.c | 6 | ||||
-rw-r--r-- | libnm-glib/nm-remote-connection.c | 12 | ||||
-rw-r--r-- | libnm-glib/nm-remote-settings.c | 12 |
4 files changed, 37 insertions, 5 deletions
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index fa8d508df3..178a5fdd40 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -1566,6 +1566,17 @@ init_async (GAsyncInitable *initable, int io_priority, G_TYPE_INVALID); } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void dispose (GObject *object) { @@ -1923,4 +1934,5 @@ nm_client_async_initable_iface_init (GAsyncInitableIface *iface) nm_client_parent_async_initable_iface = g_type_interface_peek_parent (iface); iface->init_async = init_async; + iface->init_finish = init_finish; } diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 756bfa7ab4..cba3877588 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -205,14 +205,10 @@ init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); - /* This is needed for now because of bug 667375; it can go away - * when we depend on glib >= 2.38 - */ - if (g_simple_async_result_propagate_error (simple, error)) return FALSE; else - return g_simple_async_result_get_op_res_gboolean (simple); + return TRUE; } static void diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index e8b99dff9c..64df586e79 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -448,6 +448,17 @@ init_async (GAsyncInitable *initable, int io_priority, } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void nm_remote_connection_init (NMRemoteConnection *self) { @@ -563,4 +574,5 @@ static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface) { iface->init_async = init_async; + iface->init_finish = init_finish; } diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 19d865c060..7748f4f091 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -1035,6 +1035,17 @@ init_async (GAsyncInitable *initable, int io_priority, G_TYPE_INVALID); } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void dispose (GObject *object) { @@ -1198,4 +1209,5 @@ static void nm_remote_settings_async_initable_iface_init (GAsyncInitableIface *iface) { iface->init_async = init_async; + iface->init_finish = init_finish; } |