diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-02-01 13:40:56 -0500 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-02-01 13:41:15 -0500 |
commit | bf805ba0b2ecced81e5c2830a79d021a42da91a7 (patch) | |
tree | 10046273dae8333e0855041e05dadfe848122460 /plugins | |
parent | 1296a2f5ce46e77787ca42eadb1c2ca4a957a09b (diff) | |
parent | 026e84f10bbfa52f813d30d95b0efbd2ec7a5228 (diff) |
Merge remote-tracking branch 'siraj/plugin-api-change'
Conflicts:
lib/loudmouth/Makefile.am
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/console.c | 31 | ||||
-rw-r--r-- | plugins/gateways.c | 31 | ||||
-rw-r--r-- | plugins/test.c | 33 |
3 files changed, 77 insertions, 18 deletions
diff --git a/plugins/console.c b/plugins/console.c index 13ca0eccf..8d6795c9d 100644 --- a/plugins/console.c +++ b/plugins/console.c @@ -77,7 +77,7 @@ gabble_console_plugin_class_init (GabbleConsolePluginClass *klass) } static void -gabble_console_plugin_create_sidecar ( +gabble_console_plugin_create_sidecar_async ( GabblePlugin *plugin, const gchar *sidecar_interface, GabbleConnection *connection, @@ -87,10 +87,7 @@ gabble_console_plugin_create_sidecar ( { GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin), callback, user_data, - /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we - * need to use the same source tag. - */ - gabble_plugin_create_sidecar); + gabble_console_plugin_create_sidecar_async); GabbleSidecar *sidecar = NULL; if (!tp_strdiff (sidecar_interface, GABBLE_IFACE_GABBLE_PLUGIN_CONSOLE)) @@ -114,6 +111,27 @@ gabble_console_plugin_create_sidecar ( g_object_unref (result); } +static GabbleSidecar * +gabble_console_plugin_create_sidecar_finish ( + GabblePlugin *plugin, + GAsyncResult *result, + GError **error) +{ + GabbleSidecar *sidecar; + + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), + error)) + return NULL; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, + G_OBJECT (plugin), gabble_console_plugin_create_sidecar_async), NULL); + + sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer ( + G_SIMPLE_ASYNC_RESULT (result))); + + return g_object_ref (sidecar); +} + static void plugin_iface_init ( gpointer g_iface, @@ -124,7 +142,8 @@ plugin_iface_init ( iface->name = "XMPP console"; iface->version = PACKAGE_VERSION; iface->sidecar_interfaces = sidecar_interfaces; - iface->create_sidecar = gabble_console_plugin_create_sidecar; + iface->create_sidecar_async = gabble_console_plugin_create_sidecar_async; + iface->create_sidecar_finish = gabble_console_plugin_create_sidecar_finish; } GabblePlugin * diff --git a/plugins/gateways.c b/plugins/gateways.c index 88a32223f..1e7b141a2 100644 --- a/plugins/gateways.c +++ b/plugins/gateways.c @@ -75,7 +75,7 @@ gabble_gateway_plugin_class_init (GabbleGatewayPluginClass *klass) } static void -gabble_gateway_plugin_create_sidecar ( +gabble_gateway_plugin_create_sidecar_async ( GabblePlugin *plugin, const gchar *sidecar_interface, GabbleConnection *connection, @@ -85,10 +85,7 @@ gabble_gateway_plugin_create_sidecar ( { GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin), callback, user_data, - /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we - * need to use the same source tag. - */ - gabble_plugin_create_sidecar); + gabble_gateway_plugin_create_sidecar_async); GabbleSidecar *sidecar = NULL; if (!tp_strdiff (sidecar_interface, GABBLE_IFACE_GABBLE_PLUGIN_GATEWAYS)) @@ -112,6 +109,27 @@ gabble_gateway_plugin_create_sidecar ( g_object_unref (result); } +static GabbleSidecar * +gabble_gateway_plugin_create_sidecar_finish ( + GabblePlugin *plugin, + GAsyncResult *result, + GError **error) +{ + GabbleSidecar *sidecar; + + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), + error)) + return NULL; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, + G_OBJECT (plugin), gabble_gateway_plugin_create_sidecar_async), NULL); + + sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer ( + G_SIMPLE_ASYNC_RESULT (result))); + + return g_object_ref (sidecar); +} + static void plugin_iface_init ( gpointer g_iface, @@ -122,7 +140,8 @@ plugin_iface_init ( iface->name = "Gateway registration plugin"; iface->version = PACKAGE_VERSION; iface->sidecar_interfaces = sidecar_interfaces; - iface->create_sidecar = gabble_gateway_plugin_create_sidecar; + iface->create_sidecar_async = gabble_gateway_plugin_create_sidecar_async; + iface->create_sidecar_finish = gabble_gateway_plugin_create_sidecar_finish; } GabblePlugin * diff --git a/plugins/test.c b/plugins/test.c index 05d784052..43b18ea3b 100644 --- a/plugins/test.c +++ b/plugins/test.c @@ -80,7 +80,7 @@ sidecar_iq_created_cb ( } static void -test_plugin_create_sidecar ( +test_plugin_create_sidecar_async ( GabblePlugin *plugin, const gchar *sidecar_interface, GabbleConnection *connection, @@ -90,10 +90,8 @@ test_plugin_create_sidecar ( { GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin), callback, user_data, - /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we - * need to use the same source tag. - */ - gabble_plugin_create_sidecar); + test_plugin_create_sidecar_async); + GabbleSidecar *sidecar = NULL; if (!tp_strdiff (sidecar_interface, IFACE_TEST)) @@ -124,9 +122,31 @@ test_plugin_create_sidecar ( g_simple_async_result_set_op_res_gpointer (result, sidecar, g_object_unref); g_simple_async_result_complete_in_idle (result); + g_object_unref (result); } +static GabbleSidecar * +test_plugin_create_sidecar_finish ( + GabblePlugin *plugin, + GAsyncResult *result, + GError **error) +{ + GabbleSidecar *sidecar; + + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), + error)) + return NULL; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, + G_OBJECT (plugin), test_plugin_create_sidecar_async), NULL); + + sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer ( + G_SIMPLE_ASYNC_RESULT (result))); + + return g_object_ref (sidecar); +} + static GPtrArray * test_plugin_create_channel_managers (GabblePlugin *plugin, TpBaseConnection *connection) @@ -164,7 +184,8 @@ plugin_iface_init ( iface->name = "Sidecar test plugin"; iface->version = PACKAGE_VERSION; iface->sidecar_interfaces = sidecar_interfaces; - iface->create_sidecar = test_plugin_create_sidecar; + iface->create_sidecar_async = test_plugin_create_sidecar_async; + iface->create_sidecar_finish = test_plugin_create_sidecar_finish; iface->create_channel_managers = test_plugin_create_channel_managers; iface->presence_statuses = test_presences; |