Commit c436ab50 authored by Richard Hughes's avatar Richard Hughes

trivial: Add a sync version of gs_plugin_loader_search()

parent 385774f6
......@@ -77,6 +77,53 @@ gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
return helper.list;
}
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,
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment