Enlightenment CVS committal

Author  : lok
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_eap_editor.c e_fm.c 


Log Message:
Fix the fileselector when choosing an icon.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_eap_editor.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- e_eap_editor.c      7 Oct 2007 21:22:40 -0000       1.90
+++ e_eap_editor.c      27 Oct 2007 15:55:27 -0000      1.91
@@ -568,7 +568,7 @@
    Evas_Object *o;
    Evas_Coord mw, mh;
    E_Desktop_Edit *editor;
-   char *dir = NULL;
+   char *path = NULL, *icon_path = NULL;
 
    editor = data2;
    cfdata = data1;
@@ -586,22 +586,27 @@
    /* XXX change this to a generic icon selector (that can do either
     * files from a dir, or icons in the current theme */
    if (cfdata->icon) 
-     dir = ecore_file_dir_get(cfdata->icon);
+     {
+       icon_path = efreet_icon_path_find(e_config->icon_theme, 
+                                         cfdata->icon, "scalable");
+       path = ecore_file_dir_get(icon_path);
+     }
 
-   if (dir)
+   if (path)
      {
-       o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
+       o = e_widget_fsel_add(dia->win->evas, "/", path, NULL, NULL,
                              _e_desktop_edit_select_cb, cfdata,
                              NULL, cfdata, 1);
-       free(dir);
+       free(path);
      }
    else
      {
-       o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
+       o = e_widget_fsel_add(dia->win->evas, "/", "~/", NULL, NULL,
                              _e_desktop_edit_select_cb, cfdata,
                              NULL, cfdata, 1);
      }
    
+   if (icon_path) free(icon_path);
    evas_object_show(o);
    editor->icon_fsel = o;
    e_widget_min_size_get(o, &mw, &mh);
@@ -626,7 +631,7 @@
    Evas_Object *o;
    Evas_Coord mw, mh;
    E_Desktop_Edit *editor;
-   char *dir = NULL;
+   char *path = NULL;
 
    editor = data2;
    cfdata = data1;
@@ -642,18 +647,25 @@
 
    /* absolute path to exe */
    if (cfdata->exec) 
-     dir = ecore_file_dir_get(cfdata->exec);
+     {
+       path = ecore_file_dir_get(cfdata->exec);
+       if (path && !ecore_file_exists(path))
+         {
+            free(path);
+            path = NULL;
+         }
+     }
 
-   if (dir)
+   if (path)
      {
-       o = e_widget_fsel_add(dia->win->evas, dir, "/", NULL, NULL,
+       o = e_widget_fsel_add(dia->win->evas, "/", path, NULL, NULL,
                              _e_desktop_edit_select_cb, cfdata,
                              NULL, cfdata, 1);
-       free(dir);
+       free(path);
      }
    else
      {
-       o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL,
+       o = e_widget_fsel_add(dia->win->evas, "/", "~/", NULL, NULL,
                              _e_desktop_edit_select_cb, cfdata,
                              NULL, cfdata, 1);
      }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -3 -r1.223 -r1.224
--- e_fm.c      24 Oct 2007 18:25:44 -0000      1.223
+++ e_fm.c      27 Oct 2007 15:55:27 -0000      1.224
@@ -451,7 +451,7 @@
 {
    E_Fm2_Smart_Data *sd;
    Evas_List *l;
-   const char *realpath;
+   const char *realpath, *extended_path;
 
    sd = evas_object_smart_data_get(obj);
    if (!sd || !path) return; // safety
@@ -489,7 +489,12 @@
        sd->config->theme.fixed = 0;
      }
    
-   realpath = _e_fm2_dev_path_map(dev, path);
+   if (!strcmp(path, "~/")) 
+     extended_path = e_user_homedir_get();
+   else 
+     extended_path = path;
+
+   realpath = _e_fm2_dev_path_map(dev, extended_path);
    /* If the path doesn't exist, popup a dialog */
    if (dev && strncmp(dev, "removable:", 10)
        && !ecore_file_exists(realpath))
@@ -530,7 +535,7 @@
    sd->order_file = 0;
    
    if (dev) sd->dev = evas_stringshare_add(dev);
-   if (path) sd->path = evas_stringshare_add(path);
+   if (path) sd->path = evas_stringshare_add(extended_path);
    sd->realpath = realpath;
    _e_fm2_queue_free(obj);
    _e_fm2_regions_free(obj);
@@ -739,9 +744,11 @@
    if (!sd->path) return;
    path = strdup(sd->path);
    if (sd->dev) dev = strdup(sd->dev);
-   p = strrchr(path, '/');
-   if (p) *p = 0;
-   e_fm2_path_set(obj, dev, path);
+   if ((p = strrchr(path, '/'))) *p = 0;
+   if (*path == 0)
+     e_fm2_path_set(obj, dev, "/");
+   else
+     e_fm2_path_set(obj, dev, path);
    E_FREE(dev);
    E_FREE(path);
 }
@@ -3888,7 +3895,7 @@
    ic->info.icon = NULL;
    ic->info.link = NULL;
    //Hack
-   if (!strncmp(ic->info.file, "|storage_serial_", 16)) ecore_file_unlink(buf);
+   if (!strncmp(ic->info.file, "|storage_", 9)) ecore_file_unlink(buf);
    return 0;
 }
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to