Enlightenment CVS committal Author : devilhorns Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_config.c e_config.h e_init.c e_int_config_startup.c Log Message: -Added new config item for init screens into e_config.h/c. -Bumped e_config.h File_Generation to coincide with added config value. -Fixed e_init.c to look for config value instead of hard-coded init.edj. -Newer Config Startup dialog that allows selecting (with previews) of the init. New init screens can now be copied into the init search directories, and easily selected via dialog. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_config.c,v retrieving revision 1.174 retrieving revision 1.175 diff -u -3 -r1.174 -r1.175 --- e_config.c 24 May 2006 02:49:07 -0000 1.174 +++ e_config.c 5 Jun 2006 03:16:16 -0000 1.175 @@ -315,6 +315,7 @@ /**/ /* == already configurable via ipc */ E_CONFIG_VAL(D, T, config_version, INT); /**/ E_CONFIG_VAL(D, T, show_splash, INT); /**/ + E_CONFIG_VAL(D, T, init_default_theme, STR); E_CONFIG_VAL(D, T, desktop_default_background, STR); /**/ E_CONFIG_VAL(D, T, desktop_default_name, STR); /**/ E_CONFIG_LIST(D, T, desktop_backgrounds, _e_config_desktop_bg_edd); /**/ @@ -509,6 +510,7 @@ #define IFCFGEND } IFCFG(0x008d); e_config->show_splash = 1; + e_config->init_default_theme = NULL; e_config->desktop_default_background = NULL; e_config->desktop_default_name = evas_stringshare_add(_("Desktop %i, %i")); e_config->menus_scroll_speed = 1000.0; @@ -1784,6 +1786,7 @@ if (cc->name) evas_stringshare_del(cc->name); E_FREE(cc); } + if (e_config->init_default_theme) evas_stringshare_del(e_config->init_default_theme); if (e_config->desktop_default_background) evas_stringshare_del(e_config->desktop_default_background); if (e_config->desktop_default_name) evas_stringshare_del(e_config->desktop_default_name); if (e_config->language) evas_stringshare_del(e_config->language); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_config.h,v retrieving revision 1.98 retrieving revision 1.99 diff -u -3 -r1.98 -r1.99 --- e_config.h 16 May 2006 07:32:37 -0000 1.98 +++ e_config.h 5 Jun 2006 03:16:16 -0000 1.99 @@ -47,10 +47,10 @@ * defaults for e to work. */ #define E_CONFIG_FILE_EPOCH 0x0000 -/* increment this whenever a new set of configvalues are added but the users +/* increment this whenever a new set of config values are added but the users * config doesn't need top be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 0x0093 +#define E_CONFIG_FILE_GENERATION 0x0094 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_EVAS_ENGINE_DEFAULT 0 @@ -75,6 +75,7 @@ { int config_version; int show_splash; //GUI + const char *init_default_theme; const char *desktop_default_background; // GUI Evas_List *desktop_backgrounds; // GUI const char *desktop_default_name; =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_init.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- e_init.c 2 Mar 2006 12:03:48 -0000 1.34 +++ e_init.c 5 Jun 2006 03:16:16 -0000 1.35 @@ -67,8 +67,10 @@ /* first screen */ if (l == screens) { - /* FIXME: "init.edj" needs to come from config */ - s = e_path_find(path_init, "init.edj"), + if (!e_config->init_default_theme) + s = e_path_find(path_init, "init.edj"); + else + s = e_path_find(path_init, e_config->init_default_theme); edje_object_file_set(o, s, "init/splash"); if (s) evas_stringshare_del(s); _e_init_object = o; @@ -76,8 +78,10 @@ /* other screens */ else { - /* FIXME: "init.edj" needs to come from config */ - s = e_path_find(path_init, "init.edj"), + if (!e_config->init_default_theme) + s = e_path_find(path_init, "init.edj"); + else + s = e_path_find(path_init, e_config->init_default_theme); edje_object_file_set(o, s, "init/extra_screen"); if (s) evas_stringshare_del(s); } @@ -89,8 +93,10 @@ else { o = edje_object_add(_e_init_evas); - /* FIXME: "init.edj" needs to come from config */ - s = e_path_find(path_init, "init.edj"), + if (!e_config->init_default_theme) + s = e_path_find(path_init, "init.edj"); + else + s = e_path_find(path_init, e_config->init_default_theme); edje_object_file_set(o, s, "init/splash"); if (s) evas_stringshare_del(s); _e_init_object = o; =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_startup.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_int_config_startup.c 30 Apr 2006 03:43:47 -0000 1.3 +++ e_int_config_startup.c 5 Jun 2006 03:16:16 -0000 1.4 @@ -1,13 +1,22 @@ #include "e.h" static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); 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; + + E_Config_Dialog *cfd; + Evas_Object *il; }; EAPI E_Config_Dialog * @@ -31,6 +40,10 @@ _fill_data(E_Config_Dialog_Data *cfdata) { cfdata->show_splash = e_config->show_splash; + if (e_config->init_default_theme) + cfdata->init_default_theme = strdup(e_config->init_default_theme); + else + cfdata->init_default_theme = NULL; } static void * @@ -40,19 +53,38 @@ cfdata = E_NEW(E_Config_Dialog_Data, 1); _fill_data(cfdata); + cfd->cfdata = cfdata; + cfdata->cfd = cfd; return cfdata; } 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; + } + if (cfdata->init_default_theme) free(cfdata->init_default_theme); free(cfdata); } static int _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[0]) + e_config->init_default_theme = NULL; + else + { + const char *f = ecore_file_get_file(cfdata->init_default_theme); + e_config->init_default_theme = evas_stringshare_add(f); + } + e_config_save_queue(); return 1; } @@ -60,14 +92,249 @@ static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { - Evas_Object *o, *of, *ob; + Evas_Object *ot, *ob, *il, *im; + char path[4096]; - o = e_widget_list_add(evas, 0, 0); + ot = e_widget_table_add(evas, 0); + il = e_widget_ilist_add(evas, 48, 48, &(cfdata->init_default_theme)); + cfdata->il = il; + e_widget_ilist_selector_set(il, 1); + e_widget_min_size_set(il, 180, 40); - of = e_widget_framelist_add(evas, _("Startup Settings"), 0); + _load_inits(cfd, il); + im = cfd->data; + + e_widget_table_object_append(ot, il, 0, 0, 1, 2, 1, 1, 1, 1); + e_widget_table_object_append(ot, im, 1, 0, 1, 2, 1, 1, 1, 1); + ob = e_widget_check_add(evas, _("Show Splash Screen At Boot"), &(cfdata->show_splash)); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); + e_widget_table_object_append(ot, ob, 0, 3, 2, 1, 1, 0, 0, 0); + + if (_init_file_monitor) + { + ecore_file_monitor_del(_init_file_monitor); + _init_file_monitor = NULL; + } + + snprintf(path, sizeof(path), "%s/.e/e/init", e_user_homedir_get()); + _init_file_monitor = ecore_file_monitor_add(path, _init_file_added, cfdata); + + return ot; +} + +static void +_load_inits(E_Config_Dialog *cfd, Evas_Object *il) +{ + Evas *evas; + Evas_Object *ic, *im, *o, *init_obj; + Evas_List *init_dirs, *init; + Ecore_Evas *eebuf; + Evas *evasbuf; + int i = 0; + int selnum = -1; + const char *s; + char *c; + char *homedir; + + if (!il) return; + + homedir = e_user_homedir_get(); + + evas = evas_object_evas_get(il); + init_obj = edje_object_add(cfd->dia->win->evas); + eebuf = ecore_evas_buffer_new(1, 1); + evasbuf = ecore_evas_get(eebuf); + o = edje_object_add(evasbuf); + + e_widget_ilist_header_append(il, NULL, _("Theme")); + i++; + + /* Load the init */ + s = e_path_find(path_init, "init.edj"); + c = strdup(s); + if (edje_object_file_set(o, s, "init/splash")) + { + Evas_Object *ic = NULL; + + ic = edje_object_add(evas); + e_util_edje_icon_set(ic, "enlightenment/run"); + + /* + ic = e_widget_preview_add(evas, 48, 48); + e_widget_preview_edje_set(ic, s, "init/splash"); + */ + + e_widget_ilist_append(il, ic, _("Theme Init"), _ilist_cb_init_selected, cfd, ""); + if (!e_config->init_default_theme) + selnum = i; + + i++; + } + im = e_widget_preview_add(cfd->dia->win->evas, 320, + (320 * e_zone_current_get(cfd->dia->win->container)->h) / + e_zone_current_get(cfd->dia->win->container)->w); + + e_widget_preview_edje_set(im, s, "init/splash"); + evas_object_del(init_obj); + + evas_object_del(o); + ecore_evas_free(eebuf); + if (s) evas_stringshare_del(s); + + /* Load other inits */ + init_dirs = e_path_dir_list_get(path_init); + for (init = init_dirs; init; init = init->next) + { + E_Path_Dir *d; + int detected; + char *init_file; + Ecore_List *inits; + + d = init->data; + if (!ecore_file_is_dir(d->dir)) continue; + inits = ecore_file_ls(d->dir); + if (!inits) continue; + + detected = 0; + if (homedir) + { + if (!strncmp(d->dir, homedir, strlen(homedir))) + { + e_widget_ilist_header_append(il, NULL, _("Personal")); + i++; + detected = 1; + } + } + if (!detected) + { + if (!strncmp(d->dir, e_prefix_data_get(), strlen(e_prefix_data_get()))) + { + e_widget_ilist_header_append(il, NULL, _("System")); + i++; + detected = 1; + } + } + if (!detected) + { + e_widget_ilist_header_append(il, NULL, _("Other")); + i++; + detected = 1; + } + + while ((init_file = ecore_list_next(inits))) + { + char full_path[4096]; + + snprintf(full_path, sizeof(full_path), "%s/%s", d->dir, init_file); + if (ecore_file_is_dir(full_path)) continue; + if (!e_util_edje_collection_exists(full_path, "init/splash")) continue; + + ic = edje_object_add(evas); + e_util_edje_icon_set(ic, "enlightenment/run"); + + /* + * Using live previews for icons in list here + * really drains resources. */ + + /* + ic = e_widget_preview_add(evas, 48, 48); + e_widget_preview_edje_set(ic, full_path, "init/splash"); + */ + + /* e_thumb_generate cannot handle init splash yet */ + + /* + if (!e_thumb_exists(full_path)) + ic = e_thumb_generate_begin(full_path, 48, 48, evas, &ic, NULL, NULL); + else + ic = e_thumb_evas_object_get(full_path, evas, 48, 48, 1); + */ + + e_widget_ilist_append(il, ic, ecore_file_strip_ext(init_file), _ilist_cb_init_selected, cfd, full_path); + + if ((e_config->init_default_theme) && + (!strcmp(e_config->init_default_theme, init_file))) + { + E_Zone *z; + + z = e_zone_current_get(cfd->dia->win->container); + + selnum = i; + evas_object_del(im); + im = e_widget_preview_add(cfd->dia->win->evas, 320, (320 * z->h) / z->w); + e_widget_preview_edje_set(im, full_path, "init/splash"); + } + i++; + } + free(init_file); + ecore_list_destroy(inits); + } + evas_list_free(init); + if (init_dirs) e_path_dir_list_free(init_dirs); + free(c); + cfd->data = im; + e_widget_ilist_go(il); + if (selnum >= 0) + e_widget_ilist_selected_set(il, selnum); + + free(homedir); +} + +void +_ilist_cb_init_selected(void *data) +{ + E_Config_Dialog *cfd; + E_Config_Dialog_Data *cfdata; + Evas *evas; + const char *init; + const char *f; + + cfd = data; + cfdata = cfd->cfdata; + evas = cfd->dia->win->evas; + + if (!cfdata->init_default_theme[0]) + init = e_path_find(path_init, "init.edj"); + else + { + f = ecore_file_get_file(cfd->cfdata->init_default_theme); + 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 *evas; + Evas_Object *il, *ic; + char *file, *noext; + + cfdata = data; + if (!cfdata) return; + + il = cfdata->il; + if (!il) return; + + cfd = cfdata->cfd; + if (!cfd) return; + + evas = e_win_evas_get(cfd->dia->win); + + file = (char *)ecore_file_get_file((char *)path); + noext = ecore_file_strip_ext(file); - return o; + if (event == ECORE_FILE_EVENT_CREATED_FILE) + { + if (e_util_edje_collection_exists((char *)path, "init/splash")) + { + 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, (char *)path); + } + } + else if (event == ECORE_FILE_EVENT_DELETED_FILE) + e_widget_ilist_remove_label(il, noext); } _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs