]> git.pld-linux.org Git - packages/lxlauncher.git/blob - lxlauncher-0.2.1-fix-segfault.patch
- drop ur_PK locale (ur locale already exists)
[packages/lxlauncher.git] / lxlauncher-0.2.1-fix-segfault.patch
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
3 @@ -311,6 +311,7 @@
4  {
5      // Dirty hacks used to force pseudo-transparent background
6      gtk_widget_queue_draw( data->table );
7 +    return TRUE;
8  }
9  
10  // Dirty hacks used to reduce unnecessary redrew during scroll
11 @@ -662,18 +663,38 @@
12      gchar *file;
13  
14      file = g_build_filename(user_dir, name, NULL);
15 -    if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) {
16 -       return file;
17 -    }
18 +    if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
19 +       return file;
20      free(file);
21  
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) {
25 -           return file;
26 -       }
27 -       free(file);
28 +        file = g_build_filename(*dir, name, NULL);
29 +        if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE)
30 +            return file;
31 +           free(file);
32 +    }
33 +    return NULL;
34 +}
35 +
36 +static void on_menu_cache_reload(MenuCache* mc, gpointer user_data)
37 +{
38 +    GMainLoop* mainloop = (GMainLoop*)user_data;
39 +    g_main_loop_quit(mainloop);
40 +}
41 +
42 +MenuCache* _menu_cache_lookup_sync( const char* menu_name )
43 +{
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 */
47 +    {
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);
53      }
54 +    return mc;
55  }
56  
57  int main(int argc, char** argv)
58 @@ -695,13 +716,14 @@
59      GError *error = NULL;
60      gchar *config_file = get_xdg_config_file(CONFIG_FILE);
61      if (config_file &&
62 -       g_key_file_load_from_file(key_file,
63 -                                 config_file,
64 -                                 G_KEY_FILE_NONE,
65 -                                 &error)) {
66 -       printf("Loaded %s\n", config_file);
67 -    } else {
68 -       perror("Error loading " CONFIG_FILE);
69 +        g_key_file_load_from_file(key_file,
70 +                      config_file,
71 +                      G_KEY_FILE_NONE,
72 +                      &error)) {
73 +       printf("Loaded %s\n", config_file);
74 +    }
75 +    else {
76 +       perror("Error loading " CONFIG_FILE);
77      }
78      if (config_file)
79         free(config_file);
80 @@ -711,21 +733,23 @@
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);
90      if (gtkrc_file) {
91 -       free(gtkrc_file);
92 +       free(gtkrc_file);
93      }
94  
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);
97  
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;
101 +    if(!button_size)
102 +        button_size = BUTTON_SIZE_FALLBACK;
103 +    if(!img_size)
104 +        img_size = IMG_SIZE_FALLBACK;
105  
106      icon_size = gtk_icon_size_register( "ALIcon", img_size, img_size );
107  
108 @@ -756,9 +780,14 @@
109      gtk_container_add( (GtkContainer*)main_window, notebook );
110  
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" );
114 +    if(!menu_tree)
115 +    {
116 +        g_print("Unable to load application menu\n");
117 +        return 1;
118 +    }
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 ));
122  
123      create_notebook_pages();
124  
This page took 0.134532 seconds and 3 git commands to generate.