Enlightenment CVS committal Author : titan Project : e17 Module : proto
Dir : e17/proto/ephoto/src Modified Files: ephoto_callbacks.c Log Message: Whoops forgot a file. =================================================================== RCS file: /cvs/e/e17/proto/ephoto/src/ephoto_callbacks.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- ephoto_callbacks.c 9 Oct 2006 03:22:36 -0000 1.34 +++ ephoto_callbacks.c 24 Oct 2006 15:34:27 -0000 1.35 @@ -1,4 +1,5 @@ #include "ephoto.h" +Ewl_Widget *entry_t, *entry_d; void destroy_cb(Ewl_Widget *w, void *event, void *data) { @@ -12,60 +13,6 @@ return; } -void populate_albums(Ewl_Widget *w, void *event, void *data) -{ - char *album; - char *home; - char path[PATH_MAX]; - char full_path[PATH_MAX]; - Ecore_List *albums; - Ewl_Widget *hbox; - Ewl_Widget *image; - Ewl_Widget *text; - Ewl_Widget *children[2]; - Ewl_Widget *row; - - home = getenv("HOME"); - snprintf(path, PATH_MAX, "%s/.ephoto", home); - - if (!ecore_file_exists(path)) ecore_file_mkdir(path); - - albums = ecore_list_new(); - albums = ecore_file_ls(path); - - while(!ecore_list_is_empty(albums)) - { - album = ecore_list_remove_first(albums); - snprintf(full_path, PATH_MAX, "%s/%s", path, album); - - hbox = ewl_hbox_new(); - ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER); - ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL); - ewl_box_spacing_set(EWL_BOX(hbox), 5); - ewl_widget_show(hbox); - - image = ewl_image_new(); - ewl_image_file_set(EWL_IMAGE(image), - PACKAGE_DATA_DIR "/images/image.png", NULL); - ewl_container_child_append(EWL_CONTAINER(hbox), image); - ewl_widget_show(image); - - text = ewl_text_new(); - ewl_text_text_set(EWL_TEXT(text), album); - ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER); - ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK); - ewl_container_child_append(EWL_CONTAINER(hbox), text); - ewl_widget_show(text); - - children[0] = hbox; - children[1] = NULL; - - row = ewl_tree_row_add(EWL_TREE(m->albums), NULL, children); - ewl_callback_append(row, EWL_CALLBACK_CLICKED, populate_images, NULL); - ewl_widget_name_set(row, full_path); - } -} - void populate_browser(Ewl_Widget *w, void *event, void *data) { char *directory; @@ -73,12 +20,8 @@ char full_path[PATH_MAX]; Ecore_List *ls; Ecore_List *directories; - Ewl_Widget *hbox; - Ewl_Widget *image; - Ewl_Widget *text; - Ewl_Widget *children[2]; - Ewl_Widget *row; - + Ewl_Widget *hbox, *image, *text, *children[2], *row; + directory = data; current_directory = strdup(directory); ewl_text_text_set(EWL_TEXT(m->entry), current_directory); @@ -180,23 +123,6 @@ } } } - else - { - ewl_container_reset(EWL_CONTAINER(m->viewer_freebox)); - file_ptr = fopen(dir, "r"); - if (file_ptr != NULL) - { - while(fgets(text,PATH_MAX,file_ptr) != NULL) - { - if(strncmp(text, "#", 1)) - { - text[strlen(text)-1] = '\0'; - ecore_list_append(images, strdup(text)); - } - } - fclose(file_ptr); - } - } if(!ecore_dlist_is_empty(current_thumbs)) { ecore_dlist_destroy(current_thumbs); @@ -231,6 +157,96 @@ ewl_widget_configure(m->viewer); ecore_list_destroy(ls); ecore_list_destroy(images); +} + +void destroy_album_win(Ewl_Widget *w, void *event, void *data) +{ + Ewl_Widget *win; + win = data; + ewl_widget_destroy(win); +} + +void save_album(Ewl_Widget *w, void *event, void *data) +{ + char *title, *description; + Ewl_Widget *win; + sqlite3 *db; + + title = ewl_text_text_get(EWL_TEXT(entry_t)); + description = ewl_text_text_get(EWL_TEXT(entry_d)); + + db = ephoto_db_init(); + ephoto_db_add_album(db, title, description); + ephoto_db_close(db); + + win = data; + ewl_widget_destroy(win); + + return; +} + +void add_album(Ewl_Widget *w, void *event, void *data) +{ + Ewl_Widget *win, *vbox, *hbox, *text, *button; + + win = ewl_window_new(); + ewl_window_title_set(EWL_WINDOW(win), _("Add an Album")); + ewl_window_name_set(EWL_WINDOW(win), "Add an Album"); + ewl_object_size_request(EWL_OBJECT(win), 215, 150); + ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy_album_win, win); + ewl_widget_show(win); + + vbox = ewl_vbox_new(); + ewl_container_child_append(EWL_CONTAINER(win), vbox); + ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL); + ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(vbox); + + text = ewl_text_new(); + ewl_text_text_set(EWL_TEXT(text), _("Enter the new album name:")); + ewl_container_child_append(EWL_CONTAINER(vbox), text); + ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(text); + + entry_t = ewl_entry_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), entry_t); + ewl_object_alignment_set(EWL_OBJECT(entry_t), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(entry_t); + + text = ewl_text_new(); + ewl_text_text_set(EWL_TEXT(text), _("Enter the new album description:")); + ewl_container_child_append(EWL_CONTAINER(vbox), text); + ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(text); + + entry_d = ewl_entry_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), entry_d); + ewl_object_alignment_set(EWL_OBJECT(entry_d), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(entry_d); + + hbox = ewl_hbox_new(); + ewl_container_child_append(EWL_CONTAINER(vbox), hbox); + ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK); + ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(hbox); + + button = ewl_button_new(); + ewl_button_image_set(EWL_BUTTON(button), + PACKAGE_DATA_DIR "/images/stock_save.png", NULL); + ewl_button_label_set(EWL_BUTTON(button), _("save")); + ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, save_album, win); + ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(button); + + button = ewl_button_new(); + ewl_button_image_set(EWL_BUTTON(button), + PACKAGE_DATA_DIR "/images/dialog-close.png", NULL); + ewl_button_label_set(EWL_BUTTON(button), _("cancel")); + ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, destroy_album_win, win); + ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER); + ewl_widget_show(button); } void go_up(Ewl_Widget *w, void *event, void *data) ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs