summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-10-06 08:08:24 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-10-06 08:08:24 +0900
commitecdacf03537f210f17c3c572e13f20023f32992f (patch)
tree9c4f86c293472f4d6edf0838eaa283031d43d401
parent9a6dce7f68631f925c949d299ba2131c31e91ee0 (diff)
Introduce current_name_{set|get}
Summary: When fileselector is opened, it would be nice to be able to provide initial filename. Like "Untitled Document" in Gedit, when save for the first time. More details in Gedit, Gedit provies default name, "Untitled Document" and does not change default name while navigating directories. Once we selected any file, Gedit changes value of name entry to selected filename and it is not also changed while navigating directories. @feature Reviewers: seoz, yakov-g Reviewed By: yakov-g Subscribers: seoz Maniphest Tasks: T1664 Differential Revision: https://phab.enlightenment.org/D1504
-rw-r--r--src/bin/test_fileselector.c3
-rw-r--r--src/lib/elc_fileselector.c46
-rw-r--r--src/lib/elc_fileselector_legacy.h3
-rw-r--r--src/lib/elm_fileselector.eo1
-rw-r--r--src/lib/elm_interface_fileselector.eo11
5 files changed, 55 insertions, 9 deletions
diff --git a/src/bin/test_fileselector.c b/src/bin/test_fileselector.c
index b32cd87bd..18dcae602 100644
--- a/src/bin/test_fileselector.c
+++ b/src/bin/test_fileselector.c
@@ -550,6 +550,9 @@ test_fileselector(void *data EINA_UNUSED,
550 /* start the fileselector in the home dir */ 550 /* start the fileselector in the home dir */
551 elm_fileselector_path_set(fs, getenv("HOME")); 551 elm_fileselector_path_set(fs, getenv("HOME"));
552 552
553 /* provides suggested name (just for showing) */
554 elm_fileselector_current_name_set(fs, "No name");
555
553 /* add filesters */ 556 /* add filesters */
554 elm_fileselector_mime_types_filter_append(fs, "text/*", "Text Files"); 557 elm_fileselector_mime_types_filter_append(fs, "text/*", "Text Files");
555 elm_fileselector_mime_types_filter_append(fs, "image/*", "Image Files"); 558 elm_fileselector_mime_types_filter_append(fs, "image/*", "Image Files");
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index 7a83cd177..9ca256314 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -553,7 +553,6 @@ _signal_first(Listing_Request *lreq)
553 elm_gengrid_clear(lreq->sd->files_view); 553 elm_gengrid_clear(lreq->sd->files_view);
554 eina_stringshare_replace(&lreq->sd->path, lreq->path); 554 eina_stringshare_replace(&lreq->sd->path, lreq->path);
555 _anchors_do(lreq->obj, lreq->path); 555 _anchors_do(lreq->obj, lreq->path);
556 elm_object_text_set(lreq->sd->name_entry, "");
557 } 556 }
558 557
559 lreq->first = EINA_FALSE; 558 lreq->first = EINA_FALSE;
@@ -690,6 +689,11 @@ _populate(Evas_Object *obj,
690 _ls_done_cb, _ls_error_cb, lreq); 689 _ls_done_cb, _ls_error_cb, lreq);
691 elm_progressbar_pulse(sd->spinner, EINA_TRUE); 690 elm_progressbar_pulse(sd->spinner, EINA_TRUE);
692 elm_layout_signal_emit(lreq->obj, "elm,action,spinner,show", "elm"); 691 elm_layout_signal_emit(lreq->obj, "elm,action,spinner,show", "elm");
692
693 // Clear name entry not in case of save mode.
694 if (elm_object_disabled_get(sd->name_entry))
695 elm_object_text_set(sd->name_entry, "");
696
693} 697}
694 698
695static void 699static void
@@ -874,15 +878,10 @@ _on_item_selected(void *data,
874 878
875 evas_object_smart_callback_call(data, SIG_SELECTED, (void *)path); 879 evas_object_smart_callback_call(data, SIG_SELECTED, (void *)path);
876 } 880 }
877 else 881 else if (sd->multi && is_dir && sd->double_tap_navigation)
878 { 882 {
879 if (sd->multi && is_dir && sd->double_tap_navigation) 883 _clear_selections(sd, it);
880 { 884 sd->dir_selected = EINA_TRUE;
881 _clear_selections(sd, it);
882 sd->dir_selected = EINA_TRUE;
883 }
884
885 elm_object_text_set(sd->name_entry, "");
886 } 885 }
887 886
888 /* We need to populate, if path is directory and: 887 /* We need to populate, if path is directory and:
@@ -1946,6 +1945,35 @@ _elm_fileselector_elm_interface_fileselector_selected_paths_get(Eo *obj EINA_UNU
1946 return NULL; 1945 return NULL;
1947} 1946}
1948 1947
1948EAPI const char *
1949elm_fileselector_current_name_get(const Evas_Object *obj)
1950{
1951 ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
1952 const char *ret = NULL;
1953 eo_do((Eo *) obj, ret = elm_interface_fileselector_current_name_get());
1954 return ret;
1955}
1956
1957EOLIAN static const char *
1958_elm_fileselector_elm_interface_fileselector_current_name_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd)
1959{
1960 return elm_object_text_get(sd->name_entry);
1961}
1962
1963EAPI void
1964elm_fileselector_current_name_set(Evas_Object *obj,
1965 const char *name)
1966{
1967 ELM_FILESELECTOR_INTERFACE_CHECK(obj);
1968 eo_do((Eo *) obj, elm_interface_fileselector_current_name_set(name));
1969}
1970
1971EOLIAN static void
1972_elm_fileselector_elm_interface_fileselector_current_name_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Data *sd, const char *name)
1973{
1974 elm_object_text_set(sd->name_entry, name);
1975}
1976
1949static Elm_Fileselector_Filter * 1977static Elm_Fileselector_Filter *
1950_filter_add(Elm_Fileselector_Data *sd, const char *filter_name) 1978_filter_add(Elm_Fileselector_Data *sd, const char *filter_name)
1951{ 1979{
diff --git a/src/lib/elc_fileselector_legacy.h b/src/lib/elc_fileselector_legacy.h
index 9aa97d182..2c7fcd6a5 100644
--- a/src/lib/elc_fileselector_legacy.h
+++ b/src/lib/elc_fileselector_legacy.h
@@ -245,6 +245,9 @@ EAPI Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const
245 */ 245 */
246EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj); 246EAPI const char *elm_fileselector_selected_get(const Evas_Object *obj);
247 247
248EAPI void elm_fileselector_current_name_set(Evas_Object *obj, const char *name);
249EAPI const char *elm_fileselector_current_name_get(const Evas_Object *obj);
250
248/** 251/**
249 * Get a list of selected paths in the file selector. 252 * Get a list of selected paths in the file selector.
250 * 253 *
diff --git a/src/lib/elm_fileselector.eo b/src/lib/elm_fileselector.eo
index 9b85ae434..ea68eb226 100644
--- a/src/lib/elm_fileselector.eo
+++ b/src/lib/elm_fileselector.eo
@@ -62,6 +62,7 @@ class Elm_Fileselector (Elm_Layout, Elm_Interface_Fileselector,
62 Elm_Interface_Fileselector.multi_select; 62 Elm_Interface_Fileselector.multi_select;
63 Elm_Interface_Fileselector.folder_only; 63 Elm_Interface_Fileselector.folder_only;
64 Elm_Interface_Fileselector.mode; 64 Elm_Interface_Fileselector.mode;
65 Elm_Interface_Fileselector.current_name;
65 Elm_Interface_Atspi_Widget_Action.elm_actions.get; 66 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
66 } 67 }
67 events { 68 events {
diff --git a/src/lib/elm_interface_fileselector.eo b/src/lib/elm_interface_fileselector.eo
index 401e33e05..c239cf6ba 100644
--- a/src/lib/elm_interface_fileselector.eo
+++ b/src/lib/elm_interface_fileselector.eo
@@ -123,6 +123,17 @@ interface Elm_Interface_Fileselector ()
123 const(list)* ret; 123 const(list)* ret;
124 } 124 }
125 } 125 }
126 current_name {
127 set {
128 /*@ Set, */
129 }
130 get {
131 /*@ Get */
132 }
133 values {
134 const(char)* name;
135 }
136 }
126 } 137 }
127 methods { 138 methods {
128 custom_filter_append { 139 custom_filter_append {