summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2011-10-24 23:41:11 +0000
committerBruno Dilly <bdilly@profusion.mobi>2011-10-24 23:41:11 +0000
commita63bf2c1c483c2c883b3c4612e18b119394e3bf7 (patch)
tree02277ce7ee2be4834479e036e8cd998492c2f5e6 /legacy
parent408cf02a9e68da4491930a30887a107bea04ff6c (diff)
Elementary Toggle: Don't use deprecated functions
If we need to add functions born deprecated because it will make other developers life easier, ok. But using these deprecated functions inside our project isn't nice. SVN revision: 64363
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/src/bin/test_toggle.c7
-rw-r--r--legacy/elementary/src/edje_externals/elm_toggle.c31
-rw-r--r--legacy/elementary/src/lib/elm_toggle.c9
3 files changed, 18 insertions, 29 deletions
diff --git a/legacy/elementary/src/bin/test_toggle.c b/legacy/elementary/src/bin/test_toggle.c
index 57c5f47bae..5ca11d93a4 100644
--- a/legacy/elementary/src/bin/test_toggle.c
+++ b/legacy/elementary/src/bin/test_toggle.c
@@ -35,7 +35,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
35 elm_object_text_set(tg, "Icon sized to toggle"); 35 elm_object_text_set(tg, "Icon sized to toggle");
36 elm_check_icon_set(tg, ic); 36 elm_check_icon_set(tg, ic);
37 elm_check_state_set(tg, 1); 37 elm_check_state_set(tg, 1);
38 elm_check_states_labels_set(tg, "Yes", "No"); 38 elm_object_text_part_set(tg, "on", "Yes");
39 elm_object_text_part_set(tg, "off", "No");
39 elm_box_pack_end(bx, tg); 40 elm_box_pack_end(bx, tg);
40 evas_object_show(tg); 41 evas_object_show(tg);
41 evas_object_show(ic); 42 evas_object_show(ic);
@@ -70,8 +71,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
70 tg = elm_check_add(win); 71 tg = elm_check_add(win);
71 elm_object_style_set(tg, "toggle"); 72 elm_object_style_set(tg, "toggle");
72 elm_object_text_set(tg, "Label Only"); 73 elm_object_text_set(tg, "Label Only");
73 elm_check_states_labels_set(tg, "Big long fun times label", 74 elm_object_text_part_set(tg, "on", "Big long fun times label");
74 "Small long happy fun label"); 75 elm_object_text_part_set(tg, "off", "Small long happy fun label");
75 elm_box_pack_end(bx, tg); 76 elm_box_pack_end(bx, tg);
76 evas_object_show(tg); 77 evas_object_show(tg);
77 78
diff --git a/legacy/elementary/src/edje_externals/elm_toggle.c b/legacy/elementary/src/edje_externals/elm_toggle.c
index 83b080930b..86c043775c 100644
--- a/legacy/elementary/src/edje_externals/elm_toggle.c
+++ b/legacy/elementary/src/edje_externals/elm_toggle.c
@@ -26,17 +26,10 @@ external_toggle_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
26 if (p->icon) 26 if (p->icon)
27 elm_check_icon_set(obj, p->icon); 27 elm_check_icon_set(obj, p->icon);
28 28
29 if ((p->on) && (p->off)) 29 if (p->on)
30 elm_check_states_labels_set(obj, p->on, p->off); 30 elm_object_text_part_set(obj, "on", p->on);
31 else if ((p->on) || (p->off)) 31 if (p->off)
32 { 32 elm_object_text_part_set(obj, "off", p->off);
33 const char *on, *off;
34 elm_check_states_labels_get(obj, &on, &off);
35 if (p->on)
36 elm_check_states_labels_set(obj, p->on, off);
37 else
38 elm_check_states_labels_set(obj, on, p->off);
39 }
40 33
41 if (p->state_exists) 34 if (p->state_exists)
42 elm_check_state_set(obj, p->state); 35 elm_check_state_set(obj, p->state);
@@ -67,9 +60,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
67 { 60 {
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 61 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
69 { 62 {
70 const char *on, *off; 63 elm_object_text_part_set(obj, "on", param->s);
71 elm_check_states_labels_get(obj, &on, &off);
72 elm_check_states_labels_set(obj, param->s, off);
73 return EINA_TRUE; 64 return EINA_TRUE;
74 } 65 }
75 } 66 }
@@ -77,9 +68,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
77 { 68 {
78 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 69 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
79 { 70 {
80 const char *on, *off; 71 elm_object_text_part_set(obj, "off", param->s);
81 elm_check_states_labels_get(obj, &on, &off);
82 elm_check_states_labels_set(obj, on, param->s);
83 return EINA_TRUE; 72 return EINA_TRUE;
84 } 73 }
85 } 74 }
@@ -118,9 +107,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
118 { 107 {
119 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 108 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
120 { 109 {
121 const char *on, *off; 110 param->s = elm_object_text_part_get(obj, "on");
122 elm_check_states_labels_get(obj, &on, &off);
123 param->s = on;
124 return EINA_TRUE; 111 return EINA_TRUE;
125 } 112 }
126 } 113 }
@@ -128,9 +115,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
128 { 115 {
129 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) 116 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
130 { 117 {
131 const char *on, *off; 118 param->s = elm_object_text_part_get(obj, "off");
132 elm_check_states_labels_get(obj, &on, &off);
133 param->s = off;
134 return EINA_TRUE; 119 return EINA_TRUE;
135 } 120 }
136 } 121 }
diff --git a/legacy/elementary/src/lib/elm_toggle.c b/legacy/elementary/src/lib/elm_toggle.c
index 1c7f1afa82..b4c8edbdaf 100644
--- a/legacy/elementary/src/lib/elm_toggle.c
+++ b/legacy/elementary/src/lib/elm_toggle.c
@@ -8,7 +8,8 @@ elm_toggle_add(Evas_Object *parent)
8 8
9 obj = elm_check_add(parent); 9 obj = elm_check_add(parent);
10 elm_object_style_set(obj, "toggle"); 10 elm_object_style_set(obj, "toggle");
11 elm_check_states_labels_set(obj, E_("ON"), E_("OFF")); 11 elm_object_text_part_set(obj, "on", E_("ON"));
12 elm_object_text_part_set(obj, "off", E_("OFF"));
12 return obj; 13 return obj;
13} 14}
14 15
@@ -45,13 +46,15 @@ elm_toggle_icon_unset(Evas_Object *obj)
45EAPI void 46EAPI void
46elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel) 47elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel)
47{ 48{
48 elm_check_states_labels_set(obj, onlabel, offlabel); 49 elm_object_text_part_set(obj, "on", onlabel);
50 elm_object_text_part_set(obj, "off", offlabel);
49} 51}
50 52
51EAPI void 53EAPI void
52elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel) 54elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel)
53{ 55{
54 elm_check_states_labels_get(obj, onlabel, offlabel); 56 if (onlabel) *onlabel = elm_object_text_part_get(obj, "on");
57 if (offlabel) *offlabel = elm_object_text_part_get(obj, "off");
55} 58}
56 59
57EAPI void 60EAPI void