summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-03-20 16:45:01 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:56:26 +0200
commit7e4c3ca6662f647b08885e2f3b11d50389d26cac (patch)
tree3c8628a3aed09f66a2525f6dbacc3f227373b04a
parent9f5a89ae3fe73fabfb04d95e119ccd68f33d9de9 (diff)
Settingspanel: removed usage of evas_object_data_set
-rw-r--r--src/lib/elc_settingspane.c85
1 files changed, 42 insertions, 43 deletions
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index 50aa7c97d..95f294995 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -26,6 +26,11 @@
26 26
27typedef struct 27typedef struct
28{ 28{
29 Evas_Object *o;
30} Menu;
31
32typedef struct
33{
29 Elm_Settingspane_Item *zero; 34 Elm_Settingspane_Item *zero;
30 35
31 // list of all Elm_Item_Object 36 // list of all Elm_Item_Object
@@ -37,10 +42,13 @@ typedef struct
37 struct 42 struct
38 { 43 {
39 Eina_Bool on; 44 Eina_Bool on;
40 Evas_Object *display; 45 Evas_Object *display, *grid, *obj;
41 Ecore_Thread *run; 46 Ecore_Thread *run;
42 const char* keyword; 47 const char* keyword;
43 } search; 48 } search;
49 Evas_Object *title_box, *search_label, *search_results, *unsaved_opened;
50 Evas_Object *table_panel;
51 Evas_Object *table_menu;
44} Elm_Settingspane_Data; 52} Elm_Settingspane_Data;
45 53
46typedef struct 54typedef struct
@@ -96,18 +104,13 @@ static void _search_panel_stop(Evas_Object *w);
96#define HAS_PANEL(id) (id->panel.content_get) 104#define HAS_PANEL(id) (id->panel.content_get)
97/* Data Keys in the layouts, DK = Data Key */ 105/* Data Keys in the layouts, DK = Data Key */
98 106
99#define DK_MAIN_MENU_TABLE "__menu_table"
100#define DK_MAIN_MENU_SHOWED "__menu_layout_show" 107#define DK_MAIN_MENU_SHOWED "__menu_layout_show"
101#define DK_MAIN_MENU_HIDDEN "__menu_layout_hidden" 108#define DK_MAIN_MENU_HIDDEN "__menu_layout_hidden"
102#define DK_MAIN_MENU_BEHIND "__menu_layout_behind" 109#define DK_MAIN_MENU_BEHIND "__menu_layout_behind"
103 110
104#define DK_MAIN_PANEL_TABLE "__panel_table"
105#define DK_MAIN_PANEL_SHOWED "__panel_layout_show" 111#define DK_MAIN_PANEL_SHOWED "__panel_layout_show"
106#define DK_MAIN_PANEL_HIDDEN "__panel_layout_hidden" 112#define DK_MAIN_PANEL_HIDDEN "__panel_layout_hidden"
107 113
108#define DK_MAIN_TITLE_BOX "__panel_title"
109
110#define DK_MAIN_SEARCH_OBJECTS "__panel_search"
111#define DK_PANEL_APPLY_BUTTON "__apply_btn" 114#define DK_PANEL_APPLY_BUTTON "__apply_btn"
112#define DK_PANEL_RESET_BUTTON "__reset_btn" 115#define DK_PANEL_RESET_BUTTON "__reset_btn"
113#define DK_PANEL_ITEM_SHOWN "__showed_item" 116#define DK_PANEL_ITEM_SHOWN "__showed_item"
@@ -115,10 +118,6 @@ static void _search_panel_stop(Evas_Object *w);
115#define DK_MENU_GENLIST "__menu_genlist" 118#define DK_MENU_GENLIST "__menu_genlist"
116#define DK_MENU_ITEM_SHOWN "__showed_item" 119#define DK_MENU_ITEM_SHOWN "__showed_item"
117 120
118#define DK_SEARCH_LABEL "__search_label"
119#define DK_SEARCH_GRID "__search_results"
120#define DK_UNSAVED_OPENED "__unsaved_opened"
121
122/* Layout positions */ 121/* Layout positions */
123 122
124#define POS_PANEL_PAD "elm.rect.pad" 123#define POS_PANEL_PAD "elm.rect.pad"
@@ -188,22 +187,24 @@ _title_bar_refresh(Evas_Object *w)
188{ 187{
189 Elm_Object_Item *it, *walker; 188 Elm_Object_Item *it, *walker;
190 Elm_Settingspane_Item_Data *id = NULL; 189 Elm_Settingspane_Item_Data *id = NULL;
191 Evas_Object *bt, *bx; 190 Evas_Object *bt;
191
192 C_DATA(w);
193
192 it = _history_stack_current(w); 194 it = _history_stack_current(w);
193 bx = evas_object_data_get(w, DK_MAIN_TITLE_BOX);
194 195
195 elm_box_clear(bx); 196 elm_box_clear(wd->title_box);
196 197
197 do { 198 do {
198 walker = id ? id->par : it; 199 walker = id ? id->par : it;
199 id = IC_DATA_L(walker); 200 id = IC_DATA_L(walker);
200 201
201 bt = elm_button_add(bx); 202 bt = elm_button_add(wd->title_box);
202 elm_object_style_set(bt, "navlink"); 203 elm_object_style_set(bt, "navlink");
203 elm_object_text_set(bt, id->name); 204 elm_object_text_set(bt, id->name);
204 evas_object_show(bt); 205 evas_object_show(bt);
205 206
206 elm_box_pack_start(bx, bt); 207 elm_box_pack_start(wd->title_box, bt);
207 } while(id->par); 208 } while(id->par);
208} 209}
209 210
@@ -322,10 +323,10 @@ _default_reached_cb(void *data EINA_UNUSED, Evas_Object *obj, const char *emissi
322static void 323static void
323_content_layout_content_init(Evas_Object *w) 324_content_layout_content_init(Evas_Object *w)
324{ 325{
325 Evas_Object *o, *pad, *table, *bx, *apply, *reset; 326 Evas_Object *o, *pad, *bx, *apply, *reset;
326 int i = 0; 327 int i = 0;
328 C_DATA(w);
327 329
328 table = evas_object_data_get(w, DK_MAIN_PANEL_TABLE);
329 330
330 for (i = 0; i < 2; i++) 331 for (i = 0; i < 2; i++)
331 { 332 {
@@ -342,7 +343,7 @@ _content_layout_content_init(Evas_Object *w)
342 elm_object_part_content_set(o, POS_PANEL_PAD, pad); 343 elm_object_part_content_set(o, POS_PANEL_PAD, pad);
343 evas_object_show(pad); 344 evas_object_show(pad);
344 345
345 elm_table_pack(table, o, 0, 0, 1, 1); 346 elm_table_pack(wd->table_panel, o, 0, 0, 1, 1);
346 347
347 bx = elm_box_add(w); 348 bx = elm_box_add(w);
348 evas_object_size_hint_weight_set(bx, 0, 0); 349 evas_object_size_hint_weight_set(bx, 0, 0);
@@ -468,10 +469,9 @@ _content_layout_content_set(Evas_Object *w, Elm_Settingspane_Item *it)
468static void 469static void
469_menu_layout_init(Evas_Object *w) 470_menu_layout_init(Evas_Object *w)
470{ 471{
471 Evas_Object *o, *table, *list; 472 Evas_Object *o, *list;
472 int i = 0; 473 int i = 0;
473 474 C_DATA(w);
474 table = evas_object_data_get(w, DK_MAIN_MENU_TABLE);
475 475
476 for (i = 0; i < 3; i++) 476 for (i = 0; i < 3; i++)
477 { 477 {
@@ -491,7 +491,7 @@ _menu_layout_init(Evas_Object *w)
491 evas_object_data_set(o, DK_MENU_GENLIST, list); 491 evas_object_data_set(o, DK_MENU_GENLIST, list);
492 elm_object_part_content_set(o, POS_MENU_CONTENT, list); 492 elm_object_part_content_set(o, POS_MENU_CONTENT, list);
493 evas_object_show(list); 493 evas_object_show(list);
494 elm_table_pack(table, o, 0, 0, 1, 1); 494 elm_table_pack(wd->table_menu, o, 0, 0, 1, 1);
495 495
496 if (i == 0) 496 if (i == 0)
497 evas_object_data_set(w, DK_MAIN_MENU_HIDDEN, o); 497 evas_object_data_set(w, DK_MAIN_MENU_HIDDEN, o);
@@ -999,7 +999,7 @@ _search_panel_display(Evas_Object *w)
999 l = elm_label_add(w); 999 l = elm_label_add(w);
1000 evas_object_size_hint_weight_set(l, EVAS_HINT_EXPAND, 0.0); 1000 evas_object_size_hint_weight_set(l, EVAS_HINT_EXPAND, 0.0);
1001 evas_object_size_hint_align_set(l, EVAS_HINT_FILL, EVAS_HINT_FILL); 1001 evas_object_size_hint_align_set(l, EVAS_HINT_FILL, EVAS_HINT_FILL);
1002 evas_object_data_set(o, DK_SEARCH_LABEL, l); 1002 wd->search_label = l;
1003 elm_box_pack_end(o, l); 1003 elm_box_pack_end(o, l);
1004 evas_object_show(l); 1004 evas_object_show(l);
1005 1005
@@ -1007,11 +1007,11 @@ _search_panel_display(Evas_Object *w)
1007 elm_gengrid_item_size_set(g, 150, 150); 1007 elm_gengrid_item_size_set(g, 150, 150);
1008 evas_object_size_hint_weight_set(g, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1008 evas_object_size_hint_weight_set(g, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1009 evas_object_size_hint_align_set(g, EVAS_HINT_FILL, EVAS_HINT_FILL); 1009 evas_object_size_hint_align_set(g, EVAS_HINT_FILL, EVAS_HINT_FILL);
1010 evas_object_data_set(o, DK_SEARCH_GRID, g); 1010 wd->search.grid = g;
1011 elm_box_pack_end(o, g); 1011 elm_box_pack_end(o, g);
1012 evas_object_show(g); 1012 evas_object_show(g);
1013 1013
1014 evas_object_data_set(w, DK_MAIN_SEARCH_OBJECTS, o); 1014 wd->search.obj = o;
1015 _content_layout_schedule_hide(w, EINA_TRUE); 1015 _content_layout_schedule_hide(w, EINA_TRUE);
1016 _content_layout_display(w, o); 1016 _content_layout_display(w, o);
1017 _menu_layout_hide(w); 1017 _menu_layout_hide(w);
@@ -1023,11 +1023,12 @@ _search_panel_hide(Evas_Object *w)
1023 Elm_Settingspane_Item *item; 1023 Elm_Settingspane_Item *item;
1024 Elm_Settingspane_Item_Data *id; 1024 Elm_Settingspane_Item_Data *id;
1025 Evas_Object *o; 1025 Evas_Object *o;
1026 C_DATA(w);
1026 1027
1027 item = _history_stack_current(w); 1028 item = _history_stack_current(w);
1028 id = IC_DATA_L(item); 1029 id = IC_DATA_L(item);
1029 1030
1030 o = evas_object_data_get(w, DK_MAIN_SEARCH_OBJECTS); 1031 o = wd->search.obj;
1031 if (!o) 1032 if (!o)
1032 return; 1033 return;
1033 1034
@@ -1049,7 +1050,7 @@ _search_panel_hide(Evas_Object *w)
1049 } 1050 }
1050 1051
1051 evas_object_del(o); 1052 evas_object_del(o);
1052 evas_object_data_del(w, DK_MAIN_SEARCH_OBJECTS); 1053 wd->search.obj = NULL;
1053} 1054}
1054 1055
1055static void 1056static void
@@ -1113,10 +1114,8 @@ _search_display_items(void *data)
1113 Eina_List *node; 1114 Eina_List *node;
1114 Elm_Settingspane_Item *it; 1115 Elm_Settingspane_Item *it;
1115 Elm_Gengrid_Item_Class *gic = NULL; 1116 Elm_Gengrid_Item_Class *gic = NULL;
1116 Evas_Object *grid = evas_object_data_get(sr->data->search.display,
1117 DK_SEARCH_GRID);
1118 1117
1119 elm_gengrid_clear(grid); 1118 elm_gengrid_clear(sr->data->search.grid);
1120 1119
1121 gic = elm_gengrid_item_class_new(); 1120 gic = elm_gengrid_item_class_new();
1122 gic->item_style = "thumb"; 1121 gic->item_style = "thumb";
@@ -1126,7 +1125,7 @@ _search_display_items(void *data)
1126 1125
1127 EINA_LIST_FOREACH(sr->results, node, it) 1126 EINA_LIST_FOREACH(sr->results, node, it)
1128 { 1127 {
1129 elm_gengrid_item_append(grid, gic, it, _search_grid_item_sel, it); 1128 elm_gengrid_item_append(sr->data->search.grid, gic, it, _search_grid_item_sel, it);
1130 } 1129 }
1131 1130
1132 return NULL; 1131 return NULL;
@@ -1202,14 +1201,13 @@ _search_panel_search_string_update(Evas_Object *w, const char *word)
1202 char buf[PATH_MAX]; 1201 char buf[PATH_MAX];
1203 Search_Run *sr; 1202 Search_Run *sr;
1204 C_DATA(w); 1203 C_DATA(w);
1205 Evas_Object *l = evas_object_data_get(wd->search.display, DK_SEARCH_LABEL);
1206 1204
1207 sr = calloc(1, sizeof(Search_Run)); 1205 sr = calloc(1, sizeof(Search_Run));
1208 sr->keyword = word; 1206 sr->keyword = word;
1209 sr->data = wd; 1207 sr->data = wd;
1210 1208
1211 snprintf(buf, sizeof(buf), "Search results for \"%s\": ", word); 1209 snprintf(buf, sizeof(buf), "Search results for \"%s\": ", word);
1212 elm_object_text_set(l, buf); 1210 elm_object_text_set(wd->search_label, buf);
1213 1211
1214 if (wd->search.run) 1212 if (wd->search.run)
1215 ecore_thread_cancel(wd->search.run); 1213 ecore_thread_cancel(wd->search.run);
@@ -1246,8 +1244,9 @@ _conf_unsaved_item_click_cb(void *data, Evas_Object *obj, void *event EINA_UNUSE
1246{ 1244{
1247 Elm_Object_Item *it = data; 1245 Elm_Object_Item *it = data;
1248 IC_DATA(it); 1246 IC_DATA(it);
1247 C_DATA(id->sw);
1249 1248
1250 evas_object_data_del(id->sw, DK_UNSAVED_OPENED); 1249 wd->unsaved_opened = NULL;
1251 1250
1252 eo_do(it, elm_obj_settingspane_item_focus()); 1251 eo_do(it, elm_obj_settingspane_item_focus());
1253 evas_object_hide(obj); 1252 evas_object_hide(obj);
@@ -1274,8 +1273,9 @@ _conf_unsaved_menu_ctx_item_add(Evas_Object *ctx, Elm_Object_Item *it)
1274static void 1273static void
1275_conf_unsaved_dismissed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 1274_conf_unsaved_dismissed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1276{ 1275{
1277 Evas_Object *par = data; 1276 C_DATA(data);
1278 evas_object_data_del(par, DK_UNSAVED_OPENED); 1277
1278 wd->unsaved_opened = NULL;
1279} 1279}
1280 1280
1281static void 1281static void
@@ -1286,12 +1286,11 @@ _conf_unsaved_menu_show(Evas_Object *par, int x, int y, char *style )
1286 Evas_Object *ctx; 1286 Evas_Object *ctx;
1287 C_DATA(par); 1287 C_DATA(par);
1288 1288
1289 if (eina_list_count(wd->unsaved_changes) == 0 || evas_object_data_get(par, DK_UNSAVED_OPENED)) 1289 if (eina_list_count(wd->unsaved_changes) == 0 || wd->unsaved_opened)
1290 return; 1290 return;
1291 1291
1292 evas_object_data_set(par, DK_UNSAVED_OPENED, (void*)1);
1293
1294 ctx = elm_ctxpopup_add(par); 1292 ctx = elm_ctxpopup_add(par);
1293 wd->unsaved_opened = ctx;
1295 elm_object_style_set(ctx, style); 1294 elm_object_style_set(ctx, style);
1296 evas_object_smart_callback_add(ctx, "dismissed", _conf_unsaved_dismissed_cb, par); 1295 evas_object_smart_callback_add(ctx, "dismissed", _conf_unsaved_dismissed_cb, par);
1297 1296
@@ -1401,7 +1400,7 @@ _elm_settingspane_evas_object_smart_add(Eo *obj, Elm_Settingspane_Data *pd)
1401 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1400 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1402 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); 1401 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
1403 elm_object_part_content_set(obj, POS_MAIN_TITLE, bx); 1402 elm_object_part_content_set(obj, POS_MAIN_TITLE, bx);
1404 evas_object_data_set(obj, DK_MAIN_TITLE_BOX, bx); 1403 pd->title_box = bx;
1405 evas_object_show(bx); 1404 evas_object_show(bx);
1406 1405
1407 en = elm_entry_add(obj); 1406 en = elm_entry_add(obj);
@@ -1417,14 +1416,14 @@ _elm_settingspane_evas_object_smart_add(Eo *obj, Elm_Settingspane_Data *pd)
1417 evas_object_size_hint_align_set(tb1, EVAS_HINT_FILL, EVAS_HINT_FILL); 1416 evas_object_size_hint_align_set(tb1, EVAS_HINT_FILL, EVAS_HINT_FILL);
1418 elm_object_part_content_set(obj, POS_MAIN_PANEL, tb1); 1417 elm_object_part_content_set(obj, POS_MAIN_PANEL, tb1);
1419 evas_object_show(tb1); 1418 evas_object_show(tb1);
1420 evas_object_data_set(obj, DK_MAIN_PANEL_TABLE, tb1); 1419 pd->table_panel = tb1;
1421 1420
1422 tb2 = elm_table_add(obj); 1421 tb2 = elm_table_add(obj);
1423 evas_object_size_hint_weight_set(tb2, 0.0, EVAS_HINT_EXPAND); 1422 evas_object_size_hint_weight_set(tb2, 0.0, EVAS_HINT_EXPAND);
1424 evas_object_size_hint_align_set(tb2, 0.0, EVAS_HINT_FILL); 1423 evas_object_size_hint_align_set(tb2, 0.0, EVAS_HINT_FILL);
1425 elm_object_part_content_set(obj, POS_MAIN_MENU, tb2); 1424 elm_object_part_content_set(obj, POS_MAIN_MENU, tb2);
1426 evas_object_show(tb2); 1425 evas_object_show(tb2);
1427 evas_object_data_set(obj, DK_MAIN_MENU_TABLE, tb2); 1426 pd->table_menu = tb2;
1428 1427
1429 1428
1430 _content_layout_content_init(obj); 1429 _content_layout_content_init(obj);
@@ -1729,4 +1728,4 @@ elm_settingspane_add(Evas_Object *parent)
1729 return obj; 1728 return obj;
1730} 1729}
1731#include "elm_settingspane_item.eo.c" 1730#include "elm_settingspane_item.eo.c"
1732#include "elm_settingspane.eo.c" \ No newline at end of file 1731#include "elm_settingspane.eo.c"