[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] [PATCH] Theme Config Dialog Box



The attached patch provides some sort of solution for the problem where
you delete the currently active theme in the theme config dialog box.
This is obviously a dumb thing to do, but can result in lots of screen
corruption where you can't actually pick a new theme. The patch simply
activates the next theme possible in the list.

Its not pretty because to activate another theme a restart is required,
but its neater than display corruption.

Another option would be to put in some form of pre-delete callback to
stop the deletion happening in the first place.

metrics
Index: src/bin/e_int_config_theme.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_int_config_theme.c,v
retrieving revision 1.39
diff -u -r1.39 e_int_config_theme.c
--- src/bin/e_int_config_theme.c	24 Sep 2006 00:48:14 -0000	1.39
+++ src/bin/e_int_config_theme.c	1 Oct 2006 13:43:47 -0000
@@ -229,10 +229,18 @@
    E_Config_Dialog_Data *cfdata;
    Evas_List *sel, *all, *n;
    E_Fm2_Icon_Info *ici, *ic;
+   E_Config_Theme *ctheme;
+   E_Action *a;
+   int active_theme_deleted = 0;
    
    cfdata = data;
    if (!cfdata->theme) return;
    if (!cfdata->o_fm) return;
+   ctheme = e_theme_config_get("theme");
+   if (ctheme && ctheme->file && cfdata->theme &&
+	 !strcmp(ctheme->file, cfdata->theme))
+     active_theme_deleted = 1;
+     
 
    all = e_fm2_all_list_get(cfdata->o_fm);
    if (!all) return;
@@ -258,6 +266,17 @@
    evas_list_free(n);
    
    evas_object_smart_callback_call(cfdata->o_fm, "selection_change", cfdata);
+
+   /* Check if the theme we just deleted is the current theme. */
+   if (active_theme_deleted && cfdata->theme)
+     {
+	/* Actually take our cfdata settings and apply them in real life */
+	e_theme_config_set("theme", cfdata->theme);
+	e_config_save_queue();
+
+	a = e_action_find("restart");
+	if ((a) && (a->func.go)) a->func.go(NULL, NULL);
+     }
 }
 
 static void