Enlightenment CVS committal Author : codewarrior Project : e17 Module : proto
Dir : e17/proto/exhibit/src/bin Modified Files: exhibit.h exhibit_comment.c exhibit_comment.h exhibit_image.c exhibit_image.h exhibit_main.c exhibit_main.h exhibit_menus.c exhibit_menus.h exhibit_tab.c exhibit_tab.h Log Message: more work from balony (saving, deleting), some cleanups =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- exhibit.h 29 Jul 2006 19:50:04 -0000 1.20 +++ exhibit.h 2 Aug 2006 03:10:43 -0000 1.21 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_H #define _EX_H @@ -72,7 +75,13 @@ { char *dir; char cur_path[PATH_MAX]; - char cur_file[PATH_MAX]; + + /* Path and filename of the dir to the + currently "set" image */ + char *set_img_path; + char *cur_file; + int image_loaded; + int num; Etk_Bool fit_window; @@ -85,6 +94,7 @@ Etk_Widget *itree; Etk_Widget *scrolled_view; Etk_Widget *alignment; + Etk_Widget *dialog; Etk_Tree_Col *dcol; Etk_Tree_Col *icol; @@ -167,7 +177,8 @@ Etk_Widget *win; Etk_Widget *filechooser; Etk_Widget *entry; - Etk_Image *im; + Etk_Image *im; + Exhibit *e; }; struct _Ex_Config_Version =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_comment.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- exhibit_comment.c 29 Jul 2006 19:50:04 -0000 1.8 +++ exhibit_comment.c 2 Aug 2006 03:10:43 -0000 1.9 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #include "exhibit.h" static void _ex_comment_save_clicked_cb(Etk_Object *obj, void *data); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_comment.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- exhibit_comment.h 14 Mar 2006 01:01:15 -0000 1.2 +++ exhibit_comment.h 2 Aug 2006 03:10:43 -0000 1.3 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_COMMENT_H #define _EX_COMMENT_H =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_image.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- exhibit_image.c 29 Jul 2006 21:18:37 -0000 1.24 +++ exhibit_image.c 2 Aug 2006 03:10:43 -0000 1.25 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #include "exhibit.h" #include <Ecore_File.h> #include <Ecore_Evas.h> @@ -173,7 +176,8 @@ data2 = malloc(w * h * sizeof(unsigned int)); memcpy(data2, data, w * h * sizeof(unsigned int)); etk_object_data_set(ETK_OBJECT(im), "undo", data2); - printf("Undo: setting data %p size %d\n", data, w * h * sizeof(unsigned int)); + printf("Undo: setting data %p size %d, image %p\n", data, + w * h * sizeof(unsigned int), im); return data2; } @@ -193,7 +197,7 @@ if (data) { - printf("Undo: getting data %p\n", data); + printf("Undo: getting data %p, image %p\n", data, im); evas_object_image_data_set(im->image_object, data); evas_object_image_data_update_add(im->image_object, 0, 0, w, h); etk_object_data_set(ETK_OBJECT(im), "undo", NULL); @@ -530,7 +534,7 @@ { Etk_Event_Key_Up_Down *ev = event; - if(!strcmp(ev->key, "Return") || !strcmp(ev->key, "KP_Enter")) + if (!strcmp(ev->key, "Return") || !strcmp(ev->key, "KP_Enter")) _ex_image_save_as_cb(data); } @@ -538,46 +542,49 @@ _ex_image_save_as_cb(void *data) { Ex_Filedialog *fd = data; - pid_t pid; char file[1024]; const char *basename; const char *dir; + Etk_Image *im = ETK_IMAGE(fd->e->cur_tab->image); basename = etk_entry_text_get(ETK_ENTRY(fd->entry)); dir = etk_filechooser_widget_current_folder_get - (ETK_FILECHOOSER_WIDGET(fd->filechooser)); + (ETK_FILECHOOSER_WIDGET(fd->filechooser)); - if (!basename || !dir) - return; - - sprintf(file, "%s/%s", dir, basename); + if (!dir || !basename) + return; + + sprintf(file, "%s/%s", dir, basename); printf("Saving: %s\n", file); - - pid = fork(); - if(!pid) + + /* Dont fork for the tree polulating to work */ + evas_object_image_save(im->image_object, file, NULL, NULL); + + /* Refresh list if the file is saved in our dir */ + if (!strcmp(fd->e->cur_tab->set_img_path, fd->e->cur_tab->cur_path)) { - evas_object_image_save(fd->im->image_object, file, NULL, NULL); - exit(0); + etk_tree_clear(ETK_TREE(fd->e->cur_tab->itree)); + etk_tree_clear(ETK_TREE(fd->e->cur_tab->dtree)); + _ex_main_populate_files(fd->e, NULL); } - + etk_widget_hide(fd->win); } void -_ex_image_save_as(Etk_Image *im, Etk_Tree *tree, Etk_Tree_Row *row) +_ex_image_save_as(Exhibit *e) { static Ex_Filedialog *fd = NULL; Etk_Widget *vbox; Etk_Widget *hbox; Etk_Widget *btn; Etk_Widget *label; - char *filename; if (!fd) { fd = calloc(1, sizeof(Ex_Filedialog)); - if (!fd) return; - fd->im = im; + if (!fd) return; + fd->e = e; fd->win = NULL; } @@ -585,16 +592,14 @@ if (fd->win) { /* Update the filename when we show the window again */ - etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, - &filename, etk_tree_nth_col_get(tree, 1), - NULL); - etk_entry_text_set(ETK_ENTRY(fd->entry), filename); + etk_entry_text_set(ETK_ENTRY(fd->entry), e->cur_tab->cur_file); etk_widget_show_all(ETK_WIDGET(fd->win)); return; } + fd->win = etk_window_new(); - etk_window_title_set(ETK_WINDOW(fd->win), "Exhibit save image as .."); + etk_window_title_set(ETK_WINDOW(fd->win), "Exhibit - Save image as .."); etk_signal_connect("delete_event", ETK_OBJECT(fd->win), ETK_CALLBACK(etk_window_hide_on_delete), fd->win); @@ -607,12 +612,10 @@ label = etk_label_new("Filename:"); etk_box_pack_start(ETK_BOX(vbox), label, ETK_FALSE, ETK_FALSE, 0); - etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, - &filename, etk_tree_nth_col_get(tree, 1), NULL); - printf ("Selected original filename: %s\n", filename); + printf ("Selected original filename: %s\n", e->cur_tab->cur_file); fd->entry = etk_entry_new(); - etk_entry_text_set(ETK_ENTRY(fd->entry), filename); + etk_entry_text_set(ETK_ENTRY(fd->entry), e->cur_tab->cur_file); etk_box_pack_start(ETK_BOX(vbox), fd->entry, ETK_TRUE, ETK_FALSE, 0); etk_signal_connect("key_down", ETK_OBJECT(fd->entry), ETK_CALLBACK(_ex_image_save_as_entry_cb), fd); @@ -632,6 +635,65 @@ etk_widget_show_all(fd->win); } + +void +_ex_image_delete_cb(void *data) +{ + Exhibit *e = data; + Ex_Tab *tab = e->cur_tab; + char string[PATH_MAX]; + int ret; + + sprintf(string, "%s%s", tab->set_img_path, tab->cur_file); + + ret = remove(string); + if (ret == -1) + { + perror("Error deleting file\n"); + return; + } + + _ex_main_image_unset(e); + + /* Refresh the tree as we deleted the file first */ + etk_tree_clear(ETK_TREE(tab->itree)); + etk_tree_clear(ETK_TREE(tab->dtree)); + _ex_main_populate_files(e, NULL); + + printf ("Ex_Tab pointer in _ex_image_delete_cb %p\n", tab); + etk_object_destroy(ETK_OBJECT(tab->dialog)); + + printf("Deleted for %s\n", string); +} + +void +_ex_image_delete(Exhibit *e) +{ + Etk_Widget *label; + Etk_Widget *button, *button2; + Ex_Tab *tab = e->cur_tab; + + printf ("Ex_Tab pointer in _ex_image_delete %p\n", e->cur_tab); + + tab->dialog = etk_dialog_new(); + etk_signal_connect("delete_event", ETK_OBJECT(tab->dialog), + ETK_CALLBACK(etk_object_destroy), tab->dialog); + + label = etk_label_new("Are you sure you want to delete the picture?"); + etk_dialog_pack_widget_in_action_area(ETK_DIALOG(tab->dialog), label, ETK_TRUE, + ETK_TRUE, 5, ETK_FALSE); + + button = etk_dialog_button_add(ETK_DIALOG(tab->dialog), "Cancel", ETK_RESPONSE_CANCEL); + etk_signal_connect_swapped("clicked", ETK_OBJECT(button), + ETK_CALLBACK(etk_object_destroy), ETK_OBJECT(tab->dialog)); + + button2 = etk_dialog_button_add(ETK_DIALOG(tab->dialog), "Delete", ETK_RESPONSE_OK); + etk_signal_connect_swapped("clicked", ETK_OBJECT(button2), + ETK_CALLBACK(_ex_image_delete_cb), e); + + etk_widget_show_all(tab->dialog); +} + void _ex_image_zoom(Etk_Image *im, int zoom) =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_image.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- exhibit_image.h 28 Jul 2006 16:04:47 -0000 1.7 +++ exhibit_image.h 2 Aug 2006 03:10:43 -0000 1.8 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_IMAGE_H #define _EX_IMAGE_H @@ -14,7 +17,9 @@ void _ex_image_save(Etk_Image *im); void _ex_image_save_as_entry_cb(Etk_Object *object, void *event, void *data); void _ex_image_save_as_cb(void *data); -void _ex_image_save_as(Etk_Image *im, Etk_Tree *tree, Etk_Tree_Row *row); +void _ex_image_save_as(Exhibit *e); +void _ex_image_delete_cb(void *data); +void _ex_image_delete(Exhibit *e); void _ex_image_zoom(Etk_Image *im, int zoom); void _ex_image_brightness(Etk_Image *im, int brightness); void _ex_image_wallpaper_set(Etk_Image *im); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_main.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- exhibit_main.c 29 Jul 2006 21:18:37 -0000 1.55 +++ exhibit_main.c 2 Aug 2006 03:10:43 -0000 1.56 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #include "exhibit.h" #include <Ecore_File.h> #include <Ecore_Evas.h> @@ -232,6 +235,27 @@ } void +_ex_main_image_unset(Exhibit *e) +{ + Ex_Tab *tab = e->cur_tab; + + etk_window_title_set(ETK_WINDOW(e->win), + WINDOW_TITLE " - Image Viewing the Kewl Way!"); + + free(tab->set_img_path); + free(tab->cur_file); + tab->image_loaded = ETK_FALSE; + + etk_statusbar_pop(ETK_STATUSBAR(e->statusbar[0]), 0); + etk_statusbar_push(ETK_STATUSBAR(e->statusbar[0]), NULL, 0); + etk_statusbar_pop(ETK_STATUSBAR(e->statusbar[1]), 0); + etk_statusbar_push(ETK_STATUSBAR(e->statusbar[1]), NULL, 0); + + /* Just hide the image as if we deleted it */ + etk_widget_hide(ETK_WIDGET(tab->image)); +} + +void _ex_main_image_set(Exhibit *e, char *image) { Etk_Range *hs, *vs; @@ -239,12 +263,24 @@ int w, h; int bytes; char size[30]; + unsigned int *data2; title = calloc(strlen(image) + strlen(WINDOW_TITLE) + 5, sizeof(char)); snprintf(title, strlen(image) + strlen(WINDOW_TITLE) + 5, "%s - %s", image, WINDOW_TITLE); etk_window_title_set(ETK_WINDOW(e->win), title); - snprintf(e->cur_tab->cur_file, sizeof(e->cur_tab->cur_file), "%s", image); + /* Save the path of where the image really is in case + we browse more in the dtree */ + e->cur_tab->set_img_path = malloc(PATH_MAX); + memset(e->cur_tab->set_img_path, 0, PATH_MAX); + e->cur_tab->cur_file = malloc(PATH_MAX); + memset(e->cur_tab->cur_file, 0, PATH_MAX); + + sprintf(e->cur_tab->set_img_path, "%s", e->cur_tab->cur_path); + sprintf(e->cur_tab->cur_file, "%s", image); + + e->cur_tab->image_loaded = ETK_TRUE; + etk_widget_show(ETK_WIDGET(e->cur_tab->image)); if(_ex_file_is_ebg(image)) { @@ -283,6 +319,14 @@ etk_range_value_set(hs, (double)w/2); etk_range_value_set(vs, (double)h/2); + + /* Reset undo data every time we change image */ + printf("Resetting undo data on image %p\n", e->cur_tab->image); + data2 = etk_object_data_get(ETK_OBJECT(e->cur_tab->image), "undo"); + if (data2) + free(data2); + + etk_object_data_set(ETK_OBJECT(e->cur_tab->image), "undo", NULL); if(e->cur_tab->comment.visible) _ex_comment_load(e); @@ -293,7 +337,7 @@ { Exhibit *e; Etk_Tree *tree; - char *icol_string; + char *icol_string; e = data; e->zoom = 0; @@ -301,8 +345,9 @@ tree = ETK_TREE(object); - etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, &icol_string, etk_tree_nth_col_get(tree, 1),NULL); - + etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), NULL, + &icol_string, etk_tree_nth_col_get(tree, 1),NULL); + _ex_main_image_set(e, icol_string); } @@ -463,6 +508,8 @@ chdir(e->cur_tab->dir); + printf ("Changing to dir: %s\n", e->cur_tab->dir); + if ((dir = opendir(".")) == NULL) return ; @@ -923,12 +970,16 @@ etk_table_attach(ETK_TABLE(e->table), e->menu_bar, 0, 4, 0, 0, 0, 0, ETK_FILL_POLICY_HFILL | ETK_FILL_POLICY_VFILL | ETK_FILL_POLICY_HEXPAND); { - Etk_Widget *menu, *submenu; - Etk_Widget *menu_item, *menu_item2; + Etk_Widget *menu; + Etk_Widget *submenu; + Etk_Widget *menu_item; + /* Create "File" menu item */ menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("File"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(e->menu_bar), NULL, NULL); + /* Create submenu for "File" item */ menu = etk_menu_new(); + /* Set the File submenu to the File menu item and populate it */ etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("New window"), ETK_STOCK_WINDOW_NEW, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_new_window_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Save image"), ETK_STOCK_DOCUMENT_SAVE, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_save_image_cb), e); @@ -943,34 +994,50 @@ _ex_menu_item_new(EX_MENU_ITEM_SEPERATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL, NULL); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Close window"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_close_window_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Quit"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_quit_cb), e); - + + /* Create "Edit" menu item */ menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Edit"), -99, ETK_MENU_SHELL(e->menu_bar), NULL, NULL); + /* Create submenu for "Edit" menu */ menu = etk_menu_new(); + + /* Set the File submenu to the File menu item and populate it */ etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Undo"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_undo_cb), e); _ex_menu_item_new(EX_MENU_ITEM_SEPERATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL, NULL); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("in The Gimp"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("in XV"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("in Xpaint"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + + /* Run in submenu */ + menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Run in ..."), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + submenu = etk_menu_new(); + etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(submenu)); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("The Gimp"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("XV"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Xpaint"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + + /* Continue "Edit" menu */ _ex_menu_item_new(EX_MENU_ITEM_SEPERATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL, NULL); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Rotate clockwise"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_rot_clockwise_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Rotate counterclockwise"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_rot_counter_clockwise_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Flip horizontally"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_flip_horizontal_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Flip vertically"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_flip_vertical_cb), e); _ex_menu_item_new(EX_MENU_ITEM_SEPERATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL, NULL); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Blur"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_blur_cb), e); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Sharpen"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_sharpen_cb), e); - _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Brighten"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_brighten_cb), e); + + menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Effects"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + submenu = etk_menu_new(); + etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(submenu)); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Blur"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_blur_cb), e); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Sharpen"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_sharpen_cb), e); + _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Brighten"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_menu_brighten_cb), e); _ex_menu_item_new(EX_MENU_ITEM_SEPERATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL, NULL); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Set as wallpaper"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_set_wallpaper_cb), e); + /* Create the "View" menu item */ menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("View"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(e->menu_bar), NULL, NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); - menu_item2 = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Sort"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); + menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Sort"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_run_in_cb), e); submenu = etk_menu_new(); - etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item2), ETK_MENU(submenu)); + etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(submenu)); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Date"), ETK_STOCK_OFFICE_CALENDAR, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_sort_date_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Size"), ETK_STOCK_DRIVE_HARDDISK, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_sort_size_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Name"), ETK_STOCK_TEXT_X_GENERIC, ETK_MENU_SHELL(submenu), ETK_CALLBACK(_ex_sort_name_cb), e); @@ -988,6 +1055,7 @@ _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Add to favorites"), ETK_STOCK_EMBLEM_PHOTOS, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_add_to_fav_cb), e); _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("View favorites"), ETK_STOCK_EMBLEM_FAVORITE, ETK_MENU_SHELL(menu), ETK_CALLBACK(_ex_menu_go_to_fav_cb), e); + /* Create the "Help" submenu */ menu_item = _ex_menu_item_new(EX_MENU_ITEM_NORMAL, _("Help"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(e->menu_bar), NULL, NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_main.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- exhibit_main.h 29 Jul 2006 20:58:47 -0000 1.8 +++ exhibit_main.h 2 Aug 2006 03:10:43 -0000 1.9 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_MAIN_H #define _EX_MAIN_H @@ -23,5 +26,7 @@ void _ex_main_window_key_down_cb(Etk_Object *object, void *event, void *data); void _ex_main_window_tab_append(Exhibit *e, Ex_Tab *tab); void _ex_main_window_show(char *dir); +void _ex_main_image_unset(Exhibit *e); + #endif =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_menus.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- exhibit_menus.c 29 Jul 2006 02:49:24 -0000 1.20 +++ exhibit_menus.c 2 Aug 2006 03:10:43 -0000 1.21 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #include "exhibit.h" #include "exhibit_main.h" #include "exhibit_image.h" @@ -79,6 +82,7 @@ e = data; r = etk_tree_selected_row_get(ETK_TREE(e->cur_tab->itree)); + if(!r) return; _ex_image_save(ETK_IMAGE(e->cur_tab->image)); } @@ -86,14 +90,13 @@ void _ex_menu_save_image_as_cb(Etk_Object *obj, void *data) { - Exhibit *e; - Etk_Tree_Row *r; + Exhibit *e = data; EX_MENU_ITEM_GET_RETURN(obj); - e = data; - r = etk_tree_selected_row_get(ETK_TREE(e->cur_tab->itree)); - if(!r) return; - _ex_image_save_as(ETK_IMAGE(e->cur_tab->image), ETK_TREE(e->cur_tab->itree), r); + if (!e->cur_tab->image_loaded) + return; + + _ex_image_save_as(e); } void @@ -113,8 +116,13 @@ void _ex_menu_delete_cb(Etk_Object *obj, void *data) { + Exhibit *e = data; EX_MENU_ITEM_GET_RETURN(obj); - printf("delete\n"); + + if (!e->cur_tab->image_loaded) + return; + + _ex_image_delete(e); } void =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_menus.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- exhibit_menus.h 28 Jul 2006 16:04:47 -0000 1.6 +++ exhibit_menus.h 2 Aug 2006 03:10:43 -0000 1.7 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_MENUS_H #define _EX_MENUS_H =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_tab.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- exhibit_tab.c 29 Jul 2006 21:18:37 -0000 1.17 +++ exhibit_tab.c 2 Aug 2006 03:10:43 -0000 1.18 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #include "exhibit.h" #define EX_DND_MAX_NUM 25 @@ -20,6 +23,7 @@ tab->e = e; tab->fit_window = ETK_FALSE; tab->comment.visible = ETK_FALSE; + tab->image_loaded = ETK_FALSE; tab->dtree = etk_tree_new(); etk_widget_size_request_set(tab->dtree, 180, 120); @@ -32,7 +36,7 @@ tab->itree = etk_tree_new(); etk_widget_dnd_source_set(ETK_WIDGET(tab->itree), ETK_TRUE); etk_signal_connect("drag_begin", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_tree_drag_begin_cb), tab); - etk_widget_size_request_set(tab->itree, 180, 120); + etk_widget_size_request_set(tab->itree, 180, 220); etk_tree_multiple_select_set(ETK_TREE(tab->itree), ETK_TRUE); etk_signal_connect("row_selected", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_main_itree_item_clicked_cb), e); etk_signal_connect("key_down", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_main_itree_key_down_cb), e); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_tab.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- exhibit_tab.h 26 Dec 2005 12:17:30 -0000 1.1 +++ exhibit_tab.h 2 Aug 2006 03:10:43 -0000 1.2 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _EX_TAB_H #define _EX_TAB_H ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs