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: Add some command line options. --album-slideshow does a slideshow of an album. --album-presentation does a presentation of an album. --load-album loads an album. =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- ephoto.c 8 Apr 2006 22:21:48 -0000 1.39 +++ ephoto.c 8 Apr 2006 23:12:48 -0000 1.40 @@ -21,12 +21,14 @@ int argloop = 0; int argfit = 0; int argfullscreen = 0; -int argload = 0; +int arglload = 0; +int argviewi = 0; char *audios; char buf[PATH_MAX]; char argimage[PATH_MAX]; char argaudio[PATH_MAX]; char argheight[PATH_MAX] = "480"; +char argload[PATH_MAX]; char argwidth[PATH_MAX] = "600"; char tempdb[PATH_MAX]; char db[PATH_MAX]; @@ -64,6 +66,16 @@ mainwin = 0; nopresent = 0; } + if ( argint < argc && !strcmp(argv[argint], "--album-slideshow") && noslide != 0 ) { + int imageint; + char *albuma; + imageint = argint; + imageint++; + albuma = argv[imageint]; + create_list_cb(NULL, NULL, albuma); + mainwin = 0; + nopresent = 0; + } if ( argint < argc && !strcmp(argv[argint], "--slideshow-dir") && noslide != 0 ) { int imageint; Ecore_List *image_list; @@ -150,11 +162,22 @@ mainwin = 0; noslide = 0; } + else if ( argint < argc && !strcmp(argv[argint], "--album-presentation") && nopresent != 0 ) { + int imageint; + char *albuma; + imageint = argint; + imageint++; + albuma = argv[imageint]; + create_list_cb(NULL, NULL, albuma); + mainwin = 0; + noslide = 0; + } else if ( argint < argc && !strcmp(argv[argint], "--view-image") ) { int imageint; imageint = argint; imageint++; snprintf(argimage, PATH_MAX, "%s", argv[imageint]); + argviewi = 1; } else if ( argint < argc && !strcmp(argv[argint], "--audio") ) { int imageint; @@ -187,20 +210,31 @@ else if ( argint < argc && !strcmp(argv[argint], "--fullscreen") ) { argfullscreen = 1; } + else if ( argint < argc && !strcmp(argv[argint], "--load-album") ) { + int imageint; + imageint = argint; + imageint++; + snprintf(argload, PATH_MAX, "%s", argv[imageint]); + arglload = 1; + } else if ( argint < argc && !strcmp(argv[argint], "--help") ) { - printf("ephoto /path/to/dir loads /path/to/dir as default directory\n"); - printf("ephoto --audio /path/to/audio sets /path/to/audio as default audio for slideshow\n"); - printf("ephoto --fit-to-audio sets the slideshow to fit audio\n"); - printf("ephoto --fullscreen sets the presentation/slideshow window to be fullscreen\n"); - printf("ephoto --help displays all available options\n"); - printf("ephoto --length slidelength sets the integer slidelength(seconds) as the transition time for slideshow\n"); - printf("ephoto --loop sets the slideshow to loop\n"); - printf("ephoto --presentation-dir /path/to/dir loads every image from /path/to/dir into a presentation\n"); - printf("ephoto --presentation /path/to/image /path/to/image /path/to/image starts the presentation using the specified images\n"); - printf("ephoto --slideshow-dir /path/to/dir loads every image from /path/to/dir into a slideshow\n"); - printf("ephoto --slideshow /path/to/image /path/to/image /path/to/image starts the slideshow using the specified images\n"); - printf("ephoto --view-image /path/to/image sets /path/to/image as the default image in the image viewer tab.\n"); - printf("ephoto --win-size integer integer sets the first integer as the width and the second integer as the height of the presentation/slideshow window\n"); + printf("ephoto /path/to/dir loads /path/to/dir as default directory | " + "ephoto --album-slideshow album does a slideshow of album. No " + "need to specify a path. Just put the basename of the album. | " + "ephoto --audio /path/to/audio sets /path/to/audio as default audio for slideshow | " + "ephoto --fit-to-audio sets the slideshow to fit audio | ephoto --fullscreen sets " + "the presentation/slideshow window to be fullscreen | ephoto --help displays all available options | " + "ephoto --length slidelength sets the integer slidelength(seconds) as the transition time for slideshow | " + "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 | " + "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 " + "/path/to/dir into a slideshow | ephoto --slideshow /path/to/image /path/to/image /path/to/image " + "starts the slideshow using the specified images | ephoto --view-image /path/to/image sets " + "/path/to/image as the default image in the image viewer tab. | ephoto --win-size integer1 " + "integer2 sets the first integer as the width and the second integer as the height of the " + "presentation/slideshow window\n"); mainwin = 0; } argint++; @@ -620,6 +654,15 @@ /************LETS POPULATE THEM TREES******************/ ewl_callback_call(m->directory, EWL_CALLBACK_VALUE_CHANGED); /******************************************************/ + if ( arglload == 1 ) { + load_cb(NULL, NULL, NULL); + } + if ( argviewi == 0 ) { + ewl_notebook_visible_page_set(EWL_NOTEBOOK(m->notebook), m->vbox2); + } + if ( argviewi == 1 ) { + ewl_notebook_visible_page_set(EWL_NOTEBOOK(m->notebook), m->viewbox); + } ewl_main(); return 0; } =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/ephoto.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- ephoto.h 7 Apr 2006 13:18:21 -0000 1.17 +++ ephoto.h 8 Apr 2006 23:12:48 -0000 1.18 @@ -44,6 +44,7 @@ void load_cb(Ewl_Widget *w, void *event, void *data); void reseti_cb(Ewl_Widget *w, void *event, void *data); void reseta_cb(Ewl_Widget *w, void *event, void *data); +void create_list_cb(Ewl_Widget *w, void *event, void *data); typedef struct _Main Main; typedef struct _Slide Slide; @@ -150,6 +151,8 @@ extern int argfit; extern int argfullscreen; extern int argloop; +extern int arglload; +extern char argload[PATH_MAX]; extern char argwidth[PATH_MAX]; extern char argheight[PATH_MAX]; extern char *audios; =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_misc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ephoto_misc.c 8 Apr 2006 22:19:43 -0000 1.14 +++ ephoto_misc.c 8 Apr 2006 23:12:48 -0000 1.15 @@ -332,8 +332,12 @@ char homepath[PATH_MAX]; char *apath; FILE *file_ptr; - - apath = ewl_text_text_get(EWL_TEXT(m->otext)); + if ( arglload == 0 ) { + apath = ewl_text_text_get(EWL_TEXT(m->otext)); + } + if ( arglload == 1 ) { + apath = argload; + } snprintf(homepath, PATH_MAX, "%s/.e/ephoto/%s", home, apath); printf("%s\n", homepath); @@ -385,6 +389,36 @@ ewl_widget_destroy(m->load_win); } +void create_list_cb(Ewl_Widget *w, void *event, void *data) +{ + char *home = getenv("HOME"); + char homepath[PATH_MAX]; + char *apath; + FILE *file_ptr; + + apath = data; + + snprintf(homepath, PATH_MAX, "%s/.e/ephoto/%s", home, apath); + + file_ptr = fopen(homepath, "r"); + + if (file_ptr != NULL) { + char paths[PATH_MAX]; + + while (fgets(paths,PATH_MAX,file_ptr)!=NULL) { + char path2[PATH_MAX]; + int strleng; + + strleng = strlen(paths); + + snprintf(path2, strleng, "%s", paths); + + ecore_dlist_append(m->imagelist, strdup(path2)); + } + fclose(file_ptr); + } +} + void reseti_cb(Ewl_Widget *w, void *event, void *data) { ewl_widget_destroy(m->ib); @@ -395,7 +429,6 @@ 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); - } void reseta_cb(Ewl_Widget *w, void *event, void *data) ------------------------------------------------------- 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