~ubuntu-branches/ubuntu/lucid/menu-cache/lucid

« back to all changes in this revision

Viewing changes to libmenu-cache/menu-cache.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-02-27 15:08:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100227150802-ro2lihqc0l0ny66z
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
908
908
    return register_menu_to_server( menu_name, FALSE );
909
909
}
910
910
 
 
911
static void on_menu_cache_reload(MenuCache* mc, gpointer user_data)
 
912
{
 
913
    GMainLoop* mainloop = (GMainLoop*)user_data;
 
914
    g_main_loop_quit(mainloop);
 
915
}
 
916
 
 
917
MenuCache* menu_cache_lookup_sync( const char* menu_name )
 
918
{
 
919
    MenuCache* mc = menu_cache_lookup(menu_name);
 
920
    /* ensure that the menu cache is loaded */
 
921
    if(! menu_cache_get_root_dir(mc)) /* if it's not yet loaded */
 
922
    {
 
923
        GMainLoop* mainloop = g_main_loop_new(NULL, FALSE);
 
924
        gpointer notify_id = menu_cache_add_reload_notify(mc, on_menu_cache_reload, mainloop);
 
925
        g_main_loop_run(mainloop);
 
926
        g_main_loop_unref(mainloop);
 
927
        menu_cache_remove_reload_notify(mc, notify_id);
 
928
    }
 
929
    return mc;
 
930
}
 
931
 
911
932
static GSList* list_app_in_dir(MenuCacheDir* dir, GSList* list)
912
933
{
913
934
    GSList* l;