Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c e_fwin.c e_fwin.h 


Log Message:


move directory config to .directory.desktop - can quibble on the name later,
but now it lets u specify the specific files with the config for the dir - so
they can be called anything and put anywhere. paths are either full abs path
/path/to/file.edj or file.edj (relative to dir).

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- e_fm.c      19 Apr 2007 12:19:48 -0000      1.148
+++ e_fm.c      22 Apr 2007 15:30:00 -0000      1.149
@@ -1007,6 +1007,9 @@
                  ef = efreet_desktop_get(buf);
                  if (ef) oic = e_util_desktop_icon_add(ef, "24x24", evas);
                  if (type_ret) *type_ret = "DESKTOP";
+// FIXME: there is no way to just unref an efreet desktop - free completely
+// frees - doesnt just unref.
+//               if (ef) efreet_desktop_free(ef);
               }
             else if (!strncmp(icon, "e/icons/fileman/mime/", 21))
               {
@@ -1075,6 +1078,9 @@
                  ef = efreet_desktop_get(buf);
                  if (ef) oic = e_util_desktop_icon_add(ef, "24x24", evas);
                  if (type_ret) *type_ret = "DESKTOP";
+// FIXME: there is no way to just unref an efreet desktop - free completely
+// frees - doesnt just unref.
+//               if (ef) efreet_desktop_free(ef);
               }
             else if (e_util_glob_case_match(ici->file, "*.imc"))
               {          
@@ -2701,7 +2707,10 @@
             else if (!strcmp(type, "Removable")) ic->info.removable = 1;
          }
      }
- 
+// FIXME: there is no way to just unref an efreet desktop - free completely
+// frees - doesnt just unref.
+//   efreet_desktop_free(desktop);
+//  
    return 1;
    error:
    if (ic->info.label) evas_stringshare_del(ic->info.label);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- e_fwin.c    17 Apr 2007 15:46:51 -0000      1.37
+++ e_fwin.c    22 Apr 2007 15:30:02 -0000      1.38
@@ -23,6 +23,7 @@
 static void _e_fwin_cb_delete(E_Win *win);
 static void _e_fwin_cb_resize(E_Win *win);
 static void _e_fwin_deleted(void *data, Evas_Object *obj, void *event_info);
+static const char *_e_fwin_custom_file_path_eval(E_Fwin *fwin, Efreet_Desktop 
*ef, const char *prev_path, const char *key);
 static void _e_fwin_changed(void *data, Evas_Object *obj, void *event_info);
 static void _e_fwin_selected(void *data, Evas_Object *obj, void *event_info);
 static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, 
E_Fm2_Icon_Info *info);
@@ -208,6 +209,10 @@
      }
    e_object_del(E_OBJECT(fwin->win));
    fwins = evas_list_remove(fwins, fwin);
+   if (fwin->wallpaper_file) evas_stringshare_del(fwin->wallpaper_file);
+   if (fwin->overlay_file) evas_stringshare_del(fwin->overlay_file);
+   if (fwin->scrollframe_file) evas_stringshare_del(fwin->scrollframe_file);
+   if (fwin->theme_file) evas_stringshare_del(fwin->theme_file);
    free(fwin);
 }
 
@@ -239,40 +244,76 @@
    e_object_del(E_OBJECT(fwin));
 }
 
+static const char *
+_e_fwin_custom_file_path_eval(E_Fwin *fwin, Efreet_Desktop *ef, const char 
*prev_path, const char *key)
+{
+   char buf[PATH_MAX];
+   const char *res, *ret = NULL;
+   
+   /* get a X-something custom tage from the .desktop for the dir */
+   res = ecore_hash_get(ef->x, key);
+   /* free the old path */
+   if (prev_path) evas_stringshare_del(prev_path);
+   /* if there was no key found - return NULL */
+   if (!res) return NULL;
+   
+   /* it's a full path */
+   if (res[0] == '/')
+     ret = evas_stringshare_add(res);
+   /* relative path to the dir */
+   else
+     {
+       snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), 
res);
+       ret = evas_stringshare_add(buf);
+     }
+   return ret;
+}
+
 static void
 _e_fwin_changed(void *data, Evas_Object *obj, void *event_info)
 {
    E_Fwin *fwin;
+   Efreet_Desktop *ef;
    char buf[PATH_MAX];
    
    fwin = data;
    /* FIXME: first look in E config for a special override for this dir's bg
     * or overlay
     */
+   snprintf(buf, sizeof(buf), "%s/.directory.desktop", 
e_fm2_real_path_get(fwin->fm_obj));
+   ef = efreet_desktop_get(buf);
+   if (ef)
+     {
+       fwin->wallpaper_file = _e_fwin_custom_file_path_eval(fwin, ef, 
fwin->wallpaper_file, "X-Enlightenment-Directory-Wallpaper");
+       fwin->overlay_file = _e_fwin_custom_file_path_eval(fwin, ef, 
fwin->overlay_file, "X-Enlightenment-Directory-Overlay");
+       fwin->scrollframe_file = _e_fwin_custom_file_path_eval(fwin, ef, 
fwin->scrollframe_file, "X-Enlightenment-Directory-Scrollframe");
+       fwin->theme_file = _e_fwin_custom_file_path_eval(fwin, ef, 
fwin->theme_file, "X-Enlightenment-Directory-Theme");
+// FIXME: there is no way to just unref an efreet desktop - free completely
+// frees - doesnt just unref.
+//     efreet_desktop_free(ef);
+     }
    if (fwin->under_obj)
      {
        evas_object_hide(fwin->under_obj);
-       snprintf(buf, sizeof(buf), "%s/.directory-wallpaper.edj",
-                e_fm2_real_path_get(fwin->fm_obj));
        edje_object_file_set(fwin->under_obj, NULL, NULL);
-       edje_object_file_set(fwin->under_obj, buf, "e/desktop/background");
+       if (fwin->wallpaper_file)
+         edje_object_file_set(fwin->under_obj, fwin->wallpaper_file, 
"e/desktop/background");
        evas_object_show(fwin->under_obj);
      }
    if (fwin->over_obj)
      {
        evas_object_hide(fwin->over_obj);
-       snprintf(buf, sizeof(buf), "%s/.directory-overlay.edj",
-                e_fm2_real_path_get(fwin->fm_obj));
        edje_object_file_set(fwin->over_obj, NULL, NULL);
-       edje_object_file_set(fwin->over_obj, buf, "e/desktop/background");
+       if (fwin->overlay_file)
+         edje_object_file_set(fwin->over_obj, fwin->overlay_file, 
"e/desktop/background");
        evas_object_show(fwin->over_obj);
      }
    if (fwin->scrollframe_obj)
      {
-       snprintf(buf, sizeof(buf), "%s/.directory-scrollframe.edj",
-                e_fm2_real_path_get(fwin->fm_obj));
-       if (e_util_edje_collection_exists(buf, "e/fileman/scrollframe/default"))
-         e_scrollframe_custom_edje_file_set(fwin->scrollframe_obj, buf,
+       if ((fwin->scrollframe_file) && 
+           (e_util_edje_collection_exists(fwin->scrollframe_file, 
"e/fileman/scrollframe/default")))
+         e_scrollframe_custom_edje_file_set(fwin->scrollframe_obj, 
+                                            (char *)fwin->scrollframe_file,
                                             "e/fileman/scrollframe/default");
        else
          e_scrollframe_custom_theme_set(fwin->scrollframe_obj,
@@ -280,10 +321,8 @@
                                         "e/fileman/scrollframe/default");
        e_scrollframe_child_pos_set(fwin->scrollframe_obj, 0, 0);
      }
-   snprintf(buf, sizeof(buf), "%s/.directory-theme.edj",
-           e_fm2_real_path_get(fwin->fm_obj));
-   if (ecore_file_exists(buf))
-     e_fm2_custom_theme_set(obj, buf);
+   if ((fwin->theme_file) && (ecore_file_exists(fwin->theme_file)))
+     e_fm2_custom_theme_set(obj, fwin->theme_file);
    else
      e_fm2_custom_theme_set(obj, NULL);
 }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_fwin.h    16 Apr 2007 15:50:20 -0000      1.4
+++ e_fwin.h    22 Apr 2007 15:30:02 -0000      1.5
@@ -27,6 +27,11 @@
    struct {
       Evas_Coord        x, y, max_x, max_y, w, h;
    } fm_pan, fm_pan_last;
+   
+   const char         *wallpaper_file;
+   const char         *overlay_file;
+   const char         *scrollframe_file;
+   const char         *theme_file;
 };
 
 struct _E_Fwin_Apps_Dialog



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to