summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2014-01-08 17:42:55 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2014-01-08 17:42:55 +0900
commit7a4ec239d8e5e1768064b6fd9953554587c1da0c (patch)
tree1f20a4fe72c8b388297f37f506b440f430990911
parentc5106f30c562f513a5eb5d259ff246079fba7a4c (diff)
diskselector, entry, index: Refactoring by reducing unnecessary redundant function calls
and removed unnecessary local variable. - Do not need to call the same function with same parameter many times. Use local variable for them. - Remove unnecessary local variable if it is not needed.
-rw-r--r--src/lib/elm_diskselector.c21
-rw-r--r--src/lib/elm_entry.c24
-rw-r--r--src/lib/elm_index.c16
3 files changed, 29 insertions, 32 deletions
diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c
index f1ed187ab..f74e34fe3 100644
--- a/src/lib/elm_diskselector.c
+++ b/src/lib/elm_diskselector.c
@@ -640,7 +640,6 @@ _item_new(Evas_Object *obj,
640 const void *data) 640 const void *data)
641{ 641{
642 Elm_Diskselector_Item *it; 642 Elm_Diskselector_Item *it;
643 const char *style = elm_widget_style_get(obj);
644 643
645 it = elm_widget_item_new(obj, Elm_Diskselector_Item); 644 it = elm_widget_item_new(obj, Elm_Diskselector_Item);
646 if (!it) return NULL; 645 if (!it) return NULL;
@@ -655,7 +654,8 @@ _item_new(Evas_Object *obj,
655 it->func = func; 654 it->func = func;
656 it->base.data = data; 655 it->base.data = data;
657 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 656 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
658 elm_widget_theme_object_set(obj, VIEW(it), "diskselector", "item", style); 657 elm_widget_theme_object_set(obj, VIEW(it), "diskselector", "item",
658 elm_widget_style_get(obj));
659 659
660 evas_object_size_hint_weight_set 660 evas_object_size_hint_weight_set
661 (VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 661 (VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -801,6 +801,7 @@ _elm_diskselector_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
801 if (ret) *ret = EINA_FALSE; 801 if (ret) *ret = EINA_FALSE;
802 Eina_Bool int_ret = EINA_FALSE; 802 Eina_Bool int_ret = EINA_FALSE;
803 Evas *evas; 803 Evas *evas;
804 const char *style = elm_widget_style_get(obj);
804 805
805 Elm_Diskselector_Smart_Data *sd = _pd; 806 Elm_Diskselector_Smart_Data *sd = _pd;
806 807
@@ -814,8 +815,8 @@ _elm_diskselector_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
814 { 815 {
815 EINA_LIST_FOREACH(sd->r_items, l, it) 816 EINA_LIST_FOREACH(sd->r_items, l, it)
816 { 817 {
817 elm_widget_theme_object_set(obj, VIEW(it), "diskselector", "item", 818 elm_widget_theme_object_set(obj, VIEW(it),
818 elm_widget_style_get(obj)); 819 "diskselector", "item", style);
819 edje_object_part_text_escaped_set 820 edje_object_part_text_escaped_set
820 (VIEW(it), "elm.text", it->label); 821 (VIEW(it), "elm.text", it->label);
821 } 822 }
@@ -824,8 +825,8 @@ _elm_diskselector_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
824 { 825 {
825 EINA_LIST_FOREACH(sd->items, l, it) 826 EINA_LIST_FOREACH(sd->items, l, it)
826 { 827 {
827 elm_widget_theme_object_set(obj, VIEW(it), "diskselector", "item", 828 elm_widget_theme_object_set(obj, VIEW(it),
828 elm_widget_style_get(obj)); 829 "diskselector","item", style);
829 edje_object_part_text_escaped_set 830 edje_object_part_text_escaped_set
830 (VIEW(it), "elm.text", it->label); 831 (VIEW(it), "elm.text", it->label);
831 } 832 }
@@ -833,15 +834,15 @@ _elm_diskselector_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
833 /* left blank */ 834 /* left blank */
834 EINA_LIST_FOREACH (sd->left_blanks, l, blank) 835 EINA_LIST_FOREACH (sd->left_blanks, l, blank)
835 { 836 {
836 elm_widget_theme_object_set(obj, blank, "diskselector", "item", 837 elm_widget_theme_object_set(obj, blank,
837 elm_widget_style_get(obj)); 838 "diskselector", "item", style);
838 } 839 }
839 840
840 /* right blank */ 841 /* right blank */
841 EINA_LIST_FOREACH (sd->right_blanks, l, blank) 842 EINA_LIST_FOREACH (sd->right_blanks, l, blank)
842 { 843 {
843 elm_widget_theme_object_set(obj, blank, "diskselector", "item", 844 elm_widget_theme_object_set(obj, blank,
844 elm_widget_style_get(obj)); 845 "diskselector", "item", style);
845 } 846 }
846 } 847 }
847 848
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index fd38ff9fa..e460d9043 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -541,6 +541,7 @@ _elm_entry_smart_theme(Eo *obj, void *_pd, va_list *list)
541 const char *str; 541 const char *str;
542 const char *t; 542 const char *t;
543 Eina_Bool *ret = va_arg(*list, Eina_Bool *); 543 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
544 const char *style = elm_widget_style_get(obj);
544 if (ret) *ret = EINA_FALSE; 545 if (ret) *ret = EINA_FALSE;
545 546
546 Elm_Entry_Smart_Data *sd = _pd; 547 Elm_Entry_Smart_Data *sd = _pd;
@@ -564,8 +565,7 @@ _elm_entry_smart_theme(Eo *obj, void *_pd, va_list *list)
564 t = eina_stringshare_add(elm_object_text_get(obj)); 565 t = eina_stringshare_add(elm_object_text_get(obj));
565 566
566 elm_widget_theme_object_set 567 elm_widget_theme_object_set
567 (obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj), 568 (obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj), style);
568 elm_widget_style_get(obj));
569 569
570 if (_elm_config->desktop_entry) 570 if (_elm_config->desktop_entry)
571 edje_object_part_text_select_allow_set 571 edje_object_part_text_select_allow_set
@@ -616,10 +616,10 @@ _elm_entry_smart_theme(Eo *obj, void *_pd, va_list *list)
616 616
617 if (sd->single_line) 617 if (sd->single_line)
618 ok = elm_widget_theme_object_set 618 ok = elm_widget_theme_object_set
619 (obj, sd->scr_edje, "scroller", "entry_single", elm_widget_style_get(obj)); 619 (obj, sd->scr_edje, "scroller", "entry_single", style);
620 if (!ok) 620 if (!ok)
621 elm_widget_theme_object_set 621 elm_widget_theme_object_set
622 (obj, sd->scr_edje, "scroller", "entry", elm_widget_style_get(obj)); 622 (obj, sd->scr_edje, "scroller", "entry", style);
623 623
624 str = edje_object_data_get(sd->scr_edje, "focus_highlight"); 624 str = edje_object_data_get(sd->scr_edje, "focus_highlight");
625 } 625 }
@@ -633,10 +633,10 @@ _elm_entry_smart_theme(Eo *obj, void *_pd, va_list *list)
633 else 633 else
634 elm_widget_highlight_in_theme_set(obj, EINA_FALSE); 634 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
635 635
636 elm_widget_theme_object_set(obj, sd->start_handler, "entry", 636 elm_widget_theme_object_set(obj, sd->start_handler,
637 "handler/start", elm_widget_style_get(obj)); 637 "entry", "handler/start", style);
638 elm_widget_theme_object_set(obj, sd->end_handler, "entry", 638 elm_widget_theme_object_set(obj, sd->end_handler,
639 "handler/end", elm_widget_style_get(obj)); 639 "entry", "handler/end", style);
640 640
641 sd->changed = EINA_TRUE; 641 sd->changed = EINA_TRUE;
642 elm_layout_sizing_eval(obj); 642 elm_layout_sizing_eval(obj);
@@ -2351,6 +2351,7 @@ _item_get(void *data,
2351 Eina_List *l; 2351 Eina_List *l;
2352 Evas_Object *o; 2352 Evas_Object *o;
2353 Elm_Entry_Item_Provider *ip; 2353 Elm_Entry_Item_Provider *ip;
2354 const char *style = elm_widget_style_get(data);
2354 2355
2355 ELM_ENTRY_DATA_GET(data, sd); 2356 ELM_ENTRY_DATA_GET(data, sd);
2356 2357
@@ -2374,17 +2375,16 @@ _item_get(void *data,
2374 evas_object_del(o); 2375 evas_object_del(o);
2375 o = edje_object_add(evas_object_evas_get(data)); 2376 o = edje_object_add(evas_object_evas_get(data));
2376 elm_widget_theme_object_set 2377 elm_widget_theme_object_set
2377 (data, o, "entry/emoticon", "wtf", 2378 (data, o, "entry/emoticon", "wtf", style);
2378 elm_widget_style_get(data));
2379 } 2379 }
2380 return o; 2380 return o;
2381 } 2381 }
2382 2382
2383 o = edje_object_add(evas_object_evas_get(data)); 2383 o = edje_object_add(evas_object_evas_get(data));
2384 if (!elm_widget_theme_object_set 2384 if (!elm_widget_theme_object_set
2385 (data, o, "entry", item, elm_widget_style_get(data))) 2385 (data, o, "entry", item, style))
2386 elm_widget_theme_object_set 2386 elm_widget_theme_object_set
2387 (data, o, "entry/emoticon", "wtf", elm_widget_style_get(data)); 2387 (data, o, "entry/emoticon", "wtf", style);
2388 return o; 2388 return o;
2389} 2389}
2390 2390
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index d918ad87b..d065a2e8d 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -198,6 +198,7 @@ _index_box_auto_fill(Evas_Object *obj,
198 Evas_Coord mw, mh, ih; 198 Evas_Coord mw, mh, ih;
199 Evas_Object *o; 199 Evas_Object *o;
200 Elm_Index_Omit *om; 200 Elm_Index_Omit *om;
201 const char *style = elm_widget_style_get(obj);
201 202
202 ELM_INDEX_DATA_GET(obj, sd); 203 ELM_INDEX_DATA_GET(obj, sd);
203 204
@@ -222,8 +223,7 @@ _index_box_auto_fill(Evas_Object *obj,
222 { 223 {
223 o = edje_object_add(evas_object_evas_get(obj)); 224 o = edje_object_add(evas_object_evas_get(obj));
224 elm_widget_theme_object_set 225 elm_widget_theme_object_set
225 (obj, o, "index", "item/vertical", 226 (obj, o, "index", "item/vertical", style);
226 elm_widget_style_get(obj));
227 227
228 edje_object_size_min_restricted_calc(o, NULL, &mh, 0, 0); 228 edje_object_size_min_restricted_calc(o, NULL, &mh, 0, 0);
229 229
@@ -274,23 +274,19 @@ _index_box_auto_fill(Evas_Object *obj,
274 { 274 {
275 if (i & 0x1) 275 if (i & 0x1)
276 elm_widget_theme_object_set 276 elm_widget_theme_object_set
277 (obj, o, "index", "item_odd/horizontal", 277 (obj, o, "index", "item_odd/horizontal", style);
278 elm_widget_style_get(obj));
279 else 278 else
280 elm_widget_theme_object_set 279 elm_widget_theme_object_set
281 (obj, o, "index", "item/horizontal", 280 (obj, o, "index", "item/horizontal", style);
282 elm_widget_style_get(obj));
283 } 281 }
284 else 282 else
285 { 283 {
286 if (i & 0x1) 284 if (i & 0x1)
287 elm_widget_theme_object_set 285 elm_widget_theme_object_set
288 (obj, o, "index", "item_odd/vertical", 286 (obj, o, "index", "item_odd/vertical", style);
289 elm_widget_style_get(obj));
290 else 287 else
291 elm_widget_theme_object_set 288 elm_widget_theme_object_set
292 (obj, o, "index", "item/vertical", 289 (obj, o, "index", "item/vertical", style);
293 elm_widget_style_get(obj));
294 } 290 }
295 291
296 if (skip > 0) 292 if (skip > 0)