forked from enlightenment/enlightenment
parent
27369eb3cd
commit
14f9ab8685
|
@ -6,14 +6,11 @@ static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data
|
|||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _load_inits(E_Config_Dialog *cfd, Evas_Object *il);
|
||||
void _ilist_cb_init_selected(void *data);
|
||||
static void _init_file_added(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path);
|
||||
|
||||
static Ecore_File_Monitor *_init_file_monitor;
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
int show_splash;
|
||||
char *init_default_theme;
|
||||
char *splash;
|
||||
|
||||
E_Config_Dialog *cfd;
|
||||
Evas_Object *il;
|
||||
|
@ -34,7 +31,7 @@ e_int_config_startup(E_Container *con)
|
|||
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("Startup Settings"),
|
||||
"E", "_config_startup_dialog",
|
||||
"E", "_config_startup_dialog",
|
||||
"enlightenment/startup", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
@ -43,9 +40,9 @@ static void
|
|||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->show_splash = e_config->show_splash;
|
||||
cfdata->init_default_theme = NULL;
|
||||
cfdata->splash = NULL;
|
||||
if (e_config->init_default_theme)
|
||||
cfdata->init_default_theme = strdup(e_config->init_default_theme);
|
||||
cfdata->splash = strdup(e_config->init_default_theme);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -63,13 +60,7 @@ _create_data(E_Config_Dialog *cfd)
|
|||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (_init_file_monitor)
|
||||
{
|
||||
ecore_file_monitor_del(_init_file_monitor);
|
||||
_init_file_monitor = NULL;
|
||||
}
|
||||
|
||||
E_FREE(cfdata->init_default_theme);
|
||||
E_FREE(cfdata->splash);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
|
@ -79,16 +70,15 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
e_config->show_splash = cfdata->show_splash;
|
||||
if (e_config->init_default_theme)
|
||||
evas_stringshare_del(e_config->init_default_theme);
|
||||
|
||||
if (cfdata->init_default_theme)
|
||||
e_config->init_default_theme = NULL;
|
||||
|
||||
if (cfdata->splash)
|
||||
{
|
||||
if (!cfdata->init_default_theme[0])
|
||||
e_config->init_default_theme = NULL;
|
||||
else
|
||||
if (cfdata->splash[0])
|
||||
{
|
||||
const char *f;
|
||||
|
||||
f = ecore_file_get_file(cfdata->init_default_theme);
|
||||
f = ecore_file_get_file(cfdata->splash);
|
||||
e_config->init_default_theme = evas_stringshare_add(f);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +95,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
char *homedir;
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->init_default_theme));
|
||||
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->splash));
|
||||
cfdata->il = il;
|
||||
e_widget_ilist_selector_set(il, 1);
|
||||
e_widget_min_size_set(il, 180, 40);
|
||||
|
@ -120,17 +110,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
&(cfdata->show_splash));
|
||||
e_widget_table_object_append(ot, ob, 1, 3, 1, 1, 1, 0, 0, 0);
|
||||
|
||||
if (_init_file_monitor)
|
||||
{
|
||||
ecore_file_monitor_del(_init_file_monitor);
|
||||
_init_file_monitor = NULL;
|
||||
}
|
||||
|
||||
homedir = e_user_homedir_get();
|
||||
snprintf(path, sizeof(path), "%s/.e/e/init", homedir);
|
||||
E_FREE(homedir);
|
||||
|
||||
_init_file_monitor = ecore_file_monitor_add(path, _init_file_added, cfdata);
|
||||
return ot;
|
||||
}
|
||||
|
||||
|
@ -212,7 +194,7 @@ _load_inits(E_Config_Dialog *cfd, Evas_Object *il)
|
|||
_ilist_cb_init_selected, cfd, full_path);
|
||||
|
||||
if ((e_config->init_default_theme) &&
|
||||
(!strcmp(e_config->init_default_theme, init_file)))
|
||||
(!strcmp(e_config->init_default_theme, init_file)))
|
||||
{
|
||||
selnum = i;
|
||||
evas_object_del(im);
|
||||
|
@ -248,49 +230,12 @@ _ilist_cb_init_selected(void *data)
|
|||
cfdata = cfd->cfdata;
|
||||
if (!cfdata) return;
|
||||
|
||||
if (!cfdata->init_default_theme[0])
|
||||
if (!cfdata->splash[0])
|
||||
init = e_path_find(path_init, "init.edj");
|
||||
else
|
||||
{
|
||||
f = ecore_file_get_file(cfdata->init_default_theme);
|
||||
f = ecore_file_get_file(cfdata->splash);
|
||||
init = e_path_find(path_init, f);
|
||||
}
|
||||
e_widget_preview_edje_set(cfd->data, init, "init/splash");
|
||||
}
|
||||
|
||||
static void
|
||||
_init_file_added(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_Object *il, *ic;
|
||||
char *file, *noext;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata) return;
|
||||
|
||||
il = cfdata->il;
|
||||
if (!il) return;
|
||||
|
||||
cfd = cfdata->cfd;
|
||||
if (!cfd) return;
|
||||
|
||||
file = (char *)ecore_file_get_file(path);
|
||||
noext = ecore_file_strip_ext(file);
|
||||
|
||||
if (event == ECORE_FILE_EVENT_CREATED_FILE)
|
||||
{
|
||||
if (e_util_edje_collection_exists(path, "init/splash"))
|
||||
{
|
||||
Evas *evas;
|
||||
|
||||
evas = e_win_evas_get(cfd->dia->win);
|
||||
ic = edje_object_add(evas);
|
||||
e_util_edje_icon_set(ic, "enlightenment/run");
|
||||
e_widget_ilist_append(il, ic, noext, _ilist_cb_init_selected,
|
||||
cfd, path);
|
||||
}
|
||||
}
|
||||
else if (event == ECORE_FILE_EVENT_DELETED_FILE)
|
||||
e_widget_ilist_remove_label(il, noext);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue