This is a place holder sort of thing for now. I'll look into e_theme.c and see what can be done to make it all better.
On 5/1/05, enlightenment-cvs@lists.sourceforge.net <enlightenment-cvs@lists.sourceforge.net> wrote: > Enlightenment CVS committal > > Author : raster > Project : e17 > Module : apps/e > > Dir : e17/apps/e/src/bin > > Modified Files: > e_int_menus.c > > Log Message: > > mitigate badness... > > =================================================================== > RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v > retrieving revision 1.51 > retrieving revision 1.52 > diff -u -3 -r1.51 -r1.52 > --- e_int_menus.c 1 May 2005 12:35:37 -0000 1.51 > +++ e_int_menus.c 1 May 2005 14:41:26 -0000 1.52 > @@ -37,8 +37,8 @@ > static void _e_int_menus_desktops_col_del_cb (void *data, E_Menu *m, > E_Menu_Item *mi); > static void _e_int_menus_gadgets_pre_cb (void *data, E_Menu *m); > static void _e_int_menus_gadgets_edit_mode_cb(void *data, E_Menu *m, > E_Menu_Item *mi); > -static void _e_int_menus_themes_pre_cb (void *data, E_Menu *m); > -static void _e_int_menus_themes_edit_mode_cb(void *data, E_Menu *m, > E_Menu_Item *mi); > +static void _e_int_menus_themes_pre_cb (void *data, E_Menu *m); > +static void _e_int_menus_themes_edit_mode_cb (void *data, E_Menu *m, > E_Menu_Item *mi); > > /* externally accessible functions */ > E_Menu * > @@ -565,11 +565,18 @@ > e_gadman_mode_set(gm, E_GADMAN_MODE_NORMAL); > } > > +/* FIXME: > + * > + * this HAS to go. its a REALLY BAD HACK - i've fixed up a few problems.. but > + * this is just wrong - symlink ... wrong. i f u are going to do this - use > + * the e_theme.c stuff - and add code to save and load it > + */ > static void > _e_int_menus_themes_pre_cb(void *data, E_Menu *m) > { > E_Menu_Item *mi; > E_Menu *root; > + int num = 0; > > e_menu_pre_activate_callback_set(m, NULL, NULL); > root = e_menu_root_get(m); > @@ -578,12 +585,6 @@ > char buf[4096]; > char *homedir; > > - mi = e_menu_item_new(m); > - e_menu_item_label_set(mi, _("Choose Theme")); > - > - mi = e_menu_item_new(m); > - e_menu_item_separator_set(mi, 1); > - > homedir = e_user_homedir_get(); > if (homedir) > { > @@ -591,49 +592,60 @@ > free(homedir); > } > > - if (ecore_file_exists(buf) && ecore_file_is_dir(buf)) > + if ((ecore_file_exists(buf)) && (ecore_file_is_dir(buf))) > { > Ecore_List *themes; > - char *theme, *deftheme; > > themes = ecore_file_ls(buf); > - theme = E_NEW(char, strlen(buf) + strlen("/default.edj") + 1); > - snprintf(theme, strlen(buf) + strlen("/default.edj") + 1, > "%s/default.edj", buf); > - > - if (ecore_file_exists("/home/hisham/.e/e/themes/default.edj")) > - deftheme = > ecore_file_readlink("/home/hisham/.e/e/themes/default.edj"); > - if (deftheme) > + if (themes) > { > - char *s; > - if ((s = strrchr(deftheme, '/'))) > - deftheme = s + 1; > - } > - > - while ((theme = ecore_list_next(themes))) > - { > - if (ecore_file_is_dir(theme) || !strrchr(theme,'.')) > - continue; > - if (!strncmp(strrchr(theme,'.'), ".edj", 4)) > - { > - mi = e_menu_item_new(m); > - e_menu_item_radio_set(mi, 1); > - if (deftheme) > - { > - if (!strcmp(theme, deftheme)) > - e_menu_item_toggle_set(mi, 1); > + char *theme, *deftheme = NULL; > + > + theme = E_NEW(char, strlen(buf) + strlen("/default.edj") + > 1); > + strcpy(theme, buf); > + strcat(theme, "/default.edj"); > + > + if (ecore_file_exists(theme)) > + deftheme = ecore_file_readlink(theme); > + if (deftheme) > + { > + char *s; > + > + if ((s = strrchr(deftheme, '/'))) > + deftheme = s + 1; > + } > + IF_FREE(theme); > + > + while ((theme = ecore_list_next(themes))) > + { > + char *ext; > + > + ext = strrchr(theme, '.'); > + if (ecore_file_is_dir(theme) || (!ext)) > + continue; > + if (!strcasecmp(ext, ".edj")) > + { > + mi = e_menu_item_new(m); > + e_menu_item_radio_set(mi, 1); > + if (deftheme) > + { > + if (!strcmp(theme, deftheme)) > + e_menu_item_toggle_set(mi, 1); > + } > + *ext = 0; > + e_menu_item_label_set(mi, theme); > + e_menu_item_callback_set(mi, > _e_int_menus_themes_edit_mode_cb, NULL); > + num++; > } > - *(strrchr(theme, '.')) = '\0'; > - e_menu_item_label_set(mi, _(theme)); > - e_menu_item_callback_set(mi, > _e_int_menus_themes_edit_mode_cb, NULL); > } > + ecore_list_destroy(themes); > } > } > } > - else > + if (num == 0) > { > mi = e_menu_item_new(m); > - e_menu_item_label_set(mi, _("(Unused)")); > - e_menu_item_callback_set(mi, NULL, NULL); > + e_menu_item_label_set(mi, _("(Empty)")); > } > } > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > enlightenment-cvs mailing list > enlightenment-cvs@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs > -- Hisham Mardam Bey MSc (Computer Science) http://hisham.cc/ +9613609386 Codito Ergo Sum (I Code Therefore I Am) ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel