aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-04 22:36:06 +1000
committerDavid Walter Seikel2014-05-04 22:36:06 +1000
commitfd753bf90b8f529b0f95b93cb187103286a3f9ac (patch)
treeda13bcc45ae2dcc8861fa2279bc8d1d2e8ac1a85
parentCombine eo_add() and eo_do(), plus related cleanups. (diff)
downloadSledjHamr-fd753bf90b8f529b0f95b93cb187103286a3f9ac.zip
SledjHamr-fd753bf90b8f529b0f95b93cb187103286a3f9ac.tar.gz
SledjHamr-fd753bf90b8f529b0f95b93cb187103286a3f9ac.tar.bz2
SledjHamr-fd753bf90b8f529b0f95b93cb187103286a3f9ac.tar.xz
Fold some common code into widgetAdd, and related cleanups.
-rw-r--r--src/extantz/chat.c14
-rw-r--r--src/extantz/extantz.h4
-rw-r--r--src/extantz/fangWin.c12
-rw-r--r--src/extantz/files.c12
4 files changed, 22 insertions, 20 deletions
diff --git a/src/extantz/chat.c b/src/extantz/chat.c
index d5e492e..e814842 100644
--- a/src/extantz/chat.c
+++ b/src/extantz/chat.c
@@ -35,19 +35,13 @@ fangWin *chat_add(globals *ourGlobals)
35 elm_box_pack_end(bx, en); 35 elm_box_pack_end(bx, en);
36 eo_unref(en); 36 eo_unref(en);
37 37
38 en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win); 38 wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, "");
39 wid = widgetAdd(me);
40 wid->obj = en;
41 wid->on_del = _on_entry_del; 39 wid->on_del = _on_entry_del;
42 elm_object_text_set(en, ""); 40 eo_do(wid->obj,
43 eo_do(en,
44 elm_obj_entry_scrollable_set(EINA_TRUE), 41 elm_obj_entry_scrollable_set(EINA_TRUE),
45 elm_obj_entry_editable_set(EINA_TRUE), 42 elm_obj_entry_editable_set(EINA_TRUE)
46 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
47 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
48 evas_obj_visibility_set(EINA_TRUE)
49 ); 43 );
50 elm_box_pack_end(bx, en); 44 elm_box_pack_end(bx, wid->obj);
51 45
52 evas_object_show(bx); 46 evas_object_show(bx);
53 eo_unref(bx); 47 eo_unref(bx);
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h
index 84ebcba..a4001c7 100644
--- a/src/extantz/extantz.h
+++ b/src/extantz/extantz.h
@@ -242,6 +242,8 @@ typedef struct _globals
242 GLData gld; 242 GLData gld;
243 Scene_Data *scene; 243 Scene_Data *scene;
244 244
245 Eina_Clist windows;
246
245 fangWin *files; 247 fangWin *files;
246} globals; 248} globals;
247 249
@@ -273,7 +275,7 @@ fangWin *fang_win_add(globals *ourGlobals);
273void fang_win_complete(globals *ourGlobals, fangWin *win, int x, int y, int w, int h); 275void fang_win_complete(globals *ourGlobals, fangWin *win, int x, int y, int w, int h);
274void fang_win_del(globals *ourGlobals, fangWin *win); 276void fang_win_del(globals *ourGlobals, fangWin *win);
275void overlay_add(globals *ourGlobals); 277void overlay_add(globals *ourGlobals);
276Widget *widgetAdd(fangWin *win); 278Widget *widgetAdd(fangWin *win, const Eo_Class *klass, Evas_Object *parent, char *title);
277 279
278fangWin *chat_add(globals *ourGlobals); 280fangWin *chat_add(globals *ourGlobals);
279fangWin *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); 281fangWin *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save);
diff --git a/src/extantz/fangWin.c b/src/extantz/fangWin.c
index 7a9f0d5..88a5c00 100644
--- a/src/extantz/fangWin.c
+++ b/src/extantz/fangWin.c
@@ -174,7 +174,7 @@ void overlay_add(globals *ourGlobals)
174 evas_object_show(gld->winwin); 174 evas_object_show(gld->winwin);
175} 175}
176 176
177Widget *widgetAdd(fangWin *win) 177Widget *widgetAdd(fangWin *win, const Eo_Class *klass, Evas_Object *parent, char *title)
178{ 178{
179 Widget *result; 179 Widget *result;
180 180
@@ -182,5 +182,15 @@ Widget *widgetAdd(fangWin *win)
182 strcpy(result->magic, "Widget"); 182 strcpy(result->magic, "Widget");
183 eina_clist_add_head(&win->widgets, &result->node); 183 eina_clist_add_head(&win->widgets, &result->node);
184 184
185 if (parent)
186 {
187 result->obj = eo_add(klass, parent,
188 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
189 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
190 evas_obj_visibility_set(EINA_TRUE)
191 );
192 if (title) elm_object_text_set(result->obj, title);
193 }
194
185 return result; 195 return result;
186} 196}
diff --git a/src/extantz/files.c b/src/extantz/files.c
index 06cd257..816894f 100644
--- a/src/extantz/files.c
+++ b/src/extantz/files.c
@@ -155,19 +155,15 @@ fangWin *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa
155 ); 155 );
156 elm_win_resize_object_add(me->win, bx); 156 elm_win_resize_object_add(me->win, bx);
157 157
158 fs = eo_add(ELM_OBJ_FILESELECTOR_CLASS, bx); 158 wid = widgetAdd(me, ELM_OBJ_FILESELECTOR_CLASS, bx, NULL);
159 me->data = fs; 159 fs = wid->obj;
160 wid = widgetAdd(me);
161 wid->obj = fs;
162 wid->data = ourGlobals; 160 wid->data = ourGlobals;
163 wid->on_del = _on_fs_del; 161 wid->on_del = _on_fs_del;
162 me->data = fs;
164 eo_do(fs, 163 eo_do(fs,
165 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
166 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
167 elm_obj_fileselector_buttons_ok_cancel_set(EINA_FALSE), 164 elm_obj_fileselector_buttons_ok_cancel_set(EINA_FALSE),
168 elm_interface_fileselector_expandable_set(EINA_TRUE), 165 elm_interface_fileselector_expandable_set(EINA_TRUE),
169 elm_interface_fileselector_folder_only_set(EINA_FALSE), 166 elm_interface_fileselector_folder_only_set(EINA_FALSE)
170 evas_obj_visibility_set(EINA_TRUE)
171 ); 167 );
172 elm_box_pack_end(bx, fs); 168 elm_box_pack_end(bx, fs);
173 169