summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS1
-rw-r--r--config/standard/base.src1
-rw-r--r--src/lib/elc_fileselector.c133
-rw-r--r--src/lib/elm_config.c5
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_widget_fileselector.h3
7 files changed, 105 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index 7dc0c7ac2..e3bce088d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1659,3 +1659,8 @@
1659 the content is static object and it won't be updated by content 1659 the content is static object and it won't be updated by content
1660 position. This actually reduces the mapbuf calculation time muchly in 1660 position. This actually reduces the mapbuf calculation time muchly in
1661 case of complex layout. 1661 case of complex layout.
1662
16632013-10-01 Ryuan Choi (ryuan)
1664
1665 * fileselector: Add the configuration fileselector_double_tap_navigation_enable.
1666 It makes fileselector navigate folder using double tap instead of single tap.
diff --git a/NEWS b/NEWS
index d31e51ab7..72139a07f 100644
--- a/NEWS
+++ b/NEWS
@@ -94,6 +94,7 @@ Additions:
94 * Add "dismissed" smart callback for hover. 94 * Add "dismissed" smart callback for hover.
95 * Add "dismissed" smart callback for menu. 95 * Add "dismissed" smart callback for menu.
96 * Add elm_menu_item_subitems_clear(). 96 * Add elm_menu_item_subitems_clear().
97 * Add the configuration fileselector_double_tap_navigation_enable.
97 98
98Improvements: 99Improvements:
99 100
diff --git a/config/standard/base.src b/config/standard/base.src
index b0eb81cd2..5f974ff83 100644
--- a/config/standard/base.src
+++ b/config/standard/base.src
@@ -46,6 +46,7 @@ group "Elm_Config" struct {
46 value "focus_highlight_animate" uchar: 0; 46 value "focus_highlight_animate" uchar: 0;
47 value "toolbar_shrink_mode" int: 3; 47 value "toolbar_shrink_mode" int: 3;
48 value "fileselector_expand_enable" uchar: 1; 48 value "fileselector_expand_enable" uchar: 1;
49 value "fileselector_double_tap_navigation_enable" uchar: 1;
49 value "inwin_dialogs_enable" uchar: 0; 50 value "inwin_dialogs_enable" uchar: 0;
50 value "icon_size" int: 32; 51 value "icon_size" int: 32;
51 value "longpress_timeout" double: 1.0; 52 value "longpress_timeout" double: 1.0;
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index 3fa313627..b0ae94600 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -49,7 +49,7 @@ _elm_fileselector_smart_del_do(Elm_Fileselector_Smart_Data *sd)
49{ 49{
50 if (sd->path) eina_stringshare_del(sd->path); 50 if (sd->path) eina_stringshare_del(sd->path);
51 if (sd->selection) eina_stringshare_del(sd->selection); 51 if (sd->selection) eina_stringshare_del(sd->selection);
52 if (sd->sel_idler) free(ecore_idler_del(sd->sel_idler)); 52 if (sd->populate_idler) free(ecore_idler_del(sd->populate_idler));
53 53
54 eo_do_super(sd->obj, MY_CLASS, evas_obj_smart_del()); 54 eo_do_super(sd->obj, MY_CLASS, evas_obj_smart_del());
55} 55}
@@ -658,45 +658,60 @@ _on_list_contract_req(void *data __UNUSED__,
658} 658}
659 659
660static Eina_Bool 660static Eina_Bool
661_sel_do(void *data) 661_populate_do(void *data)
662{ 662{
663 struct sel_data *sdata = data; 663 struct sel_data *sdata = data;
664 const char *path;
665 const char *p; 664 const char *p;
666 Eina_Bool is_dir;
667 665
668 ELM_FILESELECTOR_DATA_GET(sdata->fs, sd); 666 ELM_FILESELECTOR_DATA_GET(sdata->fs, sd);
669 path = sdata->path;
670 is_dir = ecore_file_is_dir(path);
671 667
672 /* We need to populate, if path is directory and: 668 /* keep a ref to path 'couse it will be destroyed by _populate */
673 * - mode is GRID; 669 p = eina_stringshare_add(sdata->path);
674 * - mode is LIST and 'not expand mode'; 670 _populate(sdata->fs, p, NULL, NULL);
675 * in other cases update anchors. */ 671 eina_stringshare_del(p);
676 if (((!sd->expand) || (sd->mode == ELM_FILESELECTOR_GRID)) && (is_dir))
677 {
678 /* keep a ref to path 'couse it will be destroyed by _populate */
679 p = eina_stringshare_add(path);
680 _populate(sdata->fs, p, NULL, NULL);
681 eina_stringshare_del(p);
682 }
683 else
684 {
685 elm_object_text_set(sd->name_entry, ecore_file_file_get(path));
686 }
687
688 /* We need to send callback when:
689 * - path is dir and mode is ONLY FOLDER
690 * - path is file and mode is NOT ONLY FOLDER */
691 if (is_dir == sd->only_folder)
692 evas_object_smart_callback_call(sdata->fs, SIG_SELECTED, (void *)path);
693 672
694 sd->sel_idler = NULL; 673 sd->populate_idler = NULL;
695 free(sdata); 674 free(sdata);
696 return ECORE_CALLBACK_CANCEL; 675 return ECORE_CALLBACK_CANCEL;
697} 676}
698 677
699static void 678static void
679_on_item_double_clicked(void *data,
680 Evas_Object *obj __UNUSED__,
681 void *event_info)
682{
683 //This event_info could be a list or gengrid item
684 Elm_Object_Item *it = event_info;
685 struct sel_data *sdata;
686 void *old_sdata;
687 const char *path;
688 Eina_Bool is_dir;
689
690 ELM_FILESELECTOR_DATA_GET(data, sd);
691
692 if (!sd->double_tap_navigation) return;
693
694 path = elm_object_item_data_get(it);
695 if (!path) return;
696
697 is_dir = ecore_file_is_dir(path);
698 if (!is_dir) return;
699
700 sdata = malloc(sizeof(*sdata));
701 if (!sdata) return;
702
703 sdata->fs = data;
704 sdata->path = path;
705
706 if (sd->populate_idler)
707 {
708 old_sdata = ecore_idler_del(sd->populate_idler);
709 free(old_sdata);
710 }
711 sd->populate_idler = ecore_idler_add(_populate_do, sdata);
712}
713
714static void
700_on_item_selected(void *data, 715_on_item_selected(void *data,
701 Evas_Object *obj __UNUSED__, 716 Evas_Object *obj __UNUSED__,
702 void *event_info) 717 void *event_info)
@@ -704,37 +719,66 @@ _on_item_selected(void *data,
704 //This event_info could be a list or gengrid item 719 //This event_info could be a list or gengrid item
705 Elm_Object_Item *it = event_info; 720 Elm_Object_Item *it = event_info;
706 struct sel_data *sdata; 721 struct sel_data *sdata;
707 void *old_sd; 722 void *old_sdata;
708 char *dir;
709 const char *path; 723 const char *path;
724 char *parent_path;
725 Eina_Bool is_dir;
710 726
711 ELM_FILESELECTOR_DATA_GET(data, sd); 727 ELM_FILESELECTOR_DATA_GET(data, sd);
712 728
713 path = elm_object_item_data_get(it); 729 path = elm_object_item_data_get(it);
714 if (!path) 730 if (!path) return;
715 return;
716 731
717 if (sd->only_folder) 732 is_dir = ecore_file_is_dir(path);
718 eina_stringshare_replace(&sd->path, path); 733
719 else 734 /* We need to send callback when:
735 * - path is dir and mode is ONLY FOLDER
736 * - path is file and mode is NOT ONLY FOLDER */
737 if (is_dir == sd->only_folder)
720 { 738 {
721 dir = ecore_file_dir_get(path); 739 elm_object_text_set(sd->name_entry, ecore_file_file_get(path));
722 if (!dir) return; 740 evas_object_smart_callback_call(data, SIG_SELECTED, (void *)path);
741 }
742 else
743 elm_object_text_set(sd->name_entry, "");
744
745 /* We need to populate, if path is directory and:
746 * - mode is GRID;
747 * - mode is LIST and 'not expand mode';
748 * in other cases update anchors. */
749 if (!is_dir) return;
723 750
724 eina_stringshare_replace(&sd->path, dir); 751 if (sd->expand && sd->mode == ELM_FILESELECTOR_LIST)
725 free(dir); 752 {
753 if (sd->only_folder)
754 {
755 parent_path = ecore_file_dir_get(path);
756 eina_stringshare_replace(&sd->path, parent_path);
757 _anchors_do(data, parent_path);
758 free(parent_path);
759 }
760 else
761 {
762 eina_stringshare_replace(&sd->path, path);
763 _anchors_do(data, path);
764 }
765 return;
726 } 766 }
727 767
768 if (sd->double_tap_navigation) return;
769
728 sdata = malloc(sizeof(*sdata)); 770 sdata = malloc(sizeof(*sdata));
771 if (!sdata) return;
772
729 sdata->fs = data; 773 sdata->fs = data;
730 sdata->path = path; 774 sdata->path = path;
731 775
732 if (sd->sel_idler) 776 if (sd->populate_idler)
733 { 777 {
734 old_sd = ecore_idler_del(sd->sel_idler); 778 old_sdata = ecore_idler_del(sd->populate_idler);
735 free(old_sd); 779 free(old_sdata);
736 } 780 }
737 sd->sel_idler = ecore_idler_add(_sel_do, sdata); 781 sd->populate_idler = ecore_idler_add(_populate_do, sdata);
738} 782}
739 783
740static void 784static void
@@ -956,6 +1000,7 @@ _elm_fileselector_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
956 elm_widget_can_focus_set(obj, EINA_FALSE); 1000 elm_widget_can_focus_set(obj, EINA_FALSE);
957 1001
958 priv->expand = !!_elm_config->fileselector_expand_enable; 1002 priv->expand = !!_elm_config->fileselector_expand_enable;
1003 priv->double_tap_navigation = !!_elm_config->fileselector_double_tap_navigation_enable;
959 1004
960 if (!elm_layout_theme_set 1005 if (!elm_layout_theme_set
961 (obj, "fileselector", "base", elm_widget_style_get(obj))) 1006 (obj, "fileselector", "base", elm_widget_style_get(obj)))
@@ -1019,6 +1064,7 @@ _elm_fileselector_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1019 elm_gengrid_align_set(grid, 0.0, 0.0); 1064 elm_gengrid_align_set(grid, 0.0, 0.0);
1020 1065
1021 evas_object_smart_callback_add(li, "selected", _on_item_selected, obj); 1066 evas_object_smart_callback_add(li, "selected", _on_item_selected, obj);
1067 evas_object_smart_callback_add(li, "clicked,double", _on_item_double_clicked, obj);
1022 evas_object_smart_callback_add 1068 evas_object_smart_callback_add
1023 (li, "expand,request", _on_list_expand_req, obj); 1069 (li, "expand,request", _on_list_expand_req, obj);
1024 evas_object_smart_callback_add 1070 evas_object_smart_callback_add
@@ -1026,6 +1072,7 @@ _elm_fileselector_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1026 evas_object_smart_callback_add(li, "expanded", _on_list_expanded, obj); 1072 evas_object_smart_callback_add(li, "expanded", _on_list_expanded, obj);
1027 evas_object_smart_callback_add(li, "contracted", _on_list_contracted, obj); 1073 evas_object_smart_callback_add(li, "contracted", _on_list_contracted, obj);
1028 evas_object_smart_callback_add(grid, "selected", _on_item_selected, obj); 1074 evas_object_smart_callback_add(grid, "selected", _on_item_selected, obj);
1075 evas_object_smart_callback_add(grid, "clicked,double", _on_item_double_clicked, obj);
1029 1076
1030 elm_widget_sub_object_add(obj, li); 1077 elm_widget_sub_object_add(obj, li);
1031 elm_widget_sub_object_add(obj, grid); 1078 elm_widget_sub_object_add(obj, grid);
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index f04d01c84..dd9598c14 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -380,6 +380,7 @@ _desc_init(void)
380 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR); 380 ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
381 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT); 381 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
382 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR); 382 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
383 ELM_CONFIG_VAL(D, T, fileselector_double_tap_navigation_enable, T_UCHAR);
383 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR); 384 ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR);
384 ELM_CONFIG_VAL(D, T, icon_size, T_INT); 385 ELM_CONFIG_VAL(D, T, icon_size, T_INT);
385 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE); 386 ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
@@ -1125,6 +1126,7 @@ _config_load(void)
1125 _elm_config->focus_highlight_animate = EINA_TRUE; 1126 _elm_config->focus_highlight_animate = EINA_TRUE;
1126 _elm_config->toolbar_shrink_mode = 2; 1127 _elm_config->toolbar_shrink_mode = 2;
1127 _elm_config->fileselector_expand_enable = EINA_FALSE; 1128 _elm_config->fileselector_expand_enable = EINA_FALSE;
1129 _elm_config->fileselector_double_tap_navigation_enable = EINA_FALSE;
1128 _elm_config->inwin_dialogs_enable = EINA_FALSE; 1130 _elm_config->inwin_dialogs_enable = EINA_FALSE;
1129 _elm_config->icon_size = 32; 1131 _elm_config->icon_size = 32;
1130 _elm_config->longpress_timeout = 1.0; 1132 _elm_config->longpress_timeout = 1.0;
@@ -1673,6 +1675,9 @@ _env_get(void)
1673 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE"); 1675 s = getenv("ELM_FILESELECTOR_EXPAND_ENABLE");
1674 if (s) _elm_config->fileselector_expand_enable = !!atoi(s); 1676 if (s) _elm_config->fileselector_expand_enable = !!atoi(s);
1675 1677
1678 s = getenv("ELM_FILESELECTOR_DOUBLE_TAP_NAVIGATION_ENABLE");
1679 if (s) _elm_config->fileselector_double_tap_navigation_enable = !!atoi(s);
1680
1676 s = getenv("ELM_INWIN_DIALOGS_ENABLE"); 1681 s = getenv("ELM_INWIN_DIALOGS_ENABLE");
1677 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s); 1682 if (s) _elm_config->inwin_dialogs_enable = !!atoi(s);
1678 1683
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 3b43390b5..e6f91ccf3 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -209,6 +209,7 @@ struct _Elm_Config
209 unsigned char focus_highlight_animate; 209 unsigned char focus_highlight_animate;
210 int toolbar_shrink_mode; 210 int toolbar_shrink_mode;
211 unsigned char fileselector_expand_enable; 211 unsigned char fileselector_expand_enable;
212 unsigned char fileselector_double_tap_navigation_enable;
212 unsigned char inwin_dialogs_enable; 213 unsigned char inwin_dialogs_enable;
213 int icon_size; 214 int icon_size;
214 double longpress_timeout; 215 double longpress_timeout;
diff --git a/src/lib/elm_widget_fileselector.h b/src/lib/elm_widget_fileselector.h
index a2fe394db..875a2b79a 100644
--- a/src/lib/elm_widget_fileselector.h
+++ b/src/lib/elm_widget_fileselector.h
@@ -41,7 +41,7 @@ struct _Elm_Fileselector_Smart_Data
41 41
42 const char *path; 42 const char *path;
43 const char *selection; 43 const char *selection;
44 Ecore_Idler *sel_idler; 44 Ecore_Idler *populate_idler;
45 45
46 const char *path_separator; 46 const char *path_separator;
47 47
@@ -53,6 +53,7 @@ struct _Elm_Fileselector_Smart_Data
53 53
54 Eina_Bool only_folder : 1; 54 Eina_Bool only_folder : 1;
55 Eina_Bool expand : 1; 55 Eina_Bool expand : 1;
56 Eina_Bool double_tap_navigation : 1;
56}; 57};
57 58
58struct sel_data 59struct sel_data