From b7234a0020d229033fe016ce753895d5396e59e5 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Thu, 2 Apr 2009 03:46:22 +0000 Subject: [PATCH] Changing e_conf_wallpaper_import dialog. It has been split into two other dialogs, one for wallpaper file selection and another one for import settings. Also the "Set As Background" efm action just calls the latter because the file was already selected. SVN revision: 39831 --- .../conf_wallpaper/e_int_config_wallpaper.c | 29 +- .../e_int_config_wallpaper_import.c | 505 ++++++++++++++---- .../e_int_config_wallpaper_import.h | 3 +- 3 files changed, 408 insertions(+), 129 deletions(-) diff --git a/src/modules/conf_wallpaper/e_int_config_wallpaper.c b/src/modules/conf_wallpaper/e_int_config_wallpaper.c index 70390e972..66f65fd70 100644 --- a/src/modules/conf_wallpaper/e_int_config_wallpaper.c +++ b/src/modules/conf_wallpaper/e_int_config_wallpaper.c @@ -171,21 +171,22 @@ e_int_config_wallpaper_handler_set(Evas_Object *obj, const char *path, void *dat if (!path) return; e_fm2_path_get(obj, &dev, &fpath); + if (e_config->wallpaper_import_last_dev) + { + eina_stringshare_del(e_config->wallpaper_import_last_dev); + e_config->wallpaper_import_last_dev = NULL; + } if (dev) - { - if (e_config->wallpaper_import_last_dev) - eina_stringshare_del(e_config->wallpaper_import_last_dev); - e_config->wallpaper_import_last_dev = eina_stringshare_add(dev); - } - if (fpath) - { - if (e_config->wallpaper_import_last_path) - eina_stringshare_del(e_config->wallpaper_import_last_path); - e_config->wallpaper_import_last_path = eina_stringshare_add(fpath); - } + e_config->wallpaper_import_last_dev = eina_stringshare_add(dev); + if (e_config->wallpaper_import_last_path) { + eina_stringshare_del(e_config->wallpaper_import_last_path); + e_config->wallpaper_import_last_path = NULL; + } + if (fpath) + e_config->wallpaper_import_last_path = eina_stringshare_add(fpath); e_config_save_queue(); - e_int_config_wallpaper_import(NULL); + e_int_config_wallpaper_import(NULL, path); } EAPI int @@ -365,7 +366,7 @@ _cb_import(void *data1, void *data2) if (cfdata->win_import) e_win_raise(cfdata->win_import); else - cfdata->win_import = e_int_config_wallpaper_import(cfdata->cfd); + cfdata->win_import = e_int_config_wallpaper_fsel(cfdata->cfd); } static void @@ -471,7 +472,7 @@ static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { if (cfdata->win_import) - e_int_config_wallpaper_del(cfdata->win_import); + e_int_config_wallpaper_import_del(cfdata->win_import); if (cfdata->dia_gradient) e_int_config_wallpaper_gradient_del(cfdata->dia_gradient); #ifdef HAVE_EXCHANGE diff --git a/src/modules/conf_wallpaper/e_int_config_wallpaper_import.c b/src/modules/conf_wallpaper/e_int_config_wallpaper_import.c index da1826f51..04e5cef1b 100644 --- a/src/modules/conf_wallpaper/e_int_config_wallpaper_import.c +++ b/src/modules/conf_wallpaper/e_int_config_wallpaper_import.c @@ -10,9 +10,9 @@ #define IMPORT_SCALE_ASPECT_IN 3 #define IMPORT_SCALE_ASPECT_OUT 4 -typedef struct _Import Import; +typedef struct _FSel FSel; -struct _Import +struct _FSel { E_Config_Dialog *parent; E_Config_Dialog_Data *cfdata; @@ -26,6 +26,23 @@ struct _Import Evas_Object *ok_obj; Evas_Object *close_obj; + E_Win *win; +}; + +typedef struct _Import Import; + +struct _Import +{ + E_Config_Dialog_Data *cfdata; + + Evas_Object *bg_obj; + Evas_Object *box_obj; + Evas_Object *event_obj; + Evas_Object *content_obj; + + Evas_Object *ok_obj; + Evas_Object *close_obj; + Evas_Object *fill_stretch_obj; Evas_Object *fill_center_obj; Evas_Object *fill_tile_obj; @@ -38,6 +55,8 @@ struct _Import E_Win *win; + FSel *fsel; + Ecore_Exe *exe; Ecore_Event_Handler *exe_handler; char *tmpf; @@ -53,57 +72,60 @@ struct _E_Config_Dialog_Data }; static void _import_opt_disabled_set(Import *import, int disabled); -static void _import_cb_sel_selected(void *data, Evas_Object *obj); -static void _import_cb_sel_change(void *data, Evas_Object *obj); -static void _import_path_save(Import *import); +static void _fsel_path_save(FSel *fsel); static void _import_edj_gen(Import *import); static int _import_cb_edje_cc_exit(void *data, int type, void *event); static void _import_cb_delete(E_Win *win); static void _import_cb_resize(E_Win *win); static void _import_cb_close(void *data, void *data2); static void _import_cb_ok(void *data, void *data2); +static void _fsel_cb_delete(E_Win *win); +static void _fsel_cb_resize(E_Win *win); +static void _fsel_cb_close(void *data, void *data2); +static void _fsel_cb_ok(void *data, void *data2); static void _import_cb_wid_on_focus(void *data, Evas_Object *obj); static void _import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event); +static void _fsel_cb_wid_on_focus(void *data, Evas_Object *obj); +static void _fsel_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event); EAPI E_Win * -e_int_config_wallpaper_import(E_Config_Dialog *parent) +e_int_config_wallpaper_import(void *data, const char *path) { Evas *evas; E_Win *win; Import *import; - Evas_Object *o, *of, *ofm, *ord, *ot; + Evas_Object *o, *of, *ord, *ot; E_Radio_Group *rg; Evas_Coord w, h; E_Config_Dialog_Data *cfdata; Evas_Modifier_Mask mask; - const char *fdev, *fpath; + + if (!path) return NULL; import = E_NEW(Import, 1); if (!import) return NULL; - if (parent) - win = e_win_new(parent->con); - else - win = e_win_new(e_container_current_get(e_manager_current_get())); + win = e_win_new(e_container_current_get(e_manager_current_get())); - if (!win) - { + if (!win) + { E_FREE(import); - return NULL; + return NULL; } + import->fsel = data; + cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata->method = IMPORT_STRETCH; cfdata->external = 0; cfdata->quality = 90; + cfdata->file = strdup(path); import->cfdata = cfdata; import->win = win; evas = e_win_evas_get(win); - if (parent) import->parent = parent; - - e_win_title_set(win, _("Select a Picture...")); + e_win_title_set(win, _("Wallpaper settings...")); e_win_delete_callback_set(win, _import_cb_delete); e_win_resize_callback_set(win, _import_cb_resize); e_win_dialog_set(win, 1); @@ -131,53 +153,39 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent) mask = 0; evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0); mask = 0; - evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, + evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _import_cb_key_down, import); - o = e_widget_list_add(evas, 0, 0); + o = e_widget_list_add(evas, 0, 0); import->content_obj = o; - fdev = e_config->wallpaper_import_last_dev; - fpath = e_config->wallpaper_import_last_path; - if ((!fdev) && (!fpath)) - { - fdev = "~/"; - fpath = "/"; - } - ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL, - _import_cb_sel_selected, import, - _import_cb_sel_change, import, 1); - e_widget_fsel_window_object_set(ofm, E_OBJECT(win)); - import->fsel_obj = ofm; - e_widget_list_object_append(o, ofm, 1, 1, 0.5); - ot = e_widget_table_add(evas, 0); of = e_widget_frametable_add(evas, _("Fill and Stretch Options"), 1); import->frame_fill_obj = of; rg = e_widget_radio_group_new(&cfdata->method); - ord = e_widget_radio_icon_add(evas, _("Stretch"), - "enlightenment/wallpaper_stretch", + ord = e_widget_radio_icon_add(evas, _("Stretch"), + "enlightenment/wallpaper_stretch", 24, 24, IMPORT_STRETCH, rg); import->fill_stretch_obj = ord; e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_icon_add(evas, _("Center"), - "enlightenment/wallpaper_center", + ord = e_widget_radio_icon_add(evas, _("Center"), + "enlightenment/wallpaper_center", 24, 24, IMPORT_CENTER, rg); import->fill_center_obj = ord; e_widget_frametable_object_append(of, ord, 1, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_icon_add(evas, _("Tile"), - "enlightenment/wallpaper_tile", + ord = e_widget_radio_icon_add(evas, _("Tile"), + "enlightenment/wallpaper_tile", 24, 24, IMPORT_TILE, rg); import->fill_tile_obj = ord; e_widget_frametable_object_append(of, ord, 2, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_icon_add(evas, _("Within"), - "enlightenment/wallpaper_scale_aspect_in", + ord = e_widget_radio_icon_add(evas, _("Within"), + "enlightenment/wallpaper_scale_aspect_in", 24, 24, IMPORT_SCALE_ASPECT_IN, rg); import->fill_within_obj = ord; e_widget_frametable_object_append(of, ord, 3, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_radio_icon_add(evas, _("Fill"), - "enlightenment/wallpaper_scale_aspect_out", + ord = e_widget_radio_icon_add(evas, _("Fill"), + "enlightenment/wallpaper_scale_aspect_out", 24, 24, IMPORT_SCALE_ASPECT_OUT, rg); import->fill_fill_obj = ord; e_widget_frametable_object_append(of, ord, 4, 0, 1, 1, 1, 0, 1, 0); @@ -188,7 +196,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent) ord = e_widget_check_add(evas, _("Use original file"), &(cfdata->external)); import->external_obj = ord; e_widget_frametable_object_append(of, ord, 0, 0, 1, 1, 1, 0, 1, 0); - ord = e_widget_slider_add(evas, 1, 0, _("%3.0f%%"), 0.0, 100.0, 1.0, 0, + ord = e_widget_slider_add(evas, 1, 0, _("%3.0f%%"), 0.0, 100.0, 1.0, 0, NULL, &(cfdata->quality), 150); import->quality_obj = ord; e_widget_frametable_object_append(of, ord, 0, 1, 1, 1, 1, 0, 1, 0); @@ -201,11 +209,11 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent) edje_object_part_swallow(import->bg_obj, "e.swallow.content", o); evas_object_show(o); - import->ok_obj = e_widget_button_add(evas, _("OK"), NULL, + import->ok_obj = e_widget_button_add(evas, _("OK"), NULL, _import_cb_ok, win, cfdata); e_widget_list_object_append(import->box_obj, import->ok_obj, 1, 0, 0.5); - import->close_obj = e_widget_button_add(evas, _("Cancel"), NULL, + import->close_obj = e_widget_button_add(evas, _("Cancel"), NULL, _import_cb_close, win, NULL); e_widget_list_object_append(import->box_obj, import->close_obj, 1, 0, 0.5); @@ -229,17 +237,131 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent) win->data = import; - _import_opt_disabled_set(import, 1); + return win; +} + +EAPI E_Win * +e_int_config_wallpaper_fsel(E_Config_Dialog *parent) +{ + Evas *evas; + E_Win *win; + FSel *fsel; + Evas_Object *o, *ofm; + Evas_Coord w, h; + Evas_Modifier_Mask mask; + const char *fdev, *fpath; + + fsel = E_NEW(FSel, 1); + if (!fsel) return NULL; + + if (parent) + win = e_win_new(parent->con); + else + win = e_win_new(e_container_current_get(e_manager_current_get())); + + if (!win) + { + E_FREE(fsel); + return NULL; + } + + fsel->win = win; + + evas = e_win_evas_get(win); + + if (parent) fsel->parent = parent; + + e_win_title_set(win, _("Select a Picture...")); + e_win_delete_callback_set(win, _fsel_cb_delete); + e_win_resize_callback_set(win, _fsel_cb_resize); + e_win_dialog_set(win, 1); + e_win_name_class_set(win, "E", "_wallpaper_fsel_dialog"); + + o = edje_object_add(evas); + fsel->bg_obj = o; + e_theme_edje_object_set(o, "base/theme/dialog", "e/widgets/dialog/main"); + evas_object_move(o, 0, 0); + evas_object_show(o); + + o = e_widget_list_add(evas, 1, 1); + e_widget_on_focus_hook_set(o, _import_cb_wid_on_focus, fsel); + fsel->box_obj = o; + edje_object_part_swallow(fsel->bg_obj, "e.swallow.buttons", o); + + o = evas_object_rectangle_add(evas); + fsel->event_obj = o; + mask = 0; + evas_object_key_grab(o, "Tab", mask, ~mask, 0); + mask = evas_key_modifier_mask_get(evas, "Shift"); + evas_object_key_grab(o, "Tab", mask, ~mask, 0); + mask = 0; + evas_object_key_grab(o, "Return", mask, ~mask, 0); + mask = 0; + evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0); + mask = 0; + evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, + _fsel_cb_key_down, fsel); + + o = e_widget_list_add(evas, 0, 0); + fsel->content_obj = o; + + fdev = e_config->wallpaper_import_last_dev; + fpath = e_config->wallpaper_import_last_path; + if ((!fdev) && (!fpath)) + { + fdev = "~/"; + fpath = "/"; + } + ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL, NULL, NULL, + NULL, NULL, 1); + e_widget_fsel_window_object_set(ofm, E_OBJECT(win)); + fsel->fsel_obj = ofm; + e_widget_list_object_append(o, ofm, 1, 1, 0.5); + + e_widget_min_size_get(o, &w, &h); + edje_extern_object_min_size_set(o, w, h); + edje_object_part_swallow(fsel->bg_obj, "e.swallow.content", o); + evas_object_show(o); + + + fsel->ok_obj = e_widget_button_add(evas, _("OK"), NULL, + _fsel_cb_ok, win, NULL); + e_widget_list_object_append(fsel->box_obj, fsel->ok_obj, 1, 0, 0.5); + + fsel->close_obj = e_widget_button_add(evas, _("Cancel"), NULL, + _fsel_cb_close, win, NULL); + e_widget_list_object_append(fsel->box_obj, fsel->close_obj, 1, 0, 0.5); + + e_win_centered_set(win, 1); + + o = fsel->box_obj; + e_widget_min_size_get(o, &w, &h); + edje_extern_object_min_size_set(o, w, h); + edje_object_part_swallow(fsel->bg_obj, "e.swallow.buttons", o); + + + edje_object_size_min_calc(fsel->bg_obj, &w, &h); + evas_object_resize(fsel->bg_obj, w, h); + e_win_resize(win, w, h); + e_win_size_min_set(win, w, h); + e_win_size_max_set(win, 99999, 99999); + e_win_show(win); + e_win_border_icon_set(win, "enlightenment/background"); + + if (!e_widget_focus_get(fsel->bg_obj)) + e_widget_focus_set(fsel->box_obj, 1); + + win->data = fsel; + return win; } EAPI void -e_int_config_wallpaper_del(E_Win *win) +e_int_config_wallpaper_import_del(E_Win *win) { Import *import; import = win->data; - _import_path_save(import); if (import->exe_handler) ecore_event_handler_del(import->exe_handler); import->exe_handler = NULL; if (import->tmpf) unlink(import->tmpf); @@ -247,59 +369,30 @@ e_int_config_wallpaper_del(E_Win *win) E_FREE(import->fdest); import->exe = NULL; e_object_del(E_OBJECT(import->win)); - if (import->parent) - e_int_config_wallpaper_import_done(import->parent); E_FREE(import->cfdata->file); E_FREE(import->cfdata); if (import) free(import); } -static void -_import_opt_disabled_set(Import *import, int disabled) +EAPI void +e_int_config_wallpaper_fsel_del(E_Win *win) { - e_widget_disabled_set(import->fill_stretch_obj, disabled); - e_widget_disabled_set(import->fill_center_obj, disabled); - e_widget_disabled_set(import->fill_tile_obj, disabled); - e_widget_disabled_set(import->fill_within_obj, disabled); - e_widget_disabled_set(import->fill_fill_obj, disabled); - e_widget_disabled_set(import->external_obj, disabled); - e_widget_disabled_set(import->quality_obj, disabled); - e_widget_disabled_set(import->frame_fill_obj, disabled); - e_widget_disabled_set(import->frame_quality_obj, disabled); -} + FSel *fsel; -static void -_import_cb_sel_selected(void *data, Evas_Object *obj) -{ - Import *import; - - import = data; - _import_cb_ok(import->win, NULL); -} - -static void -_import_cb_sel_change(void *data, Evas_Object *obj) -{ - Import *import; - const char *path, *p = NULL; - - import = data; - path = e_widget_fsel_selection_path_get(import->fsel_obj); - E_FREE(import->cfdata->file); - if (path) import->cfdata->file = strdup(path); - if (path) p = strrchr(path, '.'); - if ((!p) || (!strcasecmp(p, ".edj"))) - _import_opt_disabled_set(import, 1); - else - _import_opt_disabled_set(import, 0); + fsel = win->data; + _fsel_path_save(fsel); + e_object_del(E_OBJECT(fsel->win)); + if (fsel->parent) + e_int_config_wallpaper_import_done(fsel->parent); + if (fsel) free(fsel); } static void -_import_path_save(Import *import) +_fsel_path_save(FSel *fsel) { const char *fdev = NULL, *fpath = NULL; - e_widget_fsel_path_get(import->fsel_obj, &fdev, &fpath); + e_widget_fsel_path_get(fsel->fsel_obj, &fdev, &fpath); if ((fdev) || (fpath)) { if (e_config->wallpaper_import_last_dev) @@ -493,7 +586,10 @@ static int _import_cb_edje_cc_exit(void *data, int type, void *event) { Import *import; + FSel *fsel; Ecore_Exe_Event_Del *ev; + char *fdest; + int r = 1; ev = event; import = data; @@ -504,19 +600,37 @@ _import_cb_edje_cc_exit(void *data, int type, void *event) e_util_dialog_show(_("Picture Import Error"), _("Enlightenment was unable to import the picture
" "due to conversion errors.")); + r = 0; } - if (import->parent) - e_int_config_wallpaper_update(import->parent, import->fdest); + fsel = import->fsel; + fdest = strdup(import->fdest); + e_int_config_wallpaper_import_del(import->win); + if (fsel) + { + if (r && fsel->parent) + { + e_int_config_wallpaper_update(fsel->parent, fdest); + } + e_int_config_wallpaper_fsel_del(fsel->win); + } + else + { + if (r) + { + e_bg_default_set(fdest); + e_bg_update(); + } + } + E_FREE(fdest); - e_int_config_wallpaper_del(import->win); return 0; } static void _import_cb_delete(E_Win *win) { - e_int_config_wallpaper_del(win); + e_int_config_wallpaper_import_del(win); } static void @@ -534,30 +648,33 @@ _import_cb_close(void *data, void *data2) E_Win *win; win = data; - e_int_config_wallpaper_del(win); + e_int_config_wallpaper_import_del(win); } static void _import_cb_ok(void *data, void *data2) { Import *import; + FSel *fsel; E_Win *win; - const char *path; const char *file; const char *homedir; char buf[4096]; int is_bg, is_theme; + int r; + r = 0; win = data; if (!(import = win->data)) return; - path = e_widget_fsel_selection_path_get(import->fsel_obj); - E_FREE(import->cfdata->file); - if (path) import->cfdata->file = strdup(path); if (import->cfdata->file) { file = ecore_file_file_get(import->cfdata->file); if (!e_util_glob_case_match(file, "*.edj")) - _import_edj_gen(import); + { + _import_edj_gen(import); + e_win_hide(win); + return; + } else { homedir = e_user_homedir_get(); @@ -574,37 +691,126 @@ _import_cb_ok(void *data, void *data2) { if (!ecore_file_cp(import->cfdata->file, buf)) { - e_int_config_wallpaper_del(win); e_util_dialog_show(_("Wallpaper Import Error"), _("Enlightenment was unable to " "import the wallpaper
due to a " "copy error.")); - return; } else - { - if (import->parent) - e_int_config_wallpaper_update(import->parent, buf); - e_int_config_wallpaper_del(win); - return; - } + r = 1; } else { - e_int_config_wallpaper_del(win); e_util_dialog_show(_("Wallpaper Import Error"), _("Enlightenment was unable to " "import the wallpaper.

" "Are you sure this is a valid " "wallpaper?")); - return; } } - - e_win_hide(win); - return; } - e_int_config_wallpaper_del(win); + + fsel = import->fsel; + e_int_config_wallpaper_import_del(win); + if (fsel) + { + if (r && fsel->parent) + e_int_config_wallpaper_update(fsel->parent, buf); + e_int_config_wallpaper_fsel_del(fsel->win); + } + else + { + if (r) + { + e_bg_default_set(buf); + e_bg_update(); + } + } +} + +static void +_fsel_cb_delete(E_Win *win) +{ + e_int_config_wallpaper_fsel_del(win); +} + +static void +_fsel_cb_resize(E_Win *win) +{ + Import *import; + + if (!(import = win->data)) return; + evas_object_resize(import->bg_obj, win->w, win->h); +} + +static void +_fsel_cb_close(void *data, void *data2) +{ + E_Win *win; + + win = data; + e_int_config_wallpaper_fsel_del(win); +} + +static void +_fsel_cb_ok(void *data, void *data2) +{ + FSel *fsel; + E_Win *win; + const char *path; + const char *p; + + win = data; + if (!(fsel = win->data)) return; + path = e_widget_fsel_selection_path_get(fsel->fsel_obj); + + if (path) p = strrchr(path, '.'); + if ((!p) || (!strcasecmp(p, ".edj"))) + { + int r; + int is_bg, is_theme; + const char *homedir, *file; + char buf[4096]; + + r = 0; + file = ecore_file_file_get(path); + homedir = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds/%s", + homedir, file); + + is_bg = edje_file_group_exists(path, + "e/desktop/background"); + is_theme = + edje_file_group_exists(path, + "e/widgets/border/default/border"); + + if ((is_bg) && (!is_theme)) + { + if (!ecore_file_cp(path, buf)) + { + e_util_dialog_show(_("Wallpaper Import Error"), + _("Enlightenment was unable to " + "import the wallpaper
due to a " + "copy error.")); + } + else + r = 1; + } + else + { + e_util_dialog_show(_("Wallpaper Import Error"), + _("Enlightenment was unable to " + "import the wallpaper.

" + "Are you sure this is a valid " + "wallpaper?")); + } + + if (r && fsel->parent) + e_int_config_wallpaper_update(fsel->parent, buf); + e_int_config_wallpaper_fsel_del(fsel->win); + } + else + e_int_config_wallpaper_import(fsel, path); } static void @@ -619,6 +825,18 @@ _import_cb_wid_on_focus(void *data, Evas_Object *obj) e_widget_focused_object_clear(import->content_obj); } +static void +_fsel_cb_wid_on_focus(void *data, Evas_Object *obj) +{ + FSel *fsel; + + fsel = data; + if (obj == fsel->content_obj) + e_widget_focused_object_clear(fsel->box_obj); + else if (fsel->content_obj) + e_widget_focused_object_clear(fsel->content_obj); +} + static void _import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event) { @@ -677,3 +895,62 @@ _import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event) if (o) e_widget_activate(o); } } + +static void +_fsel_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event) +{ + Evas_Event_Key_Down *ev; + FSel *fsel; + + ev = event; + fsel = data; + if (!strcmp(ev->keyname, "Tab")) + { + if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(fsel->win)), "Shift")) + { + if (e_widget_focus_get(fsel->box_obj)) + { + if (!e_widget_focus_jump(fsel->box_obj, 0)) + { + e_widget_focus_set(fsel->content_obj, 0); + if (!e_widget_focus_get(fsel->content_obj)) + e_widget_focus_set(fsel->box_obj, 0); + } + } + else + { + if (!e_widget_focus_jump(fsel->content_obj, 0)) + e_widget_focus_set(fsel->box_obj, 0); + } + } + else + { + if (e_widget_focus_get(fsel->box_obj)) + { + if (!e_widget_focus_jump(fsel->box_obj, 1)) + { + e_widget_focus_set(fsel->content_obj, 1); + if (!e_widget_focus_get(fsel->content_obj)) + e_widget_focus_set(fsel->box_obj, 1); + } + } + else + { + if (!e_widget_focus_jump(fsel->content_obj, 1)) + e_widget_focus_set(fsel->box_obj, 1); + } + } + } + else if (((!strcmp(ev->keyname, "Return")) || + (!strcmp(ev->keyname, "KP_Enter")) || + (!strcmp(ev->keyname, "space")))) + { + Evas_Object *o = NULL; + + if ((fsel->content_obj) && (e_widget_focus_get(fsel->content_obj))) + o = e_widget_focused_object_get(fsel->content_obj); + else + o = e_widget_focused_object_get(fsel->box_obj); + if (o) e_widget_activate(o); + } +} diff --git a/src/modules/conf_wallpaper/e_int_config_wallpaper_import.h b/src/modules/conf_wallpaper/e_int_config_wallpaper_import.h index 3d6f0f385..552fc2fb9 100644 --- a/src/modules/conf_wallpaper/e_int_config_wallpaper_import.h +++ b/src/modules/conf_wallpaper/e_int_config_wallpaper_import.h @@ -3,7 +3,8 @@ #ifndef E_INT_CONFIG_WALLPAPER_IMPORT_H #define E_INT_CONFIG_WALLPAPER_IMPORT_H -EAPI E_Win *e_int_config_wallpaper_import(E_Config_Dialog *parent); +EAPI E_Win *e_int_config_wallpaper_fsel(E_Config_Dialog *parent); +EAPI E_Win *e_int_config_wallpaper_import(void *data, const char *path); EAPI void e_int_config_wallpaper_del(E_Win *win); #endif