aboutsummaryrefslogtreecommitdiff
path: root/src/mm-plugin.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@gnu.org>2011-09-04 23:59:43 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:19 +0100
commitdc30536456dbbface927e6c76ca3bf3e4647afa5 (patch)
treeea2da4a785f254bbf035e4e96435f739760d569e /src/mm-plugin.c
parentd47176a32c45da0f63ec5ab8024cf4e5f6467a7f (diff)
plugin-base: rewrite port supports check as fully asynchronous
Before this change, supports check was either synchronous (e.g. in some UNSUPPORTED cases) or asynchronous (when IN_PROGRESS was returned). With this fix, the supports check requested to the plugin will always be completed asynchronously; either directly in an idle before launching any real probing operation, or once the probing operation is finished. Therefore, it is not expected to get a IN_PROGRESS reply in mm_plugin_supports_port_finish(), only UNSUPPORTED|SUPPORTED|DEFERRED.
Diffstat (limited to 'src/mm-plugin.c')
-rw-r--r--src/mm-plugin.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/src/mm-plugin.c b/src/mm-plugin.c
index 167af474..1c584a3e 100644
--- a/src/mm-plugin.c
+++ b/src/mm-plugin.c
@@ -32,28 +32,45 @@ mm_plugin_get_sort_last (const MMPlugin *plugin)
return MM_PLUGIN_GET_INTERFACE (plugin)->get_sort_last (plugin);
}
-MMPluginSupportsResult
-mm_plugin_supports_port (MMPlugin *plugin,
- const char *subsys,
- const char *name,
- const char *physdev_path,
+void
+mm_plugin_supports_port (MMPlugin *self,
+ const gchar *subsys,
+ const gchar *name,
+ const gchar *physdev_path,
MMModem *existing,
- MMSupportsPortResultFunc callback,
+ GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_val_if_fail (MM_IS_PLUGIN (plugin), FALSE);
- g_return_val_if_fail (subsys != NULL, FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (physdev_path != NULL, FALSE);
- g_return_val_if_fail (callback != NULL, FALSE);
-
- return MM_PLUGIN_GET_INTERFACE (plugin)->supports_port (plugin,
- subsys,
- name,
- physdev_path,
- existing,
- callback,
- user_data);
+ g_return_if_fail (MM_IS_PLUGIN (self));
+ g_return_if_fail (subsys != NULL);
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (physdev_path != NULL);
+ g_return_if_fail (callback != NULL);
+
+ MM_PLUGIN_GET_INTERFACE (self)->supports_port (self,
+ subsys,
+ name,
+ physdev_path,
+ existing,
+ callback,
+ user_data);
+}
+
+MMPluginSupportsResult
+mm_plugin_supports_port_finish (MMPlugin *self,
+ GAsyncResult *result,
+ guint *level,
+ GError **error)
+{
+ g_return_val_if_fail (MM_IS_PLUGIN (self),
+ MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (result),
+ MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED);
+
+ return MM_PLUGIN_GET_INTERFACE (self)->supports_port_finish (self,
+ result,
+ level,
+ error);
}
void