Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_int_config_theme.c e_int_config_wallpaper.c 


Log Message:


theme selector now uses fm2 :)

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_theme.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- e_int_config_theme.c        14 Aug 2006 15:22:45 -0000      1.29
+++ e_int_config_theme.c        16 Aug 2006 12:24:23 -0000      1.30
@@ -1,259 +1,344 @@
 /*
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
-#include "e.h"
 
-/* PROTOTYPES - same all the time */
-typedef struct _E_Cfg_Theme_Data E_Cfg_Theme_Data;
+#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 Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, 
E_Config_Dialog_Data *cfdata);
+static void        *_create_data                (E_Config_Dialog *cfd);
+static void         _free_data                  (E_Config_Dialog *cfd, 
E_Config_Dialog_Data *cfdata);
+static void         _fill_data                  (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);
 
-/* Actual config data we will be playing with whil the dialog is active */
 struct _E_Config_Dialog_Data
 {
-   /*- BASIC -*/
-   char *theme;
-   char *current_theme;
-   /*- ADVANCED -*/
-};
-
-struct _E_Cfg_Theme_Data
-{
    E_Config_Dialog *cfd;
-   char *file;
+   Evas_Object *o_frame;
+   Evas_Object *o_fm;
+   Evas_Object *o_up_button;
+   Evas_Object *o_preview;
+   Evas_Object *o_personal;
+   Evas_Object *o_system;
+   int fmdir;
+   
    char *theme;
 };
 
-/* a nice easy setup function that does the dirty work */
 EAPI E_Config_Dialog *
 e_int_config_theme(E_Container *con)
 {
    E_Config_Dialog *cfd;
    E_Config_Dialog_View *v;
-   
+
    v = E_NEW(E_Config_Dialog_View, 1);
    
-   /* methods */
    v->create_cfdata           = _create_data;
    v->free_cfdata             = _free_data;
    v->basic.apply_cfdata      = _basic_apply_data;
    v->basic.create_widgets    = _basic_create_widgets;
    v->override_auto_apply = 1;
-   
-   /* create config diaolg for NULL object/data */
    cfd = e_config_dialog_new(con,
                             _("Theme Selector"),
-                           "E", "_config_theme_dialog",
+                            "E", "_config_theme_dialog",
                             "enlightenment/themes", 0, v, NULL);
    return cfd;
 }
 
-/**--CREATE--**/
+
 static void
-_fill_data(E_Config_Dialog_Data *cfdata)
+_cb_button_up(void *data1, void *data2)
 {
-   /* get current theme */
-   E_Config_Theme * c;
-   c = e_theme_config_get("theme");
-   cfdata->current_theme = strdup(c->file);
+   E_Config_Dialog_Data *cfdata;
+   
+   cfdata = data1;
+   if (cfdata->o_fm)
+     e_fm2_parent_go(cfdata->o_fm);
+   if (cfdata->o_frame)
+     e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
 }
 
-static void *
-_create_data(E_Config_Dialog *cfd)
+static void
+_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
 {
-   /* Create cfdata - cfdata is a temporary block of config data that this
-    * dialog will be dealing with while configuring. it will be applied to
-    * the running systems/config in the apply methods
-    */
    E_Config_Dialog_Data *cfdata;
    
-   cfdata = E_NEW(E_Config_Dialog_Data, 1);
-   _fill_data(cfdata);
-   return cfdata;
+   cfdata = data;
+   if (!cfdata->o_fm) return;
+   if (!e_fm2_has_parent_get(cfdata->o_fm))
+     {
+       if (cfdata->o_up_button)
+         e_widget_disabled_set(cfdata->o_up_button, 1);
+     }
+   else
+     {
+       if (cfdata->o_up_button)
+         e_widget_disabled_set(cfdata->o_up_button, 0);
+     }
+   if (cfdata->o_frame)
+     e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
 }
 
 static void
-_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
 {
-   /* Free the cfdata */  
-   free(cfdata->current_theme);
-   free(cfdata);
+   E_Config_Dialog_Data *cfdata;
+   Evas_List *selected;
+   E_Fm2_Icon_Info *ici;
+   const char *realpath;
+   char buf[4096];
+   
+   cfdata = data;
+   if (!cfdata->o_fm) return;
+   selected = e_fm2_selected_list_get(cfdata->o_fm);
+   if (!selected) return;
+   ici = selected->data;
+   realpath = e_fm2_real_path_get(cfdata->o_fm);
+   if (!strcmp(realpath, "/"))
+     snprintf(buf, sizeof(buf), "/%s", ici->file);
+   else
+     snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
+   evas_list_free(selected);
+   if (ecore_file_is_dir(buf)) return;
+   E_FREE(cfdata->theme);
+   cfdata->theme = strdup(buf);
+   if (cfdata->o_preview)
+     e_widget_preview_edje_set(cfdata->o_preview, buf, "desktop/background");
+   if (cfdata->o_frame)
+     e_widget_change(cfdata->o_frame);
 }
 
-/**--APPLY--**/
-static int
-_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+static void
+_cb_files_selected(void *data, Evas_Object *obj, void *event_info)
 {
-   E_Action *a;
+   E_Config_Dialog_Data *cfdata;
    
-   /* 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);   
-   return 1; /* Apply was OK */
+   cfdata = data;
+   printf("SEL\n");
 }
 
-void
-_e_config_theme_cb_standard(void *data)
+static void
+_cb_files_files_changed(void *data, Evas_Object *obj, void *event_info)
 {
-   E_Cfg_Theme_Data *d;
    E_Config_Dialog_Data *cfdata;
-   const char *tmp;
-   
-   d = data;
-   e_widget_preview_edje_set(d->cfd->data, d->file, "desktop/background");
+   char *p, *homedir, buf[4096];
    
-   cfdata = d->cfd->cfdata;
-   if (cfdata->current_theme) 
+   cfdata = data;
+   if (!cfdata->theme) return;
+   if (!cfdata->o_fm) return;
+   p = (char *)e_fm2_real_path_get(cfdata->o_fm);
+   if (p)
      {
-       tmp = ecore_file_get_file(d->file);
-       if (!strcmp(tmp, cfdata->current_theme)) 
-         {
-            e_dialog_button_disable_num_set(d->cfd->dia, 0, 1);
-            e_dialog_button_disable_num_set(d->cfd->dia, 1, 1);        
-         }
+       if (strncmp(p, cfdata->theme, strlen(p))) return;
+     }
+   homedir = e_user_homedir_get();
+   if (!homedir) return;
+   snprintf(buf, sizeof(buf), "%s/.e/e/themes", homedir);
+   free(homedir);
+   if (!p) return;
+   if (!strncmp(cfdata->theme, buf, strlen(buf)))
+     p = cfdata->theme + strlen(buf) + 1;
+   else
+     {
+       snprintf(buf, sizeof(buf), "%s/data/themes", e_prefix_data_get());
+       if (!strncmp(cfdata->theme, buf, strlen(buf)))
+         p = cfdata->theme + strlen(buf) + 1;
+       else
+         p = cfdata->theme;
      }
+   e_fm2_select_set(cfdata->o_fm, p, 1);
+   e_fm2_file_show(cfdata->o_fm, p);
 }
 
-/**--GUI--**/
-static Evas_Object *
-_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data 
*cfdata)
+static void
+_cb_dir(void *data, Evas_Object *obj, void *event_info)
 {
-   /* generate the core widget layout for a basic dialog */
-   Evas_Object *o, *o2, *im = NULL;
-   Evas_Object *il;
-   char *homedir;
-   Evas_Object *theme;
-   char fulltheme[PATH_MAX];
-   int i = 0, selnum = -1;
-   Ecore_Evas *eebuf;
-   Evas *evasbuf;
-   Evas_List *l, *paths;
-   
-   theme = edje_object_add(evas);
-   
-   _fill_data(cfdata);
-   cfdata->theme = NULL;
-   
-   o = e_widget_table_add(evas, 0);
+   E_Config_Dialog_Data *cfdata;
+   char path[4096], *homedir;
    
-   il = e_widget_ilist_add(evas, 48, 48, &(cfdata->theme));
+   cfdata = data;
+   if (cfdata->fmdir == 1)
+     {
+       snprintf(path, sizeof(path), "%s/data/themes", e_prefix_data_get());
+     }
+   else
+     {
+       homedir = e_user_homedir_get();
+       snprintf(path, sizeof(path), "%s/.e/e/themes", homedir);
+       free(homedir);
+     }
+   e_fm2_path_set(cfdata->o_fm, path, "/");
+}
+
 
-   eebuf = ecore_evas_buffer_new(1, 1);
-   evasbuf = ecore_evas_get(eebuf);
-   o2 = edje_object_add(evasbuf);
 
-   paths = e_path_dir_list_get(path_themes);
-   for (l = paths; l; l = l->next)
+
+static void
+_fill_data(E_Config_Dialog_Data *cfdata)
+{
+   E_Config_Theme * c;
+   char path[4096], *homedir;
+   
+   c = e_theme_config_get("theme");
+   if (c)
+     cfdata->theme = strdup(c->file);
+   else
      {
-       Ecore_List *themes;
-       char *themefile;
-       E_Path_Dir *d;
-       int detected;
-       
-       d = l->data;
-       if (!ecore_file_is_dir(d->dir)) continue;
-       themes = ecore_file_ls(d->dir);
-       if (!themes) continue;
-       
-       detected = 0;
-       homedir = e_user_homedir_get();
-       if (homedir)
-         {
-            if (!strncmp(d->dir, homedir, strlen(homedir)))
-              {
-                 e_widget_ilist_header_append(il, NULL, _("Personal"));
-                 i++;
-                 detected = 1;
-              }
-            free(homedir);
-         }
-       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)
+       snprintf(path, sizeof(path), "%s/data/themes/default.edj", 
e_prefix_data_get());
+       cfdata->theme = strdup(path);
+     }
+   if (cfdata->theme[0] != '/')
+     {
+        homedir = e_user_homedir_get();
+        snprintf(path, sizeof(path), "%s/.e/e/themes/%s", homedir, 
cfdata->theme);
+       if (ecore_file_exists(path))
          {
-            e_widget_ilist_header_append(il, NULL, _("Other"));
-            i++;
-            detected = 1;
+            E_FREE(cfdata->theme);
+            cfdata->theme = strdup(path);
          }
-       
-       while ((themefile = ecore_list_next(themes)))
+       else
          {
-            snprintf(fulltheme, sizeof(fulltheme), "%s/%s", d->dir, themefile);
-            if (ecore_file_is_dir(fulltheme)) continue;
-            
-            /* minimum theme requirements */
-            if (edje_object_file_set(o2, fulltheme, "desktop/background"))
+            snprintf(path, sizeof(path), "%s/data/themes/%s", 
e_prefix_data_get(), cfdata->theme);
+            if (ecore_file_exists(path))
               {
-                 Evas_Object *o3 = NULL;
-                 char *noext;
-                 E_Cfg_Theme_Data *cb_data;
-                 
-                 o3 = e_thumb_icon_add(cfd->dia->win->evas);
-                 e_thumb_icon_file_set(o3, fulltheme, "desktop/background");
-                 e_thumb_icon_size_set(o3, 64,
-                                        (64 * 
e_zone_current_get(cfd->dia->win->container)->h) /
-                                        
e_zone_current_get(cfd->dia->win->container)->w);
-                 e_thumb_icon_begin(o3);
-                 
-                 noext = ecore_file_strip_ext(themefile);
-                 
-                 cb_data = E_NEW(E_Cfg_Theme_Data, 1);
-                 cb_data->cfd = cfd;
-                 cb_data->file = strdup(fulltheme);
-                 cb_data->theme = strdup(themefile);
-                 
-                 e_widget_ilist_append(il, o3, noext,
-                                       _e_config_theme_cb_standard, cb_data,
-                                       themefile);
-                 if (!(strcmp(themefile, cfdata->current_theme)))
-                   {
-                      selnum = i;
-                      im = e_widget_preview_add(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, fulltheme, 
"desktop/background");
-                   }
-                 free(noext);
-                 i++;
+                 E_FREE(cfdata->theme);
+                 cfdata->theme = strdup(path);
               }
          }
-       free(themefile);
-       ecore_list_destroy(themes);
+        free(homedir);
      }
-   if (paths) e_path_dir_list_free(paths);
-   evas_object_del(o2);
-   ecore_evas_free(eebuf);
-
-   e_widget_ilist_go(il);   
-   e_widget_min_size_set(il, 180, 40);
-   e_widget_table_object_append(o, il, 0, 0, 1, 2, 1, 1, 1, 1);
-   if (im == NULL)
-     {
-       snprintf(fulltheme, sizeof(fulltheme), 
PACKAGE_DATA_DIR"/data/themes/default.edj");
-       im = e_widget_preview_add(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, fulltheme, "desktop/background");
-     }
-   cfd->data = im;
    
-   e_widget_table_object_append(o, im, 1, 0, 1, 2, 1, 1, 1, 1);   
+   snprintf(path, sizeof(path), "%s/data/themes", e_prefix_data_get());
+   if (!strncmp(cfdata->theme, path, strlen(path)))
+     cfdata->fmdir = 1;
+}
 
-   if (selnum >= 0) e_widget_ilist_selected_set(il, selnum);
-   
-   return o;
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+   E_Config_Dialog_Data *cfdata;
+
+   cfdata = E_NEW(E_Config_Dialog_Data, 1);
+   cfd->cfdata = cfdata;
+   cfdata->cfd = cfd;
+   _fill_data(cfdata);
+   return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+   E_FREE(cfdata->theme);
+   free(cfdata);
+}
+
+static Evas_Object *
+_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data 
*cfdata)
+{
+   Evas_Object *o, *ot, *of, *il, *ol;
+   char path[4096], *homedir;
+   const char *f;
+   E_Fm2_Config fmc;
+   E_Zone *z;
+   E_Radio_Group *rg;
+   
+   homedir = e_user_homedir_get();
+   if (!homedir) return NULL;
+
+   z = e_zone_current_get(cfd->con);
+   
+   ot = e_widget_table_add(evas, 0);
+   ol = e_widget_table_add(evas, 0);
+   il = e_widget_table_add(evas, 1);
+   
+   rg = e_widget_radio_group_new(&(cfdata->fmdir));
+   o = e_widget_radio_add(evas, _("Personal"), 0, rg);
+   cfdata->o_personal = o;
+   evas_object_smart_callback_add(o, "changed",
+                                 _cb_dir, cfdata);
+   e_widget_table_object_append(il, o, 0, 0, 1, 1, 1, 1, 0, 0);
+   o = e_widget_radio_add(evas, _("System"), 1, rg);
+   cfdata->o_system = o;
+   evas_object_smart_callback_add(o, "changed",
+                                 _cb_dir, cfdata);
+   e_widget_table_object_append(il, o, 1, 0, 1, 1, 1, 1, 0, 0);
+   
+   e_widget_table_object_append(ol, il, 0, 0, 1, 1, 0, 0, 0, 0);
+   
+   o = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
+                          _cb_button_up, cfdata, NULL);
+   cfdata->o_up_button = o;
+   e_widget_table_object_append(ol, o, 0, 1, 1, 1, 0, 0, 0, 0);
+   
+   if (cfdata->fmdir == 1)
+     snprintf(path, sizeof(path), "%s/data/themes", e_prefix_data_get());
+   else
+     snprintf(path, sizeof(path), "%s/.e/e/themes", homedir);
+   
+   o = e_fm2_add(evas);
+   cfdata->o_fm = o;
+   memset(&fmc, 0, sizeof(E_Fm2_Config));
+   fmc.view.mode = E_FM2_VIEW_MODE_LIST;
+   fmc.view.open_dirs_in_place = 1;
+   fmc.view.selector = 1;
+   fmc.view.single_click = 0;
+   fmc.view.no_subdir_jump = 0;
+   fmc.icon.list.w = 48;
+   fmc.icon.list.h = 48;
+   fmc.icon.fixed.w = 1;
+   fmc.icon.fixed.h = 1;
+   fmc.icon.extension.show = 0;
+   fmc.list.sort.no_case = 1;
+   fmc.list.sort.dirs.first = 0;
+   fmc.list.sort.dirs.last = 1;
+   fmc.selection.single = 1;
+   fmc.selection.windows_modifiers = 0;
+   e_fm2_config_set(o, &fmc);
+   evas_object_smart_callback_add(o, "dir_changed",
+                                 _cb_files_changed, cfdata);
+   evas_object_smart_callback_add(o, "selection_change",
+                                 _cb_files_selection_change, cfdata);
+   evas_object_smart_callback_add(o, "selected",
+                                 _cb_files_selected, cfdata);
+   evas_object_smart_callback_add(o, "changed",
+                                 _cb_files_files_changed, cfdata);
+   e_fm2_path_set(o, path, "/");
+
+   of = e_widget_scrollframe_pan_add(evas, o,
+                                    e_fm2_pan_set,
+                                    e_fm2_pan_get,
+                                    e_fm2_pan_max_get,
+                                    e_fm2_pan_child_size_get);
+   cfdata->o_frame = of;
+   e_widget_min_size_set(of, 160, 160);
+   e_widget_table_object_append(ol, of, 0, 2, 1, 1, 1, 1, 1, 1);
+   e_widget_table_object_append(ot, ol, 0, 0, 1, 1, 1, 1, 1, 1);
+   
+   of = e_widget_list_add(evas, 0, 0);
+   
+   o = e_widget_preview_add(evas, 320, (320 * z->h) / z->w);
+   cfdata->o_preview = o;
+   if (cfdata->theme)
+     f = cfdata->theme;
+   e_widget_preview_edje_set(o, f, "desktop/background");
+   e_widget_list_object_append(of, o, 1, 0, 0.5);
+   
+   e_widget_table_object_append(ot, of, 1, 0, 1, 1, 0, 1, 0, 1);
+   
+   free(homedir);
+   e_dialog_resizable_set(cfd->dia, 1);
+   return ot;
 }
 
+static int
+_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+   E_Action *a;
+   
+   /* 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);
+   return 1; /* Apply was OK */
+}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_wallpaper.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_int_config_wallpaper.c    15 Aug 2006 13:16:52 -0000      1.4
+++ e_int_config_wallpaper.c    16 Aug 2006 12:24:23 -0000      1.5
@@ -15,9 +15,9 @@
 struct _E_Config_Dialog_Data
 {
    E_Config_Dialog *cfd;
-   Evas_Object *o_usrbg_frame;
-   Evas_Object *o_usrbg_fm;
-   Evas_Object *o_usrbg_up_button;
+   Evas_Object *o_frame;
+   Evas_Object *o_fm;
+   Evas_Object *o_up_button;
    Evas_Object *o_preview;
    Evas_Object *o_theme_bg;
    Evas_Object *o_personal;
@@ -71,15 +71,15 @@
    cfdata->use_theme_bg = 0;
    if (cfdata->o_theme_bg)
      e_widget_check_checked_set(cfdata->o_theme_bg, cfdata->use_theme_bg);
-   if (cfdata->o_usrbg_fm)
-     e_fm2_path_set(cfdata->o_usrbg_fm, path, "/");
+   if (cfdata->o_fm)
+     e_fm2_path_set(cfdata->o_fm, path, "/");
    if (cfdata->o_preview)
      e_widget_preview_edje_set(cfdata->o_preview, cfdata->bg, 
"desktop/background");
    if (cfdata->o_theme_bg)
      e_widget_check_checked_set(cfdata->o_theme_bg, 0);
    cfdata->use_theme_bg = 0;
-   if (cfdata->o_usrbg_frame)
-     e_widget_change(cfdata->o_usrbg_frame);
+   if (cfdata->o_frame)
+     e_widget_change(cfdata->o_frame);
 }
 
 EAPI void
@@ -93,40 +93,40 @@
 
 
 static void
-_cb_usrbg_button_up(void *data1, void *data2)
+_cb_button_up(void *data1, void *data2)
 {
    E_Config_Dialog_Data *cfdata;
    
    cfdata = data1;
-   if (cfdata->o_usrbg_fm)
-     e_fm2_parent_go(cfdata->o_usrbg_fm);
-   if (cfdata->o_usrbg_frame)
-     e_widget_scrollframe_child_pos_set(cfdata->o_usrbg_frame, 0, 0);
+   if (cfdata->o_fm)
+     e_fm2_parent_go(cfdata->o_fm);
+   if (cfdata->o_frame)
+     e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
 }
 
 static void
-_cb_usrbg_files_changed(void *data, Evas_Object *obj, void *event_info)
+_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    
    cfdata = data;
-   if (!cfdata->o_usrbg_fm) return;
-   if (!e_fm2_has_parent_get(cfdata->o_usrbg_fm))
+   if (!cfdata->o_fm) return;
+   if (!e_fm2_has_parent_get(cfdata->o_fm))
      {
-       if (cfdata->o_usrbg_up_button)
-         e_widget_disabled_set(cfdata->o_usrbg_up_button, 1);
+       if (cfdata->o_up_button)
+         e_widget_disabled_set(cfdata->o_up_button, 1);
      }
    else
      {
-       if (cfdata->o_usrbg_up_button)
-         e_widget_disabled_set(cfdata->o_usrbg_up_button, 0);
+       if (cfdata->o_up_button)
+         e_widget_disabled_set(cfdata->o_up_button, 0);
      }
-   if (cfdata->o_usrbg_frame)
-     e_widget_scrollframe_child_pos_set(cfdata->o_usrbg_frame, 0, 0);
+   if (cfdata->o_frame)
+     e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
 }
 
 static void
-_cb_usrbg_files_selection_change(void *data, Evas_Object *obj, void 
*event_info)
+_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    Evas_List *selected;
@@ -135,11 +135,11 @@
    char buf[4096];
    
    cfdata = data;
-   if (!cfdata->o_usrbg_fm) return;
-   selected = e_fm2_selected_list_get(cfdata->o_usrbg_fm);
+   if (!cfdata->o_fm) return;
+   selected = e_fm2_selected_list_get(cfdata->o_fm);
    if (!selected) return;
    ici = selected->data;
-   realpath = e_fm2_real_path_get(cfdata->o_usrbg_fm);
+   realpath = e_fm2_real_path_get(cfdata->o_fm);
    if (!strcmp(realpath, "/"))
      snprintf(buf, sizeof(buf), "/%s", ici->file);
    else
@@ -153,28 +153,29 @@
    if (cfdata->o_theme_bg)
      e_widget_check_checked_set(cfdata->o_theme_bg, 0);
    cfdata->use_theme_bg = 0;
-   if (cfdata->o_usrbg_frame)
-     e_widget_change(cfdata->o_usrbg_frame);
+   if (cfdata->o_frame)
+     e_widget_change(cfdata->o_frame);
 }
 
 static void
-_cb_usrbg_files_selected(void *data, Evas_Object *obj, void *event_info)
+_cb_files_selected(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    
    cfdata = data;
+   printf("SEL\n");
 }
 
 static void
-_cb_usrbg_files_files_changed(void *data, Evas_Object *obj, void *event_info)
+_cb_files_files_changed(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    char *p, *homedir, buf[4096];
    
    cfdata = data;
    if (!cfdata->bg) return;
-   if (!cfdata->o_usrbg_fm) return;
-   p = (char *)e_fm2_real_path_get(cfdata->o_usrbg_fm);
+   if (!cfdata->o_fm) return;
+   p = (char *)e_fm2_real_path_get(cfdata->o_fm);
    if (p)
      {
        if (strncmp(p, cfdata->bg, strlen(p))) return;
@@ -187,9 +188,15 @@
    if (!strncmp(cfdata->bg, buf, strlen(buf)))
      p = cfdata->bg + strlen(buf) + 1;
    else
-     p = cfdata->bg;
-   e_fm2_select_set(cfdata->o_usrbg_fm, p, 1);
-   e_fm2_file_show(cfdata->o_usrbg_fm, p);
+     {
+       snprintf(buf, sizeof(buf), "%s/data/backgrounds", e_prefix_data_get());
+       if (!strncmp(cfdata->bg, buf, strlen(buf)))
+         p = cfdata->bg + strlen(buf) + 1;
+       else
+         p = cfdata->bg;
+     }
+   e_fm2_select_set(cfdata->o_fm, p, 1);
+   e_fm2_file_show(cfdata->o_fm, p);
 }
 
 static void
@@ -216,7 +223,7 @@
 }
 
 static void
-_cb_usrbg_dir(void *data, Evas_Object *obj, void *event_info)
+_cb_dir(void *data, Evas_Object *obj, void *event_info)
 {
    E_Config_Dialog_Data *cfdata;
    char path[4096], *homedir;
@@ -232,7 +239,7 @@
        snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir);
        free(homedir);
      }
-   e_fm2_path_set(cfdata->o_usrbg_fm, path, "/");
+   e_fm2_path_set(cfdata->o_fm, path, "/");
 }
 
 static void
@@ -344,19 +351,19 @@
    o = e_widget_radio_add(evas, _("Personal"), 0, rg);
    cfdata->o_personal = o;
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_dir, cfdata);
+                                 _cb_dir, cfdata);
    e_widget_table_object_append(il, o, 0, 0, 1, 1, 1, 1, 0, 0);
    o = e_widget_radio_add(evas, _("System"), 1, rg);
    cfdata->o_system = o;
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_dir, cfdata);
+                                 _cb_dir, cfdata);
    e_widget_table_object_append(il, o, 1, 0, 1, 1, 1, 1, 0, 0);
    
    e_widget_table_object_append(ol, il, 0, 0, 1, 1, 0, 0, 0, 0);
    
    o = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
-                          _cb_usrbg_button_up, cfdata, NULL);
-   cfdata->o_usrbg_up_button = o;
+                          _cb_button_up, cfdata, NULL);
+   cfdata->o_up_button = o;
    e_widget_table_object_append(ol, o, 0, 1, 1, 1, 0, 0, 0, 0);
    
    if (cfdata->fmdir == 1)
@@ -365,7 +372,7 @@
      snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir);
    
    o = e_fm2_add(evas);
-   cfdata->o_usrbg_fm = o;
+   cfdata->o_fm = o;
    memset(&fmc, 0, sizeof(E_Fm2_Config));
    fmc.view.mode = E_FM2_VIEW_MODE_LIST;
    fmc.view.open_dirs_in_place = 1;
@@ -384,13 +391,13 @@
    fmc.selection.windows_modifiers = 0;
    e_fm2_config_set(o, &fmc);
    evas_object_smart_callback_add(o, "dir_changed",
-                                 _cb_usrbg_files_changed, cfdata);
+                                 _cb_files_changed, cfdata);
    evas_object_smart_callback_add(o, "selection_change",
-                                 _cb_usrbg_files_selection_change, cfdata);
+                                 _cb_files_selection_change, cfdata);
    evas_object_smart_callback_add(o, "selected",
-                                 _cb_usrbg_files_selected, cfdata);
+                                 _cb_files_selected, cfdata);
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_files_files_changed, cfdata);
+                                 _cb_files_files_changed, cfdata);
    e_fm2_path_set(o, path, "/");
 
    of = e_widget_scrollframe_pan_add(evas, o,
@@ -398,7 +405,7 @@
                                     e_fm2_pan_get,
                                     e_fm2_pan_max_get,
                                     e_fm2_pan_child_size_get);
-   cfdata->o_usrbg_frame = of;
+   cfdata->o_frame = of;
    e_widget_min_size_set(of, 160, 160);
    e_widget_table_object_append(ol, of, 0, 2, 1, 1, 1, 1, 1, 1);
    e_widget_table_object_append(ot, ol, 0, 0, 1, 1, 1, 1, 1, 1);
@@ -484,19 +491,19 @@
    o = e_widget_radio_add(evas, _("Personal"), 0, rg);
    cfdata->o_personal = o;
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_dir, cfdata);
+                                 _cb_dir, cfdata);
    e_widget_table_object_append(il, o, 0, 0, 1, 1, 1, 1, 0, 0);
    o = e_widget_radio_add(evas, _("System"), 1, rg);
    cfdata->o_system = o;
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_dir, cfdata);
+                                 _cb_dir, cfdata);
    e_widget_table_object_append(il, o, 1, 0, 1, 1, 1, 1, 0, 0);
    
    e_widget_table_object_append(ol, il, 0, 0, 1, 1, 0, 0, 0, 0);
    
    o = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
-                          _cb_usrbg_button_up, cfdata, NULL);
-   cfdata->o_usrbg_up_button = o;
+                          _cb_button_up, cfdata, NULL);
+   cfdata->o_up_button = o;
    e_widget_table_object_append(ol, o, 0, 1, 1, 1, 0, 0, 0, 0);
    
    if (cfdata->fmdir == 1)
@@ -505,7 +512,7 @@
      snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir);
    
    o = e_fm2_add(evas);
-   cfdata->o_usrbg_fm = o;
+   cfdata->o_fm = o;
    memset(&fmc, 0, sizeof(E_Fm2_Config));
    fmc.view.mode = E_FM2_VIEW_MODE_LIST;
    fmc.view.open_dirs_in_place = 1;
@@ -524,13 +531,13 @@
    fmc.selection.windows_modifiers = 0;
    e_fm2_config_set(o, &fmc);
    evas_object_smart_callback_add(o, "dir_changed",
-                                 _cb_usrbg_files_changed, cfdata);
+                                 _cb_files_changed, cfdata);
    evas_object_smart_callback_add(o, "selection_change",
-                                 _cb_usrbg_files_selection_change, cfdata);
+                                 _cb_files_selection_change, cfdata);
    evas_object_smart_callback_add(o, "selected",
-                                 _cb_usrbg_files_selected, cfdata);
+                                 _cb_files_selected, cfdata);
    evas_object_smart_callback_add(o, "changed",
-                                 _cb_usrbg_files_files_changed, cfdata);
+                                 _cb_files_files_changed, cfdata);
    e_fm2_path_set(o, path, "/");
 
    of = e_widget_scrollframe_pan_add(evas, o,
@@ -538,7 +545,7 @@
                                     e_fm2_pan_get,
                                     e_fm2_pan_max_get,
                                     e_fm2_pan_child_size_get);
-   cfdata->o_usrbg_frame = of;
+   cfdata->o_frame = of;
    e_widget_min_size_set(of, 160, 160);
    e_widget_table_object_append(ol, of, 0, 2, 1, 1, 1, 1, 1, 1);
    e_widget_table_object_append(ot, ol, 0, 0, 1, 1, 1, 1, 1, 1);



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to