[gnome-software] trivial: Add a sync version of gs_plugin_loader_search()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Add a sync version of gs_plugin_loader_search()
- Date: Sat, 19 Oct 2013 19:25:40 +0000 (UTC)
commit c436ab50c2624897fa304b6a840c04ddf3e74879
Author: Richard Hughes <richard hughsie com>
Date: Sat Oct 19 20:23:16 2013 +0100
trivial: Add a sync version of gs_plugin_loader_search()
src/gs-plugin-loader-sync.c | 47 +++++++++++++++++++++++++++++++++++++++++++
src/gs-plugin-loader-sync.h | 5 ++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader-sync.c b/src/gs-plugin-loader-sync.c
index 5270f12..6b14645 100644
--- a/src/gs-plugin-loader-sync.c
+++ b/src/gs-plugin-loader-sync.c
@@ -78,6 +78,53 @@ gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
}
static void
+gs_plugin_loader_search_finish_sync (GsPluginLoader *plugin_loader,
+ GAsyncResult *res,
+ GsPluginLoaderHelper *helper)
+{
+ helper->list = gs_plugin_loader_search_finish (plugin_loader,
+ res,
+ helper->error);
+ g_main_loop_quit (helper->loop);
+}
+
+/**
+ * gs_plugin_loader_search:
+ **/
+GList *
+gs_plugin_loader_search (GsPluginLoader *plugin_loader,
+ const gchar *value,
+ GsPluginRefineFlags flags,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GsPluginLoaderHelper helper;
+
+ /* create temp object */
+ helper.context = g_main_context_new ();
+ helper.loop = g_main_loop_new (helper.context, FALSE);
+ helper.error = error;
+
+ g_main_context_push_thread_default (helper.context);
+
+ /* run async method */
+ gs_plugin_loader_search_async (plugin_loader,
+ value,
+ flags,
+ cancellable,
+ (GAsyncReadyCallback) gs_plugin_loader_search_finish_sync,
+ &helper);
+ g_main_loop_run (helper.loop);
+
+ g_main_context_pop_thread_default (helper.context);
+
+ g_main_loop_unref (helper.loop);
+ g_main_context_unref (helper.context);
+
+ return helper.list;
+}
+
+static void
gs_plugin_loader_get_updates_finish_sync (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GsPluginLoaderHelper *helper)
diff --git a/src/gs-plugin-loader-sync.h b/src/gs-plugin-loader-sync.h
index 6cbc480..1d6472a 100644
--- a/src/gs-plugin-loader-sync.h
+++ b/src/gs-plugin-loader-sync.h
@@ -32,6 +32,11 @@ GList *gs_plugin_loader_get_installed (GsPluginLoader
*plugin_loader,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error);
+GList *gs_plugin_loader_search (GsPluginLoader *plugin_loader,
+ const gchar *value,
+ GsPluginRefineFlags flags,
+ GCancellable *cancellable,
+ GError **error);
GList *gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
GsPluginRefineFlags flags,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]