Enlightenment CVS committal Author : titansoccer15 Project : e17 Module : proto
Dir : e17/proto/ephoto/src Modified Files: ephoto_browsing.c Log Message: Dummy fix. Now if a user puts anything but a valid directory in the entry box, it is ignored. =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/ephoto/src/ephoto_browsing.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ephoto_browsing.c 20 Feb 2006 22:41:19 -0000 1.2 +++ ephoto_browsing.c 21 Feb 2006 00:05:11 -0000 1.3 @@ -1,5 +1,5 @@ #include "ephoto.h" - + void populatei_cb(Ewl_Widget *w, void *event, void *data) { @@ -15,24 +15,11 @@ char path[PATH_MAX]; char *temp; char *up = ".."; + /****Get home directory****/ + char *home = getenv("HOME"); + /**************************/ /*****************************/ - - /**********Get the lists going!***********/ - imagefiles = ecore_list_new(); - files = ecore_list_new(); - /*****************************************/ - - /************Get the tree ready!***********/ - ewl_widget_destroy(m->imagetree); - - m->imagetree = ewl_tree_new(1); - ewl_container_child_append(EWL_CONTAINER(m->images), m->imagetree); - ewl_object_maximum_size_set(EWL_OBJECT(m->imagetree), 200, 160); - ewl_widget_show(m->imagetree); - - /******************************************/ - /*****Find out what directory we want to look in******/ if (w == m->directory) { @@ -44,32 +31,7 @@ } ewl_text_text_set(EWL_TEXT(m->directory), pathi); - /****************************************************/ - - /*********Lets setup the parent dir row**********/ - m->hbox = ewl_hbox_new(); - ewl_box_spacing_set(EWL_BOX(m->hbox), 5); - ewl_widget_show(m->hbox); - - m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/up.png", NULL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); - ewl_widget_show(m->image); - - m->texti = ewl_text_new(); - ewl_widget_name_set(m->texti, pathi); - ewl_text_text_set(EWL_TEXT(m->texti), up); - ewl_object_minimum_size_set(EWL_OBJECT(m->texti), 10, 16); - ewl_object_fill_policy_set(EWL_OBJECT(m->texti), EWL_FLAG_FILL_ALL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->texti); - ewl_widget_show(m->texti); - - m->children[0] = m->hbox; - m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); - ewl_callback_append(m->texti, EWL_CALLBACK_CLICKED, up_cb, NULL); - - /*****************************************************************/ + /****************************************************/ /****Lets make sure we have a trailing / ******/ snprintf(fn, PATH_MAX, "%s", pathi); @@ -87,95 +49,139 @@ /**********************************************/ /***********Populate the tree with directorys*********/ - files = ecore_file_ls(pathf); + if ( ecore_file_is_dir(pathf) ) { + + /**********Get the lists going!***********/ + imagefiles = ecore_list_new(); + files = ecore_list_new(); + /*****************************************/ - while(!ecore_list_is_empty(files)) { + /************Get the tree ready!***********/ - temp = ecore_list_remove_first(files); - snprintf(path, PATH_MAX, "%s", pathf); - - if (path[strlen(path)-1] != '/') { - snprintf(pathg, PATH_MAX, "%s/", path); - } + ewl_widget_destroy(m->imagetree); + + m->imagetree = ewl_tree_new(1); + ewl_container_child_append(EWL_CONTAINER(m->images), m->imagetree); + ewl_object_maximum_size_set(EWL_OBJECT(m->imagetree), 200, 160); + ewl_widget_show(m->imagetree); - else { - snprintf(pathg, PATH_MAX, "%s", path); - } + /******************************************/ + + /*********Lets setup the parent dir row**********/ + m->hbox = ewl_hbox_new(); + ewl_box_spacing_set(EWL_BOX(m->hbox), 5); + ewl_widget_show(m->hbox); - snprintf(pathw, PATH_MAX, "%s%s", pathg, temp); + m->image = ewl_image_new(); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/up.png", NULL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); + ewl_widget_show(m->image); - printf("%s\n", pathw); + m->texti = ewl_text_new(); + ewl_widget_name_set(m->texti, pathi); + ewl_text_text_set(EWL_TEXT(m->texti), up); + ewl_object_minimum_size_set(EWL_OBJECT(m->texti), 10, 16); + ewl_object_fill_policy_set(EWL_OBJECT(m->texti), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->texti); + ewl_widget_show(m->texti); - if ( fnmatch("*.[Pp][Nn][Gg]", pathw, 0) == 0 ) { - ecore_list_append(imagefiles, strdup(pathw)); - printf("%s\n", pathw); - } - if ( fnmatch("*.[Jj][Pp][Gg]", pathw, 0) == 0 ) { - ecore_list_append(imagefiles, strdup(pathw)); - printf("%s\n", pathw); - } - - bname = basename(pathw); + m->children[0] = m->hbox; + m->children[1] = NULL; + m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); + ewl_callback_append(m->texti, EWL_CALLBACK_CLICKED, up_cb, NULL); + + /*****************************************************************/ - if (ecore_file_is_dir(pathw) && *bname != '.') { + files = ecore_file_ls(pathf); + + while(!ecore_list_is_empty(files)) { + + temp = ecore_list_remove_first(files); + snprintf(path, PATH_MAX, "%s", pathf); + + if (path[strlen(path)-1] != '/') { + snprintf(pathg, PATH_MAX, "%s/", path); + } + + else { + snprintf(pathg, PATH_MAX, "%s", path); + } + + snprintf(pathw, PATH_MAX, "%s%s", pathg, temp); + printf("%s\n", pathw); + + if ( fnmatch("*.[Pp][Nn][Gg]", pathw, 0) == 0 ) { + ecore_list_append(imagefiles, strdup(pathw)); + printf("%s\n", pathw); + } + if ( fnmatch("*.[Jj][Pp][Gg]", pathw, 0) == 0 ) { + ecore_list_append(imagefiles, strdup(pathw)); + printf("%s\n", pathw); + } + + bname = basename(pathw); + + if (ecore_file_is_dir(pathw) && *bname != '.') { + + m->hbox = ewl_hbox_new(); + ewl_box_spacing_set(EWL_BOX(m->hbox), 5); + ewl_widget_show(m->hbox); + + m->image = ewl_image_new(); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/folder.png", NULL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); + ewl_widget_show(m->image); + + m->text = ewl_text_new(); + ewl_widget_name_set(m->text, pathw); + ewl_text_text_set(EWL_TEXT(m->text), bname); + ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); + ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); + ewl_widget_show(m->text); + + m->children[0] = m->hbox; + m->children[1] = NULL; + m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); + ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, populatei_cb, NULL); + } + } + /****************************************************************************/ + + /************Populate Image files********************/ + while( !ecore_list_is_empty(imagefiles) ) { + itemp = ecore_list_remove_first(imagefiles); + + bname2 = basename(itemp); + m->hbox = ewl_hbox_new(); ewl_box_spacing_set(EWL_BOX(m->hbox), 5); ewl_widget_show(m->hbox); m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/folder.png", NULL); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/camera.png", NULL); ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); ewl_widget_show(m->image); - + m->text = ewl_text_new(); - ewl_widget_name_set(m->text, pathw); - ewl_text_text_set(EWL_TEXT(m->text), bname); - ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); + ewl_widget_name_set(m->text, itemp); + ewl_text_text_set(EWL_TEXT(m->text), bname2); + ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); ewl_widget_show(m->text); - + m->children[0] = m->hbox; m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); - ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, populatei_cb, NULL); - } + m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); + ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, images_cb, NULL); + free(itemp); + } + /***********************************************************************/ + ecore_list_destroy(files); + ecore_list_destroy(imagefiles); } - /****************************************************************************/ - - /************Populate Image files********************/ - while( !ecore_list_is_empty(imagefiles) ) { - itemp = ecore_list_remove_first(imagefiles); - - bname2 = basename(itemp); - - m->hbox = ewl_hbox_new(); - ewl_box_spacing_set(EWL_BOX(m->hbox), 5); - ewl_widget_show(m->hbox); - - m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/camera.png", NULL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); - ewl_widget_show(m->image); - - m->text = ewl_text_new(); - ewl_widget_name_set(m->text, itemp); - ewl_text_text_set(EWL_TEXT(m->text), bname2); - ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); - ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); - ewl_widget_show(m->text); - - m->children[0] = m->hbox; - m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->imagetree), NULL, m->children); - ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, images_cb, NULL); - free(itemp); - } - /***********************************************************************/ - ecore_list_destroy(files); - ecore_list_destroy(imagefiles); } void @@ -195,21 +201,6 @@ char *up = ".."; /*************************/ - /********Prepare the lists********/ - audiofiles = ecore_list_new(); - files = ecore_list_new(); - /*********************************/ - - /**********Prepare the tree************/ - ewl_widget_destroy(m->audiotree); - - m->audiotree = ewl_tree_new(1); - ewl_container_child_append(EWL_CONTAINER(m->songs), m->audiotree); - ewl_object_maximum_size_set(EWL_OBJECT(m->audiotree), 200, 160); - ewl_widget_show(m->audiotree); - - /*************************************/ - /*******Lets find out what directory we are workin with******/ if (w == m->directorya) { pathi = ewl_text_text_get(EWL_TEXT(w)); @@ -223,31 +214,6 @@ /***********************************************************/ - /*****Setup parent directory row*****/ - m->hbox = ewl_hbox_new(); - ewl_box_spacing_set(EWL_BOX(m->hbox), 5); - ewl_widget_show(m->hbox); - - m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/up.png", NULL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); - ewl_widget_show(m->image); - - m->texta = ewl_text_new(); - ewl_widget_name_set(m->texta, pathi); - ewl_text_text_set(EWL_TEXT(m->texta), up); - ewl_object_minimum_size_set(EWL_OBJECT(m->texta), 10, 16); - ewl_object_fill_policy_set(EWL_OBJECT(m->texta), EWL_FLAG_FILL_ALL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->texta); - ewl_widget_show(m->texta); - - m->children[0] = m->hbox; - m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); - ewl_callback_append(m->texta, EWL_CALLBACK_CLICKED, up_cb, NULL); - - /******************************************************************/ - /***********Make sure there is a trailing / *************/ snprintf(fn, PATH_MAX, "%s", pathi); @@ -263,90 +229,130 @@ /********Add the directories to the tree!***********/ - files = ecore_file_ls(pathf); - - while(!ecore_list_is_empty(files)) { - - temp = ecore_list_remove_first(files); - snprintf(path, PATH_MAX, "%s", pathf); - - if (path[strlen(path)-1] != '/') { - snprintf(pathg, PATH_MAX, "%s/", path); - } - - else { - snprintf(pathg, PATH_MAX, "%s", path); - } + if ( ecore_file_is_dir(pathf) ) { + /********Prepare the lists********/ + audiofiles = ecore_list_new(); + files = ecore_list_new(); + /*********************************/ + + /**********Prepare the tree************/ + ewl_widget_destroy(m->audiotree); + + m->audiotree = ewl_tree_new(1); + ewl_container_child_append(EWL_CONTAINER(m->songs), m->audiotree); + ewl_object_maximum_size_set(EWL_OBJECT(m->audiotree), 200, 160); + ewl_widget_show(m->audiotree); + + /*************************************/ + + /*****Setup parent directory row*****/ + m->hbox = ewl_hbox_new(); + ewl_box_spacing_set(EWL_BOX(m->hbox), 5); + ewl_widget_show(m->hbox); - snprintf(pathw, PATH_MAX, "%s%s", pathg, temp); + m->image = ewl_image_new(); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/up.png", NULL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); + ewl_widget_show(m->image); - printf("%s\n", pathw); + m->texta = ewl_text_new(); + ewl_widget_name_set(m->texta, pathi); + ewl_text_text_set(EWL_TEXT(m->texta), up); + ewl_object_minimum_size_set(EWL_OBJECT(m->texta), 10, 16); + ewl_object_fill_policy_set(EWL_OBJECT(m->texta), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->texta); + ewl_widget_show(m->texta); - if ( fnmatch("*.[Mm][Pp][3]", pathw, 0) == 0 ) { - ecore_list_append(audiofiles, strdup(pathw)); + m->children[0] = m->hbox; + m->children[1] = NULL; + m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); + ewl_callback_append(m->texta, EWL_CALLBACK_CLICKED, up_cb, NULL); + + files = ecore_file_ls(pathf); + + while(!ecore_list_is_empty(files)) { + + temp = ecore_list_remove_first(files); + snprintf(path, PATH_MAX, "%s", pathf); + + if (path[strlen(path)-1] != '/') { + snprintf(pathg, PATH_MAX, "%s/", path); + } + + else { + snprintf(pathg, PATH_MAX, "%s", path); + } + + snprintf(pathw, PATH_MAX, "%s%s", pathg, temp); + printf("%s\n", pathw); - } - - bname = basename(pathw); - - if (ecore_file_is_dir(pathw) && *bname != '.') { + if ( fnmatch("*.[Mm][Pp][3]", pathw, 0) == 0 ) { + ecore_list_append(audiofiles, strdup(pathw)); + printf("%s\n", pathw); + } + + bname = basename(pathw); + + if (ecore_file_is_dir(pathw) && *bname != '.') { + + m->hbox = ewl_hbox_new(); + ewl_box_spacing_set(EWL_BOX(m->hbox), 5); + ewl_widget_show(m->hbox); + + m->image = ewl_image_new(); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/folder.png", NULL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); + ewl_widget_show(m->image); + + m->text = ewl_text_new(); + ewl_widget_name_set(m->text, pathw); + ewl_text_text_set(EWL_TEXT(m->text), bname); + ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); + ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); + ewl_widget_show(m->text); + + m->children[0] = m->hbox; + m->children[1] = NULL; + m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); + ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, populatea_cb, NULL); + } + } + /**********************************************************************/ + /*************Add the audio file to the slideshow**************/ + while( !ecore_list_is_empty(audiofiles) ) { + itemp = ecore_list_remove_first(audiofiles); + + bname2 = basename(itemp); + m->hbox = ewl_hbox_new(); ewl_box_spacing_set(EWL_BOX(m->hbox), 5); ewl_widget_show(m->hbox); m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/folder.png", NULL); + ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/audio.png", NULL); ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); ewl_widget_show(m->image); - + m->text = ewl_text_new(); - ewl_widget_name_set(m->text, pathw); - ewl_text_text_set(EWL_TEXT(m->text), bname); - ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); + ewl_widget_name_set(m->text, itemp); + ewl_text_text_set(EWL_TEXT(m->text), bname2); + ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); ewl_widget_show(m->text); m->children[0] = m->hbox; m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); - ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, populatea_cb, NULL); - } - } - /**********************************************************************/ - /*************Add the audio file to the slideshow**************/ - while( !ecore_list_is_empty(audiofiles) ) { - itemp = ecore_list_remove_first(audiofiles); - - bname2 = basename(itemp); - - m->hbox = ewl_hbox_new(); - ewl_box_spacing_set(EWL_BOX(m->hbox), 5); - ewl_widget_show(m->hbox); - - m->image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(m->image), PACKAGE_DATA_DIR "/images/audio.png", NULL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->image); - ewl_widget_show(m->image); - - m->text = ewl_text_new(); - ewl_widget_name_set(m->text, itemp); - ewl_text_text_set(EWL_TEXT(m->text), bname2); - ewl_object_minimum_size_set(EWL_OBJECT(m->text), 10, 16); - ewl_object_fill_policy_set(EWL_OBJECT(m->text), EWL_FLAG_FILL_ALL); - ewl_container_child_append(EWL_CONTAINER(m->hbox), m->text); - ewl_widget_show(m->text); - - m->children[0] = m->hbox; - m->children[1] = NULL; - m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); - ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, audio_cb, NULL); - free(itemp); - } - /**********************************************************************/ + m->row = ewl_tree_row_add(EWL_TREE(m->audiotree), NULL, m->children); + ewl_callback_append(m->text, EWL_CALLBACK_CLICKED, audio_cb, NULL); + free(itemp); + } + /**********************************************************************/ ecore_list_destroy(files); ecore_list_destroy(audiofiles); + } } ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs