Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin/tests


Modified Files:
        ewl_image.c 


Log Message:
get the filename of the image with the absolute path

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/ewl_image.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_image.c 22 May 2006 18:09:00 -0000      1.7
+++ ewl_image.c 24 May 2006 18:20:07 -0000      1.8
@@ -344,14 +344,33 @@
   
        e = ev;
 
-       if (e->response == EWL_STOCK_OPEN) {
+       if (e->response == EWL_STOCK_OK) {
                char *path;
+               char *filename;
+               char *file;
+               int   l1;
+               int   l2;
 
-               printf("File open from image test: %s\n", 
-               path = ewl_filedialog_selected_file_get (EWL_FILEDIALOG (w)));
-               if (path) {
-                       ewl_text_text_set(EWL_TEXT(entry), path);
+               path = ewl_filedialog_directory_get (EWL_FILEDIALOG (w));
+               filename = ewl_filedialog_selected_file_get (EWL_FILEDIALOG 
(w));
+               l1 = strlen (path);
+               l2 = strlen (filename);
+
+               if (!path || (path[0] == '\0'))
+                       file = strdup (filename);
+               else {
+                       file = (char *)malloc (sizeof (char) * (l1 + l2 + 2));
+                       memcpy (file, path, l1);
+                       file[l1] = '/';
+                       memcpy (file + l1 + 1, filename, l2);
+                       file [l1 + l2 + 1] = '\0';
+               }
+
+               printf("File open from image test: %s\n", file);
+               if (file) {
+                       ewl_text_text_set(EWL_TEXT(entry), file);
                        image_load();
+                       free (file);
                        // free(path); FIXME: Is text widget allocated 
correctly?
                }
        }




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to