summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_radio.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 20:17:34 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 20:17:34 +0000
commited5cb0e7f3a3fbbd51900141642b3616c46a2d16 (patch)
tree68033176d437d6f3a94272d6ae37c201f51c530d /legacy/elementary/src/edje_externals/elm_radio.c
parentd1d996f13d9253dd1a68f65ae900e99160b00cc9 (diff)
Simplify state_set and just apply values that were explicitly set.
SVN revision: 47458
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/edje_externals/elm_radio.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_radio.c b/legacy/elementary/src/edje_externals/elm_radio.c
index 97af308..b43415b 100644
--- a/legacy/elementary/src/edje_externals/elm_radio.c
+++ b/legacy/elementary/src/edje_externals/elm_radio.c
@@ -5,39 +5,29 @@ typedef struct _Elm_Params_Radio
5 Elm_Params base; 5 Elm_Params base;
6 Evas_Object *icon; 6 Evas_Object *icon;
7 const char* group_name; 7 const char* group_name;
8 int state; 8 int value;
9 Eina_Bool value_exists:1;
9} Elm_Params_Radio; 10} Elm_Params_Radio;
10 11
11static void 12static void
12external_radio_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__) 13external_radio_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
13{ 14{
14 const Elm_Params_Radio *p1 = from_params, *p2 = to_params; 15 const Elm_Params_Radio *p;
15 16
16 p1 = from_params; 17 if (to_params) p = to_params;
17 p2 = to_params; 18 else if (from_params) p = from_params;
18 19 else return;
19 if (!p2) 20
20 { 21 if (p->base.label)
21 elm_radio_label_set(obj, p1->base.label); 22 elm_radio_label_set(obj, p->base.label);
22 elm_radio_icon_set(obj, p1->icon); 23 if (p->icon)
23 elm_radio_state_value_set(obj, p1->state); 24 elm_radio_icon_set(obj, p->icon);
24 if (p1->group_name) 25 if (p->value_exists)
25 { 26 elm_radio_state_value_set(obj, p->value);
26 Evas_Object *ed = evas_object_smart_parent_get(obj); 27 if (p->group_name)
27 Evas_Object *group = edje_object_part_swallow_get(ed, p1->group_name);
28 if (group)
29 elm_radio_group_add(obj, group);
30 }
31 return;
32 }
33
34 elm_radio_label_set(obj, p2->base.label);
35 elm_radio_icon_set(obj, p2->icon);
36 elm_radio_state_value_set(obj, p2->state);
37 if (p2->group_name)
38 { 28 {
39 Evas_Object *ed = evas_object_smart_parent_get(obj); 29 Evas_Object *ed = evas_object_smart_parent_get(obj);
40 Evas_Object *group = edje_object_part_swallow_get(ed, p2->group_name); 30 Evas_Object *group = edje_object_part_swallow_get(ed, p->group_name);
41 elm_radio_group_add(obj, group); 31 elm_radio_group_add(obj, group);
42 } 32 }
43} 33}
@@ -129,7 +119,10 @@ external_radio_params_parse(void *data, Evas_Object *obj, const Eina_List *param
129 if (!strcmp(param->name, "group")) 119 if (!strcmp(param->name, "group"))
130 mem->group_name = eina_stringshare_add(param->s); 120 mem->group_name = eina_stringshare_add(param->s);
131 else if (!strcmp(param->name, "value")) 121 else if (!strcmp(param->name, "value"))
132 mem->state = param->i; 122 {
123 mem->value = param->i;
124 mem->value_exists = EINA_TRUE;
125 }
133 } 126 }
134 127
135 return mem; 128 return mem;