Enlightenment CVS committal Author : balony Project : e17 Module : proto
Dir : e17/proto/exhibit/src/bin Modified Files: exhibit.h exhibit_file.c exhibit_file.h exhibit_main.c exhibit_options.c Log Message: Start of some direct image download code. (and a new option for where to put the files) =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -3 -r1.34 -r1.35 --- exhibit.h 1 Sep 2006 23:39:22 -0000 1.34 +++ exhibit.h 3 Sep 2006 12:41:30 -0000 1.35 @@ -90,6 +90,7 @@ char *app4_cmd; char *fav_path; + char *dl_path; double blur_thresh; double sharpen_thresh; @@ -121,6 +122,7 @@ Etk_Widget *rotate_autosave; Etk_Widget *default_sort; Etk_Widget *monitor_focus; + Etk_Widget *dl_path; Etk_Combobox_Item *sort_date; Etk_Combobox_Item *sort_size; Etk_Combobox_Item *sort_name; =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_file.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- exhibit_file.c 2 Sep 2006 01:43:23 -0000 1.10 +++ exhibit_file.c 3 Sep 2006 12:41:30 -0000 1.11 @@ -15,6 +15,21 @@ NULL }; +int +_ex_file_download_progress_cb(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow) +{ + D(("Download progress on %s\n", file)); + + return TRUE; +} + +void +_ex_file_download_complete_cb(void *data, const char *file, int status) +{ + D(("Download of file %s is done\n", file)); + +} + int _ex_file_is_viewable(char *file) { =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_file.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- exhibit_file.h 2 Sep 2006 01:43:23 -0000 1.8 +++ exhibit_file.h 3 Sep 2006 12:41:30 -0000 1.9 @@ -4,6 +4,8 @@ #ifndef _EX_FILE_H #define _EX_FILE_H +int _ex_file_download_progress_cb(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow); +void _ex_file_download_complete_cb(void *data, const char *file, int status); int _ex_file_is_viewable(char *file); int _ex_file_is_ebg(char *file); int _ex_file_is_jpg(char *file); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_main.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -3 -r1.78 -r1.79 --- exhibit_main.c 2 Sep 2006 16:14:54 -0000 1.78 +++ exhibit_main.c 3 Sep 2006 12:41:30 -0000 1.79 @@ -268,6 +268,12 @@ { Epsilon *ep; Etk_Tree_Row *row; + + if (!file) + { + D(("ERROR: file is NULL\n")); + return; + } ep = epsilon_new(file); epsilon_thumb_size(ep, EPSILON_THUMB_NORMAL); @@ -840,17 +846,12 @@ 0, 0, ETK_TABLE_NONE); etk_signal_connect("clicked", ETK_OBJECT(e->entry[1]), ETK_CALLBACK(_ex_main_goto_dir_clicked_cb), e); - if (ecore_file_download_protocol_available("http://")) - { - D(("Protocol HTTP is available\n")); - } - /* create first tab but dont place it in notebook */ - if(dir) + if (dir) { - if(ecore_file_is_dir(dir)) + if (ecore_file_is_dir(dir)) tab = _ex_tab_new(e, dir); - else if(ecore_file_exists(dir)) + else if (ecore_file_exists(dir)) { char *dir2; @@ -858,6 +859,20 @@ tab = _ex_tab_new(e, dir2); E_FREE(dir2); realpath(dir, file); + } + else if (ecore_file_download_protocol_available("http://")) + { + D(("Protocol HTTP is available\n")); + D(("Trying to download %s to %s\n", dir, e->options->dl_path)); + if (ecore_file_download(dir, e->options->dl_path, + _ex_file_download_complete_cb, + _ex_file_download_progress_cb, NULL)) + { + D(("Starting download\n")); + tab = _ex_tab_new(e, e->options->dl_path); + } + else + tab = _ex_tab_new(e, "."); } else tab = _ex_tab_new(e, "."); =================================================================== RCS file: /cvs/e/e17/proto/exhibit/src/bin/exhibit_options.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- exhibit_options.c 2 Sep 2006 01:43:23 -0000 1.17 +++ exhibit_options.c 3 Sep 2006 12:41:30 -0000 1.18 @@ -36,12 +36,18 @@ static Eet_Data_Descriptor *_ex_config_options_edd = NULL; static Eet_Data_Descriptor *_ex_config_version_edd = NULL; -static void _ex_options_set(); +static Ex_Config_Version *_ex_options_version_parse(char *version); +static int _ex_options_version_compare(Ex_Config_Version *v1, Ex_Config_Version *v2); static void _ex_options_set_cancel_cb(Etk_Object *object, void *data); static void _ex_options_set_apply_cb(Etk_Object *object, void *data); static void _ex_options_set_ok_cb(Etk_Object *object, void *data); static Etk_Bool _ex_options_window_delete_cb(void *data); - +static void _ex_options_set(); +static Etk_Widget *_ex_options_page_1_create(); +static Etk_Widget *_ex_options_page_2_create(); +static void _ex_options_combobox_active_item_changed_cb(Etk_Object *object, void *data); +static Etk_Widget *_ex_options_page_3_create(); +static Etk_Widget *_ex_options_page_4_create(); int _ex_options_init() @@ -99,6 +105,7 @@ CFG_OPTIONS_NEWI("a2_cmd", app2_cmd, EET_T_STRING); CFG_OPTIONS_NEWI("a3_cmd", app3_cmd, EET_T_STRING); CFG_OPTIONS_NEWI("a4_cmd", app4_cmd, EET_T_STRING); + CFG_OPTIONS_NEWI("dlp", dl_path, EET_T_STRING); CFG_OPTIONS_NEWI("fp", fav_path, EET_T_STRING); CFG_OPTIONS_NEWI("bt", blur_thresh, EET_T_DOUBLE); CFG_OPTIONS_NEWI("st", sharpen_thresh, EET_T_DOUBLE); @@ -128,7 +135,7 @@ return 1; } -Ex_Config_Version * +static Ex_Config_Version * _ex_options_version_parse(char *version) { Ex_Config_Version *v; @@ -148,7 +155,7 @@ * return 0 if v1 == v2 * return -1 if v1 < v2 */ -int +static int _ex_options_version_compare(Ex_Config_Version *v1, Ex_Config_Version *v2) { if(v1->major > v2->major) @@ -197,6 +204,7 @@ e->options->app4 = NULL; e->options->app4_cmd = NULL; e->options->fav_path = NULL; + e->options->dl_path = strdup("/tmp"); e->options->blur_thresh = EX_DEFAULT_BLUR_THRESH; e->options->sharpen_thresh = EX_DEFAULT_SHARPEN_THRESH; e->options->brighten_thresh = EX_DEFAULT_BRIGHTEN_THRESH; @@ -223,6 +231,7 @@ E_FREE(e->options->app3_cmd); E_FREE(e->options->app4_cmd); E_FREE(e->options->fav_path); + E_FREE(e->options->dl_path); E_FREE(e->options); } @@ -252,7 +261,7 @@ if(!ret) fprintf(stderr, "Problem saving config/options!"); - D(("Saving configuation (%s)\n", e->options->fav_path)); + D(("Saving configuation (%s)\n", buf)); eet_close(ef); return ret; @@ -311,10 +320,7 @@ } e->options = eet_data_read(ef, _ex_config_options_edd, "config/options"); - - D(("Config: Loaded saved options (%s)\n", e->options->fav_path)); - - D(("Default view: %d\n", e->options->default_view)); + D(("Config: Loaded saved options (%s)\n", buf)); eet_close(ef); return 1; @@ -359,17 +365,14 @@ const char *string; double ss_int; - /* STANDARD VIEW */ if (IS_SELECTED(dialog->dv_btn_1)) { - D(("Zoom 1:1 is checked\n")); e->options->default_view = EX_IMAGE_ONE_TO_ONE; _ex_tab_current_zoom_one_to_one(e); } else if (IS_SELECTED(dialog->dv_btn_2)) { - D(("Fit to window is checked\n")); e->options->default_view = EX_IMAGE_FIT_TO_WINDOW; e->cur_tab->fit_window = ETK_TRUE; _ex_tab_current_fit_to_window(e); @@ -378,14 +381,12 @@ /* COMMENTS */ if (IS_SELECTED(dialog->comments_visible)) { - D(("Comments EX_DEFAULT_COMMENTS_VISIBLE\n")); e->options->comments_visible = EX_DEFAULT_COMMENTS_VISIBLE; _ex_comment_show(e); _ex_comment_load(e); } else { - D(("Comments EX_DEFAULT_COMMENTS_HIDDEN\n")); e->options->comments_visible = EX_DEFAULT_COMMENTS_HIDDEN; _ex_comment_hide(e); } @@ -400,9 +401,7 @@ string = etk_entry_text_get(ETK_ENTRY(dialog->blur_thresh)); if (string) { - D(("Setting blur thresh: %f\n", atof(string))); e->options->blur_thresh = atof(string); - if (e->options->blur_thresh <= 1) _ex_main_dialog_show("One, Zero or negative value for blur tresh " \ "is not recommended! ", ETK_MESSAGE_DIALOG_WARNING); @@ -417,9 +416,7 @@ string = etk_entry_text_get(ETK_ENTRY(dialog->sharpen_thresh)); if (string) { - D(("Setting sharpen thresh: %f\n", atof(string))); e->options->sharpen_thresh = atof(string); - if (e->options->sharpen_thresh <= 0) _ex_main_dialog_show("Zero or negative value for sharpen tresh " \ "is not recommended! ", ETK_MESSAGE_DIALOG_WARNING); @@ -434,9 +431,7 @@ string = etk_entry_text_get(ETK_ENTRY(dialog->brighten_thresh)); if (string) { - D(("Setting brighten thresh: %f\n", atof(string))); e->options->brighten_thresh = atof(string); - if (e->options->brighten_thresh <= 0) _ex_main_dialog_show("Zero or negative value for brighten tresh " \ "is not recommended! ", ETK_MESSAGE_DIALOG_WARNING); @@ -455,15 +450,11 @@ if (string) { ss_int = atof(string); - if (ss_int <= 0) _ex_main_dialog_show("Zero or negative value for slideshow interval " \ "is not possible, skipping! ", ETK_MESSAGE_DIALOG_WARNING); else - { - D(("Setting slide_interval: %f\n", ss_int)); - e->options->slide_interval = ss_int; - } + e->options->slide_interval = ss_int; } else { @@ -471,6 +462,19 @@ "saving the other options!", ETK_MESSAGE_DIALOG_WARNING); } + /* DOWNLOAD PATH */ + string = etk_entry_text_get(ETK_ENTRY(dialog->dl_path)); + if (string) + { + E_FREE(e->options->dl_path); + e->options->dl_path = strdup(string); + } + else + { + _ex_main_dialog_show("Missing value for image download path, but still " \ + "saving the other options!", ETK_MESSAGE_DIALOG_WARNING); + } + /* SORTING */ e->options->default_sort = e->options->default_sort_tmp; etk_tree_clear(ETK_TREE(e->cur_tab->dtree)); @@ -544,6 +548,17 @@ dialog->comments_visible = etk_check_button_new_with_label("Visible"); etk_box_append(ETK_BOX(vbox2), dialog->comments_visible, ETK_BOX_START, ETK_BOX_NONE, 0); + + frame = etk_frame_new("Image download"); + etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_NONE, 5); + hbox = etk_hbox_new(ETK_FALSE, 0); + etk_container_add(ETK_CONTAINER(frame), hbox); + + label = etk_label_new("Default storage path"); + etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); + + dialog->dl_path = etk_entry_new(); + etk_box_append(ETK_BOX(hbox), dialog->dl_path, ETK_BOX_START, ETK_BOX_NONE, 0); /* * Start toggling/setting the correct values from loaded options @@ -558,9 +573,10 @@ sprintf(string, "%.2f", e->options->slide_interval); - D(("Entry gets texts for slide_interval: %s\n", string)); etk_entry_text_set(ETK_ENTRY(dialog->slide_interval), string); + etk_entry_text_set(ETK_ENTRY(dialog->dl_path), e->options->dl_path); + return vbox; } @@ -613,17 +629,11 @@ etk_box_append(ETK_BOX(vbox2), dialog->rotate_autosave, ETK_BOX_START, ETK_BOX_NONE, 0); - sprintf(string, "%.2f", e->options->blur_thresh); - D(("Entry gets texts for blur tresh: %s\n", string)); etk_entry_text_set(ETK_ENTRY(dialog->blur_thresh), string); - sprintf(string, "%.2f", e->options->sharpen_thresh); - D(("Entry gets texts for sharpen tresh: %s\n", string)); etk_entry_text_set(ETK_ENTRY(dialog->sharpen_thresh), string); - sprintf(string, "%.2f", e->options->brighten_thresh); - D(("Entry gets texts for brighten tresh: %s\n", string)); etk_entry_text_set(ETK_ENTRY(dialog->brighten_thresh), string); if (e->options->rotate_autosave) @@ -648,9 +658,6 @@ e->options->default_sort_tmp = EX_SORT_BY_NAME; else if (item == dialog->sort_resolution) e->options->default_sort_tmp = EX_SORT_BY_RESOLUTION; - - D(("Selected item %p, e->options->default_sort_tmp %d\n", item, - e->options->default_sort_tmp)); } static Etk_Widget * ------------------------------------------------------------------------- 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