summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-03-22 15:54:47 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-05 12:56:26 +0200
commitda34631bf4a6034207d2fa7d76721aef1154732a (patch)
treef17350f880444eb14e094430260a5d114f836d04
parent5d97a0afc73968f5cde9a3e20c3ac5c543394b67 (diff)
settingspane: handle icons better
Icons are handled better because of the new file and group attribute
-rw-r--r--src/lib/elc_settingspane.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/lib/elc_settingspane.c b/src/lib/elc_settingspane.c
index 03f0a33bb..369d25068 100644
--- a/src/lib/elc_settingspane.c
+++ b/src/lib/elc_settingspane.c
@@ -84,7 +84,6 @@ typedef struct
84 Eina_Bool changed; 84 Eina_Bool changed;
85 85
86 Elm_Widget_Item *it; 86 Elm_Widget_Item *it;
87 Evas_Object *icon;
88 87
89 struct 88 struct
90 { 89 {
@@ -117,6 +116,7 @@ static void _history_stack_remove(Evas_Object *w, Elm_Object_Item *it);
117 116
118static void _item_sel_cb(void *data, Evas_Object *obj, void *event_info); 117static void _item_sel_cb(void *data, Evas_Object *obj, void *event_info);
119static void _search_panel_stop(Evas_Object *w); 118static void _search_panel_stop(Evas_Object *w);
119static Evas_Object* _elm_settingspane_icon_gen(Evas_Object *par, const char *file, const char *group);
120 120
121#define HAS_PANEL(id) (id->event.content_get) 121#define HAS_PANEL(id) (id->event.content_get)
122/* Data Keys in the layouts, DK = Data Key */ 122/* Data Keys in the layouts, DK = Data Key */
@@ -302,7 +302,7 @@ _elm_settingspane_ii_content_cb(void *data, Evas_Object *obj, const char *part)
302 302
303 if (!strcmp(part, "elm.swallow.icon")) 303 if (!strcmp(part, "elm.swallow.icon"))
304 { 304 {
305 res = id->icon; 305 res = _elm_settingspane_icon_gen(obj, id->file, id->group);
306 } 306 }
307 else 307 else
308 { 308 {
@@ -542,6 +542,7 @@ _search_panel_display(Evas_Object *w)
542 Panel *p = _item_panel_realize(NULL, w, o); 542 Panel *p = _item_panel_realize(NULL, w, o);
543 wd->search.p = p; 543 wd->search.p = p;
544 elm_table_pack(wd->table_panel, p->layout, 0, 0, 1, 1); 544 elm_table_pack(wd->table_panel, p->layout, 0, 0, 1, 1);
545 evas_object_show(p->layout);
545 546
546 elm_layout_signal_emit(w, EMIT_MENU_SEARCHMODE_ENABLE); 547 elm_layout_signal_emit(w, EMIT_MENU_SEARCHMODE_ENABLE);
547 elm_layout_signal_emit(p->layout, EMIT_CONTENT_VISIBLE); 548 elm_layout_signal_emit(p->layout, EMIT_CONTENT_VISIBLE);
@@ -582,12 +583,12 @@ _search_grid_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *par
582 583
583 584
584static Evas_Object* 585static Evas_Object*
585_search_grid_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) 586_search_grid_content_get(void *data, Evas_Object *obj, const char *part EINA_UNUSED)
586{ 587{
587 IC_DATA(data); 588 IC_DATA(data);
588 589
589 if (!strcmp(part, "elm.swallow.icon")) 590 if (!strcmp(part, "elm.swallow.icon"))
590 return id->icon; 591 return _elm_settingspane_icon_gen(obj, id->file, id->group);
591 else 592 else
592 return NULL; 593 return NULL;
593} 594}
@@ -601,18 +602,6 @@ _search_grid_item_sel(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
601 eo_do(data, elm_obj_settingspane_item_focus()); 602 eo_do(data, elm_obj_settingspane_item_focus());
602} 603}
603 604
604static void
605_search_grid_del(void *data, Evas_Object *obj EINA_UNUSED)
606{
607 IC_DATA(data);
608
609 /* Also called when the widget is deleted, but then the item is allready freed.
610 * This would result in a crash.
611 */
612 if (!id) return;
613 evas_object_hide(id->icon);
614}
615
616static void * 605static void *
617_search_display_items(void *data) 606_search_display_items(void *data)
618{ 607{
@@ -627,7 +616,6 @@ _search_display_items(void *data)
627 gic->item_style = "thumb"; 616 gic->item_style = "thumb";
628 gic->func.text_get = _search_grid_label_get; 617 gic->func.text_get = _search_grid_label_get;
629 gic->func.content_get = _search_grid_content_get; 618 gic->func.content_get = _search_grid_content_get;
630 gic->func.del = _search_grid_del;
631 619
632 EINA_LIST_FOREACH(sr->results, node, it) 620 EINA_LIST_FOREACH(sr->results, node, it)
633 { 621 {
@@ -761,14 +749,12 @@ _conf_unsaved_menu_ctx_item_add(Evas_Object *ctx, Elm_Object_Item *it)
761{ 749{
762 IC_DATA(it); 750 IC_DATA(it);
763 char buf[PATH_MAX]; 751 char buf[PATH_MAX];
764 const char *group, *file;
765 Evas_Object *ic; 752 Evas_Object *ic;
766 753
767 snprintf(buf, sizeof(buf), "*%s", id->name); 754 snprintf(buf, sizeof(buf), "*%s", id->name);
768 755
769 ic = elm_icon_add(ctx); 756 ic = elm_icon_add(ctx);
770 elm_image_file_get(id->icon, &file, &group); 757 elm_image_file_set(ic, id->file, id->group);
771 elm_image_file_set(ic, file, group);
772 evas_object_show(ic); 758 evas_object_show(ic);
773 759
774 elm_ctxpopup_item_append(ctx, buf, ic, _conf_unsaved_item_click_cb, it); 760 elm_ctxpopup_item_append(ctx, buf, ic, _conf_unsaved_item_click_cb, it);
@@ -1036,14 +1022,6 @@ _elm_settingspane_item_image_set(Eo *obj, Elm_Settingspane_Item_Data *pd, const
1036 pd->file = file; 1022 pd->file = file;
1037 pd->group = group; 1023 pd->group = group;
1038 1024
1039 if (pd->icon)
1040 {
1041 eo_unref(pd->icon);
1042 evas_object_del(pd->icon);
1043 }
1044
1045 pd->icon = _elm_settingspane_icon_gen(pd->sw, file, group);
1046 eo_ref(pd->icon);
1047 _item_menu_refresh(obj, pd); 1025 _item_menu_refresh(obj, pd);
1048} 1026}
1049 1027
@@ -1417,8 +1395,6 @@ _elm_settingspane_item_eo_base_destructor(Eo *obj EINA_UNUSED, Elm_Settingspane_
1417{ 1395{
1418 if (pd->panel) 1396 if (pd->panel)
1419 eo_unref(pd->panel->layout); 1397 eo_unref(pd->panel->layout);
1420 if (pd->icon)
1421 eo_unref(pd->icon);
1422 eo_do_super(obj, ELM_SETTINGSPANE_ITEM_CLASS, eo_destructor()); 1398 eo_do_super(obj, ELM_SETTINGSPANE_ITEM_CLASS, eo_destructor());
1423} 1399}
1424 1400