1 --- src/lxlauncher.c 2009-07-07 15:48:19.000000000 +0300
2 +++ src/lxlauncher.c.new 2010-06-09 21:09:24.000000000 +0300
5 // Dirty hacks used to force pseudo-transparent background
6 gtk_widget_queue_draw( data->table );
10 // Dirty hacks used to reduce unnecessary redrew during scroll
14 file = g_build_filename(user_dir, name, NULL);
15 - if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) {
18 + if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
22 for (dir = system_dirs; *dir; ++dir ) {
23 - file = g_build_filename(*dir, name, NULL);
24 - if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) {
28 + file = g_build_filename(*dir, name, NULL);
29 + if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
36 +static void on_menu_cache_reload(MenuCache* mc, gpointer user_data)
38 + GMainLoop* mainloop = (GMainLoop*)user_data;
39 + g_main_loop_quit(mainloop);
42 +MenuCache* _menu_cache_lookup_sync( const char* menu_name )
44 + MenuCache* mc = menu_cache_lookup(menu_name);
45 + /* ensure that the menu cache is loaded */
46 + if(! menu_cache_get_root_dir(mc)) /* if it's not yet loaded */
48 + GMainLoop* mainloop = g_main_loop_new(NULL, FALSE);
49 + gpointer notify_id = menu_cache_add_reload_notify(mc, on_menu_cache_reload, mainloop);
50 + g_main_loop_run(mainloop);
51 + g_main_loop_unref(mainloop);
52 + menu_cache_remove_reload_notify(mc, notify_id);
57 int main(int argc, char** argv)
60 gchar *config_file = get_xdg_config_file(CONFIG_FILE);
62 - g_key_file_load_from_file(key_file,
66 - printf("Loaded %s\n", config_file);
68 - perror("Error loading " CONFIG_FILE);
69 + g_key_file_load_from_file(key_file,
73 + printf("Loaded %s\n", config_file);
76 + perror("Error loading " CONFIG_FILE);
81 // Add application specific properties
82 gtk_settings_install_property(g_param_spec_boolean("lxlauncher-enable-key",
83 _("Enable key navigation"),
84 - _("Allow users to use up/down/left/right/tab/enter keys to operate the lxlaucher"),
85 + _("Allow users to use up/down/left/right/tab/enter keys to operate the lxlauncher"),
86 FALSE,GTK_ARG_READWRITE));
87 // set up themes for notebook
88 gchar* gtkrc_file = get_xdg_config_file("lxlauncher/gtkrc");
89 gtk_rc_parse(gtkrc_file);
95 button_size = g_key_file_get_integer(key_file, "Main", "BUTTON_SIZE", NULL);
96 img_size = g_key_file_get_integer(key_file, "Main", "IMG_SIZE", NULL);
98 // to prevent from going without configure file
99 - if(!button_size) button_size = BUTTON_SIZE_FALLBACK;
100 - if(!img_size) img_size = IMG_SIZE_FALLBACK;
102 + button_size = BUTTON_SIZE_FALLBACK;
104 + img_size = IMG_SIZE_FALLBACK;
106 icon_size = gtk_icon_size_register( "ALIcon", img_size, img_size );
109 gtk_container_add( (GtkContainer*)main_window, notebook );
111 g_setenv("XDG_MENU_PREFIX", "lxlauncher-", TRUE);
112 - menu_tree = menu_cache_lookup( "applications.menu" );
113 + menu_tree = _menu_cache_lookup_sync( "applications.menu" );
116 + g_print("Unable to load application menu\n");
119 + root_dir = menu_cache_item_ref(menu_cache_get_root_dir( menu_tree ));
120 reload_notify_id = menu_cache_add_reload_notify( menu_tree, on_menu_tree_changed, NULL );
121 - root_dir = menu_cache_ref(menu_cache_get_root_dir( menu_tree ));
123 create_notebook_pages();