Elementary Toggle: Don't use deprecated functions
authorbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 24 Oct 2011 23:41:11 +0000 (23:41 +0000)
committerbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 24 Oct 2011 23:41:11 +0000 (23:41 +0000)
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.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64363 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_toggle.c
src/edje_externals/elm_toggle.c
src/lib/elm_toggle.c

index 57c5f47..5ca11d9 100644 (file)
@@ -35,7 +35,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
    elm_object_text_set(tg, "Icon sized to toggle");
    elm_check_icon_set(tg, ic);
    elm_check_state_set(tg, 1);
-   elm_check_states_labels_set(tg, "Yes", "No");
+   elm_object_text_part_set(tg, "on", "Yes");
+   elm_object_text_part_set(tg, "off", "No");
    elm_box_pack_end(bx, tg);
    evas_object_show(tg);
    evas_object_show(ic);
@@ -70,8 +71,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
    tg = elm_check_add(win);
    elm_object_style_set(tg, "toggle");
    elm_object_text_set(tg, "Label Only");
-   elm_check_states_labels_set(tg, "Big long fun times label",
-                                "Small long happy fun label");
+   elm_object_text_part_set(tg, "on", "Big long fun times label");
+   elm_object_text_part_set(tg, "off", "Small long happy fun label");
    elm_box_pack_end(bx, tg);
    evas_object_show(tg);
 
index 83b0809..86c0437 100644 (file)
@@ -26,17 +26,10 @@ external_toggle_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
    if (p->icon)
      elm_check_icon_set(obj, p->icon);
 
-   if ((p->on) && (p->off))
-     elm_check_states_labels_set(obj, p->on, p->off);
-   else if ((p->on) || (p->off))
-     {
-       const char *on, *off;
-       elm_check_states_labels_get(obj, &on, &off);
-       if (p->on)
-         elm_check_states_labels_set(obj, p->on, off);
-       else
-         elm_check_states_labels_set(obj, on, p->off);
-     }
+   if (p->on)
+     elm_object_text_part_set(obj, "on", p->on);
+   if (p->off)
+     elm_object_text_part_set(obj, "off", p->off);
 
    if (p->state_exists)
      elm_check_state_set(obj, p->state);
@@ -67,9 +60,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
          {
-            const char *on, *off;
-            elm_check_states_labels_get(obj, &on, &off);
-            elm_check_states_labels_set(obj, param->s, off);
+            elm_object_text_part_set(obj, "on", param->s);
             return EINA_TRUE;
          }
      }
@@ -77,9 +68,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
          {
-            const char *on, *off;
-            elm_check_states_labels_get(obj, &on, &off);
-            elm_check_states_labels_set(obj, on, param->s);
+            elm_object_text_part_set(obj, "off", param->s);
             return EINA_TRUE;
          }
      }
@@ -118,9 +107,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
          {
-            const char *on, *off;
-            elm_check_states_labels_get(obj, &on, &off);
-            param->s = on;
+            param->s = elm_object_text_part_get(obj, "on");
             return EINA_TRUE;
          }
      }
@@ -128,9 +115,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
      {
        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
          {
-            const char *on, *off;
-            elm_check_states_labels_get(obj, &on, &off);
-            param->s = off;
+            param->s = elm_object_text_part_get(obj, "off");
             return EINA_TRUE;
          }
      }
index 1c7f1af..b4c8edb 100644 (file)
@@ -8,7 +8,8 @@ elm_toggle_add(Evas_Object *parent)
 
    obj = elm_check_add(parent);
    elm_object_style_set(obj, "toggle");
-   elm_check_states_labels_set(obj, E_("ON"), E_("OFF"));
+   elm_object_text_part_set(obj, "on", E_("ON"));
+   elm_object_text_part_set(obj, "off", E_("OFF"));
    return obj;
 }
 
@@ -45,13 +46,15 @@ elm_toggle_icon_unset(Evas_Object *obj)
 EAPI void
 elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel)
 {
-   elm_check_states_labels_set(obj, onlabel, offlabel);
+   elm_object_text_part_set(obj, "on", onlabel);
+   elm_object_text_part_set(obj, "off", offlabel);
 }
 
 EAPI void
 elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel)
 {
-   elm_check_states_labels_get(obj, onlabel, offlabel);
+   if (onlabel) *onlabel = elm_object_text_part_get(obj, "on");
+   if (offlabel) *offlabel = elm_object_text_part_get(obj, "off");
 }
 
 EAPI void