e: make it less anoying. Now E17 also remember you tainted it.

SVN revision: 78148
This commit is contained in:
Cedric BAIL 2012-10-18 06:26:57 +00:00
parent 01883a4014
commit 0c356af7e2
4 changed files with 86 additions and 14 deletions

View File

@ -50,10 +50,12 @@ static int fa = 0, fh = 0, fw = 0;
static const char *title = NULL, *str1 = NULL, *str2 = NULL;
static int ret = 0, sig = 0;
static pid_t pid;
static Eina_Bool tainted = EINA_TRUE;
int
main(int argc, char **argv)
{
const char *tmp;
int i = 0;
for (i = 1; i < argc; i++)
@ -74,6 +76,10 @@ main(int argc, char **argv)
comp_win = atoi(argv[i]); // Composite Alert Window
}
tmp = getenv("E17_TAINTED");
if (tmp && !strcmp(tmp, "NO"))
tainted = EINA_FALSE;
if (!ecore_init()) return EXIT_FAILURE;
ecore_app_args_set(argc, (const char **)argv);
@ -447,15 +453,26 @@ _e_alert_draw_text(void)
char warn[1024], msg[4096], line[1024];
unsigned int i = 0, j = 0, k = 0;
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
"on. You can gdb attach to this process (%d) now \n"
"to try debug it or you could exit, or just hit \n"
"restart to try and get your desktop back the way \n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.", pid);
if (!tainted)
{
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
"on. You can gdb attach to this process (%d) now \n"
"to try debug it or you could exit, or just hit \n"
"restart to try and get your desktop back the way \n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.", pid);
}
else
{
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug, but you are using non supported modules. Before\n"
"reporting this issue, please unload them and try to see\n"
"if the bug is still there.\n");
}
strcpy(warn, "");

View File

@ -661,6 +661,7 @@ e_config_init(void)
E_CONFIG_VAL(D, T, no_module_delay, INT); /**/
E_CONFIG_VAL(D, T, desklock_language, STR); /**/
E_CONFIG_LIST(D, T, modules, _e_config_module_edd); /**/
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(D, T, "bad_modules", bad_modules);
E_CONFIG_LIST(D, T, font_fallbacks, _e_config_font_fallback_edd); /**/
E_CONFIG_LIST(D, T, font_defaults, _e_config_font_default_edd); /**/
E_CONFIG_LIST(D, T, themes, _e_config_theme_edd); /**/

View File

@ -70,6 +70,7 @@ struct _E_Config
const char *language; // GUI
const char *desklock_language; // GUI
Eina_List *modules; // GUI
Eina_List *bad_modules; // GUI
Eina_List *font_fallbacks; // GUI
Eina_List *font_defaults; // GUI
Eina_List *themes; // GUI

View File

@ -602,11 +602,36 @@ _e_module_event_update_free(void *data __UNUSED__, void *event)
E_FREE(ev);
}
static void
_cleanup_cb(void *data, E_Dialog *dialog)
{
Eina_List *badl = data;
const char *s;
e_object_del(E_OBJECT(dialog));
EINA_LIST_FREE(badl, s)
eina_stringshare_del(s);
}
static void
_ignore_cb(void *data, E_Dialog *dialog)
{
const char *s;
e_object_del(E_OBJECT(dialog));
EINA_LIST_FREE(e_config->bad_modules, s)
eina_stringshare_del(s);
e_config->bad_modules = data;
e_config_save_queue();
}
static void
_e_module_whitelist_check(void)
{
Eina_List *l, *badl = NULL;
E_Module *m;
unsigned int known = 0;
int i;
const char *s;
const char *goodmods[] =
@ -691,10 +716,32 @@ _e_module_whitelist_check(void)
break;
}
}
if (!ok) badl = eina_list_append(badl, m->name);
if (!ok) badl = eina_list_append(badl, eina_stringshare_add(m->name));
}
if (badl)
EINA_LIST_FOREACH(badl, l, s)
{
const char *tmp;
Eina_List *ll;
Eina_Bool found = EINA_FALSE;
EINA_LIST_FOREACH(e_config->bad_modules, ll, tmp)
{
if (!strcmp(s, tmp))
{
found = EINA_TRUE;
break;
}
}
if (!found) break;
known++;
}
if (badl) e_env_set("E17_TAINTED", "YES");
else e_env_set("E17_TAINTED", "NO");
if (eina_list_count(badl) != known)
{
E_Dialog *dia;
Eina_Strbuf *sbuf;
@ -721,7 +768,7 @@ _e_module_whitelist_check(void)
"<br>"
"The module list is as follows:<br>"
"<br>"));
EINA_LIST_FREE(badl, s)
EINA_LIST_FOREACH(badl, l, s)
{
eina_strbuf_append(sbuf, s);
eina_strbuf_append(sbuf, "<br>");
@ -730,9 +777,15 @@ _e_module_whitelist_check(void)
e_dialog_title_set(dia, _("Unstable module tainting"));
e_dialog_icon_set(dia, "enlightenment", 64);
e_dialog_text_set(dia, eina_strbuf_string_get(sbuf));
e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
e_dialog_button_add(dia, _("OK"), NULL, _cleanup_cb, badl);
e_dialog_button_add(dia, _("I know"), NULL, _ignore_cb, badl);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
eina_strbuf_free(sbuf);
}
else
{
EINA_LIST_FREE(badl, s)
eina_stringshare_del(s);
}
}