@@ -845,8 +845,17 @@ matemenu_tree_changed_callback (MateMenuTree * old_tree, gpointer user_data)
845845 it's probably a good idea to wait a couple seconds to regenerate the categories in case there
846846 are multiple quick changes being made, no sense regenerating multiple times.
847847 */
848- g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE , 3000 , (GSourceFunc ) regenerate_categories ,
849- user_data , NULL );
848+ GError * error = NULL ;
849+ AppShellData * app_data = user_data ;
850+ if (!matemenu_tree_load_sync (app_data -> tree , & error )) {
851+ g_warning ("Menu tree loading got error:%s\n" , error -> message );
852+ g_object_unref (app_data -> tree );
853+ app_data -> tree = NULL ;
854+ g_error_free (error );
855+ } else {
856+ g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE , 3000 , (GSourceFunc ) regenerate_categories ,
857+ user_data , NULL );
858+ }
850859}
851860
852861AppShellData *
@@ -887,10 +896,14 @@ generate_categories (AppShellData * app_data)
887896 g_object_unref (app_data -> tree );
888897 app_data -> tree = NULL ;
889898 }
890-
891899 }
892900
893- if ((root_dir = matemenu_tree_get_root_directory (app_data -> tree )) == NULL ) {
901+ if (app_data -> tree != NULL )
902+ root_dir = matemenu_tree_get_root_directory (app_data -> tree );
903+ else
904+ root_dir = NULL ;
905+
906+ if ( app_data -> tree == NULL || root_dir == NULL ) {
894907 GtkWidget * dialog = gtk_message_dialog_new (NULL , GTK_DIALOG_DESTROY_WITH_PARENT ,
895908 GTK_MESSAGE_ERROR , GTK_BUTTONS_CLOSE , "Failure loading - %s" ,
896909 app_data -> menu_name );
0 commit comments