summaryrefslogtreecommitdiff
path: root/src/edje_external/elementary/elm_fileselector.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-23 12:56:14 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-03-23 13:24:41 -0700
commitc2a1c49ab2042f559b28e840e54feb8494888e0e (patch)
treec6eb110b7c479499854eede9d0c3ab0a80c9a11a /src/edje_external/elementary/elm_fileselector.c
parent9340855597e7e465435c69b6278650346688da14 (diff)
elementary: move all legacy files to their expected new location.
Diffstat (limited to 'src/edje_external/elementary/elm_fileselector.c')
-rw-r--r--src/edje_external/elementary/elm_fileselector.c188
1 files changed, 188 insertions, 0 deletions
diff --git a/src/edje_external/elementary/elm_fileselector.c b/src/edje_external/elementary/elm_fileselector.c
new file mode 100644
index 0000000..6884fd1
--- /dev/null
+++ b/src/edje_external/elementary/elm_fileselector.c
@@ -0,0 +1,188 @@
1#include <assert.h>
2#include "private.h"
3
4typedef struct _Elm_Params_Fileselector
5{
6 Elm_Params base;
7 Eina_Bool is_save:1;
8 Eina_Bool is_save_set:1;
9 Eina_Bool folder_only:1;
10 Eina_Bool folder_only_set:1;
11 Eina_Bool show_buttons:1;
12 Eina_Bool show_buttons_set:1;
13 Eina_Bool expandable:1;
14 Eina_Bool expandable_set:1;
15} Elm_Params_Fileselector;
16
17static void
18external_fileselector_state_set(void *data EINA_UNUSED, Evas_Object *obj,
19 const void *from_params, const void *to_params,
20 float pos EINA_UNUSED)
21{
22 const Elm_Params_Fileselector *p;
23
24 if (to_params) p = to_params;
25 else if (from_params) p = from_params;
26 else return;
27
28 if ((p->is_save_set) && (p->is_save))
29 elm_fileselector_is_save_set(obj, p->is_save);
30 if (p->folder_only_set)
31 elm_fileselector_folder_only_set(obj, p->folder_only);
32 if (p->show_buttons_set)
33 elm_fileselector_buttons_ok_cancel_set(obj, p->show_buttons);
34 if (p->expandable_set)
35 elm_fileselector_expandable_set(obj, p->expandable);
36}
37
38static Eina_Bool
39external_fileselector_param_set(void *data EINA_UNUSED, Evas_Object *obj,
40 const Edje_External_Param *param)
41{
42 if (!strcmp(param->name, "save"))
43 {
44 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
45 {
46 elm_fileselector_is_save_set(obj, param->i);
47 return EINA_TRUE;
48 }
49 }
50 else if (!strcmp(param->name, "folder only"))
51 {
52 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
53 {
54 elm_fileselector_folder_only_set(obj, param->i);
55 return EINA_TRUE;
56 }
57 }
58 else if (!strcmp(param->name, "show buttons"))
59 {
60 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
61 {
62 elm_fileselector_buttons_ok_cancel_set(obj, param->i);
63 return EINA_TRUE;
64 }
65 }
66 else if (!strcmp(param->name, "expandable"))
67 {
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
69 {
70 elm_fileselector_expandable_set(obj, param->i);
71 return EINA_TRUE;
72 }
73 }
74
75 ERR("unknown parameter '%s' of type '%s'",
76 param->name, edje_external_param_type_str(param->type));
77
78 return EINA_FALSE;
79}
80
81static Eina_Bool
82external_fileselector_param_get(void *data EINA_UNUSED, const Evas_Object *obj,
83 Edje_External_Param *param)
84{
85 if (!strcmp(param->name, "save"))
86 {
87 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
88 {
89 param->i = elm_fileselector_is_save_get(obj);
90 return EINA_TRUE;
91 }
92 }
93 else if (!strcmp(param->name, "folder only"))
94 {
95 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
96 {
97 param->i = elm_fileselector_folder_only_get(obj);
98 return EINA_TRUE;
99 }
100 }
101 else if (!strcmp(param->name, "show buttons"))
102 {
103 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
104 {
105 param->i = elm_fileselector_buttons_ok_cancel_get(obj);
106 return EINA_TRUE;
107 }
108 }
109 else if (!strcmp(param->name, "expandable"))
110 {
111 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
112 {
113 param->i = elm_fileselector_expandable_get(obj);
114 return EINA_TRUE;
115 }
116 }
117
118 ERR("unknown parameter '%s' of type '%s'",
119 param->name, edje_external_param_type_str(param->type));
120
121 return EINA_FALSE;
122}
123
124static void *
125external_fileselector_params_parse(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const Eina_List *params)
126{
127 Elm_Params_Fileselector *mem;
128 Edje_External_Param *param;
129 const Eina_List *l;
130
131 mem = calloc(1, sizeof(Elm_Params_Fileselector));
132 if (!mem)
133 return NULL;
134
135 EINA_LIST_FOREACH(params, l, param)
136 {
137 if (!strcmp(param->name, "save"))
138 {
139 mem->is_save = !!param->i;
140 mem->is_save_set = EINA_TRUE;
141 }
142 else if (!strcmp(param->name, "folder only"))
143 {
144 mem->folder_only = !!param->i;
145 mem->folder_only_set = EINA_TRUE;
146 }
147 else if (!strcmp(param->name, "show buttons"))
148 {
149 mem->show_buttons = !!param->i;
150 mem->show_buttons_set = EINA_TRUE;
151 }
152 else if (!strcmp(param->name, "expandable"))
153 {
154 mem->expandable = !!param->i;
155 mem->expandable_set = EINA_TRUE;
156 }
157 }
158
159 return mem;
160}
161
162static Evas_Object *external_fileselector_content_get(void *data EINA_UNUSED,
163 const Evas_Object *obj EINA_UNUSED,
164 const char *content EINA_UNUSED)
165{
166 ERR("No content.");
167 return NULL;
168}
169
170static void
171external_fileselector_params_free(void *params)
172{
173 Elm_Params_Fileselector *mem = params;
174 free(mem);
175}
176
177static Edje_External_Param_Info external_fileselector_params[] =
178{
179 DEFINE_EXTERNAL_COMMON_PARAMS,
180 EDJE_EXTERNAL_PARAM_INFO_BOOL("save"),
181 EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"),
182 EDJE_EXTERNAL_PARAM_INFO_BOOL("show buttons"),
183 EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"),
184 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
185};
186
187DEFINE_EXTERNAL_ICON_ADD(fileselector, "fileselector");
188DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector, "Fileselector");