Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src


Modified Files:
        ephoto.c ephoto.h ephoto_misc.c 


Log Message:

First step towards onefanginizing ephoto.  From the actions menu, you can now 
add
every single image from a directory.  You can also add every single image from a
directory by calling ephoto /path/to/dir --load-dir-images from the command 
line.

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- ephoto.c    13 Apr 2006 03:31:33 -0000      1.42
+++ ephoto.c    18 Apr 2006 03:09:25 -0000      1.43
@@ -23,6 +23,7 @@
 int argfullscreen = 0;
 int arglload = 0;
 int argviewi = 0;
+int argloadidir = 0;
 char *audios;
 char buf[PATH_MAX];
 char argimage[PATH_MAX];
@@ -221,6 +222,9 @@
                        snprintf(argload, PATH_MAX, "%s", argv[imageint]);
                        arglload = 1;
                }
+               else if ( argint < argc && !strcmp(argv[argint], 
"--load-dir-images") ) {
+                       argloadidir = 1;
+               }
                else if ( argint < argc && !strcmp(argv[argint], "--help") ) {
                        printf("ephoto /path/to/dir loads /path/to/dir as 
default directory | " 
                               "ephoto --album-slideshow album does a slideshow 
of album. No "
@@ -231,7 +235,9 @@
                               "ephoto --length slidelength sets the integer 
slidelength(seconds) as the transition time for slideshow | "
                                "ephoto --list_albums lists all of your albums. 
| "
                                "ephoto --load-album album opens ephoto with 
album showing. No need to specify a path. "
-                              "Just put the basename of the album. | ephoto 
--loop sets the slideshow to loop | "
+                              "Just put the basename of the album. | ephoto 
--load-dir-images loads every image specified "
+                               "from ephoto /path/to/dir or from your home dir 
if no dir is specified, into the content "
+                               "window | ephoto --loop sets the slideshow to 
loop | "
                               "ephoto --presentation-dir /path/to/dir loads 
every image from /path/to/dir into a presentation | "
                               "ephoto --presentation /path/to/image 
/path/to/image /path/to/image starts the presentation using "
                               "the specified images | ephoto --slideshow-dir 
/path/to/dir loads every image from "
@@ -310,6 +316,12 @@
                ewl_widget_show(m->menu);
 
                m->menu_item = ewl_menu_item_new();
+                ewl_button_label_set(EWL_BUTTON(m->menu_item), "Add All Images 
from Dir");
+                ewl_container_child_append(EWL_CONTAINER(m->menu), 
m->menu_item);
+                ewl_callback_append(m->menu_item, EWL_CALLBACK_CLICKED, addi, 
NULL);
+                ewl_widget_show(m->menu_item);
+
+               m->menu_item = ewl_menu_item_new();
                 ewl_button_label_set(EWL_BUTTON(m->menu_item), "Reset Images");
                 ewl_container_child_append(EWL_CONTAINER(m->menu), 
m->menu_item);
                 ewl_callback_append(m->menu_item, EWL_CALLBACK_CLICKED, 
reseti_cb, NULL);
@@ -445,15 +457,17 @@
                ewl_object_alignment_set(EWL_OBJECT(m->content), 
EWL_FLAG_ALIGN_CENTER);
                ewl_widget_show(m->content);
 
-               m->iscroll = ewl_scrollpane_new();
-               ewl_container_child_append(EWL_CONTAINER(m->content), 
m->iscroll);
-               ewl_widget_show(m->iscroll);
-
                m->ib = ewl_freebox_new();
                ewl_freebox_layout_type_set(EWL_FREEBOX(m->ib), 
EWL_FREEBOX_LAYOUT_AUTO);
-               ewl_container_child_append(EWL_CONTAINER(m->iscroll), m->ib);
                ewl_widget_show(m->ib);
 
+               m->iscroll = ewl_scrollpane_new();
+                ewl_container_child_append(EWL_CONTAINER(m->content), 
m->iscroll);
+                ewl_object_fill_policy_set(EWL_OBJECT(m->iscroll), 
EWL_FLAG_FILL_ALL);
+                ewl_widget_show(m->iscroll);
+               
+               ewl_container_child_append(EWL_CONTAINER(m->iscroll), m->ib);   
        
+
                m->settings = ewl_border_new();
                ewl_border_text_set(EWL_BORDER(m->settings), "Settings");
                ewl_border_label_alignment_set(EWL_BORDER(m->settings), 
EWL_FLAG_ALIGN_CENTER);
@@ -667,6 +681,9 @@
                }
                if ( argviewi == 1 ) {
                        
ewl_notebook_visible_page_set(EWL_NOTEBOOK(m->notebook), m->viewbox);
+               }
+               if ( argloadidir == 1 ) {
+                       addi(NULL, NULL, NULL);
                }
                ewl_main();
        return 0;
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ephoto.h    10 Apr 2006 21:41:06 -0000      1.19
+++ ephoto.h    18 Apr 2006 03:09:25 -0000      1.20
@@ -46,6 +46,7 @@
 void reseta_cb(Ewl_Widget *w, void *event, void *data);
 void create_list_cb(Ewl_Widget *w, void *event, void *data);
 void list_albums_cb(Ewl_Widget *w, void *event, void *data);
+void addi(Ewl_Widget *w, void *event, void *data);
 
 typedef struct _Main Main;
 typedef struct _Slide Slide;
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_misc.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ephoto_misc.c       10 Apr 2006 21:41:06 -0000      1.16
+++ ephoto_misc.c       18 Apr 2006 03:09:25 -0000      1.17
@@ -451,3 +451,67 @@
                printf("%s\n", path2);
        }
 }
+
+void addi(Ewl_Widget *w, void *event, void *data)
+{
+       char *path;
+       char *path4;
+       char *pathi;
+       char path2[PATH_MAX];
+       char path3[PATH_MAX];
+       Ecore_List *dirifiles;
+       Ecore_List *imagefiles;
+
+       dirifiles = ecore_list_new();
+       imagefiles = ecore_list_new();
+
+       path = ewl_text_text_get(EWL_TEXT(m->directory));
+
+       if ( ecore_file_is_dir(path) ) {
+               if (path[strlen(path)-1] != '/') {
+                       snprintf(path2, PATH_MAX, "%s/", path);
+                }
+                else {
+                        snprintf(path2, PATH_MAX, "%s", path);
+                }
+                       
+               dirifiles = ecore_file_ls(path2);
+
+               while ( !ecore_list_is_empty(dirifiles) ) {
+                       path4 = ecore_list_remove_first(dirifiles);
+                        snprintf(path3, PATH_MAX, "%s%s", path2, path4);
+                       if ( fnmatch("*.[Pp][Nn][Gg]", path3, 0) == 0 ) {
+                                ecore_list_append(imagefiles, strdup(path3));
+                        }
+                        if ( fnmatch("*.[Jj][Pp][Gg]", path3, 0) == 0 ) {
+                                ecore_list_append(imagefiles, strdup(path3));
+                        }
+                        if ( fnmatch("*.[Jj][Pp][Ee][Gg]", path3, 0) == 0 ) {
+                                ecore_list_append(imagefiles, strdup(path3));
+                        }
+                        if ( fnmatch("*.[Bb][Mm][Pp]", path3, 0) == 0 ) {
+                                ecore_list_append(imagefiles, strdup(path3));
+                        }
+                        if ( fnmatch(".[Ss][Vv][Gg]", path3, 0) == 0 ) {
+                                ecore_list_append(imagefiles, strdup(path3));
+                        }
+               }
+               while ( !ecore_list_is_empty(imagefiles) ) {
+                       pathi = ecore_list_remove_first(imagefiles);
+
+                       m->i = ewl_image_thumbnail_new();
+                       ewl_widget_name_set(m->i, pathi);
+                       ewl_image_constrain_set(EWL_IMAGE(m->i), 64);
+                       ewl_image_proportional_set(EWL_IMAGE(m->i), TRUE);
+                               ewl_image_thumbnail_request(EWL_IMAGE(m->i), 
pathi);
+                       ewl_image_file_set(EWL_IMAGE(m->i), PACKAGE_DATA_DIR 
"images/camera.png", NULL);
+                       ewl_container_child_append(EWL_CONTAINER(m->ib), m->i);
+                       ewl_callback_append(m->i, EWL_CALLBACK_CLICKED, 
iremove_cb, NULL);
+                       ewl_widget_show(m->i);
+                
+                       ecore_dlist_append(m->imagelist, strdup(pathi));
+                       slidenum++;
+               }
+       }
+}
+




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to