Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
pureos-store
Commits
9ba3d365
Commit
9ba3d365
authored
Sep 02, 2013
by
Richard Hughes
Browse files
Add sync helpers for the new category functionality
This allows us to use it in the self test framework.
parent
b3c55611
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/gs-plugin-loader-sync.c
View file @
9ba3d365
...
...
@@ -159,3 +159,91 @@ gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader,
return
helper
.
list
;
}
static
void
gs_plugin_loader_get_categories_finish_sync
(
GsPluginLoader
*
plugin_loader
,
GAsyncResult
*
res
,
GsPluginLoaderHelper
*
helper
)
{
helper
->
list
=
gs_plugin_loader_get_categories_finish
(
plugin_loader
,
res
,
helper
->
error
);
g_main_loop_quit
(
helper
->
loop
);
}
/**
* gs_plugin_loader_get_categories:
**/
GList
*
gs_plugin_loader_get_categories
(
GsPluginLoader
*
plugin_loader
,
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_get_categories_async
(
plugin_loader
,
cancellable
,
(
GAsyncReadyCallback
)
gs_plugin_loader_get_categories_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_category_apps_finish_sync
(
GsPluginLoader
*
plugin_loader
,
GAsyncResult
*
res
,
GsPluginLoaderHelper
*
helper
)
{
helper
->
list
=
gs_plugin_loader_get_category_apps_finish
(
plugin_loader
,
res
,
helper
->
error
);
g_main_loop_quit
(
helper
->
loop
);
}
/**
* gs_plugin_loader_get_category_apps:
**/
GList
*
gs_plugin_loader_get_category_apps
(
GsPluginLoader
*
plugin_loader
,
GsCategory
*
category
,
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_get_category_apps_async
(
plugin_loader
,
category
,
cancellable
,
(
GAsyncReadyCallback
)
gs_plugin_loader_get_category_apps_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
;
}
src/gs-plugin-loader-sync.h
View file @
9ba3d365
...
...
@@ -37,6 +37,13 @@ GList *gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
GList
*
gs_plugin_loader_get_popular
(
GsPluginLoader
*
plugin_loader
,
GCancellable
*
cancellable
,
GError
**
error
);
GList
*
gs_plugin_loader_get_categories
(
GsPluginLoader
*
plugin_loader
,
GCancellable
*
cancellable
,
GError
**
error
);
GList
*
gs_plugin_loader_get_category_apps
(
GsPluginLoader
*
plugin_loader
,
GsCategory
*
category
,
GCancellable
*
cancellable
,
GError
**
error
);
G_END_DECLS
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment