[genlist] apply r71140 with local enhancement
[framework/uifw/elementary.git] / src / lib / elm_check.c
index 9349c04..efa3ccc 100644 (file)
@@ -98,6 +98,13 @@ _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
 static void
 _theme_hook(Evas_Object *obj)
 {
+   unsigned int counter = 0;
+   unsigned int i = 1;
+   unsigned int length = 0;
+   const char *str = NULL;
+   char labels[128] ;
+   char buffer[PATH_MAX]={'\0',};
+   char s1[PATH_MAX] = {'\0',};
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
    _elm_widget_mirrored_reload(obj);
@@ -115,13 +122,30 @@ _theme_hook(Evas_Object *obj)
      edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
    else
      edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
-   edje_object_part_text_set(wd->chk, "elm.text", wd->label);
-   edje_object_part_text_set(wd->chk, "elm.ontext", wd->ontext);
-   edje_object_part_text_set(wd->chk, "elm.offtext", wd->offtext);
+   edje_object_part_text_escaped_set(wd->chk, "elm.text", wd->label);
+   edje_object_part_text_escaped_set(wd->chk, "elm.ontext", wd->ontext);
+   edje_object_part_text_escaped_set(wd->chk, "elm.offtext", wd->offtext);
    if (elm_widget_disabled_get(obj))
      edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
    edje_object_message_signal_process(wd->chk);
    edje_object_scale_set(wd->chk, elm_widget_scale_get(obj) * _elm_config->scale);
+   //introduced internationalization of additional text parts used in style
+   while (1)
+     {
+        // s1 is  used  to store part name while buffer is used to store the part's value string
+        snprintf(labels,sizeof(labels),"label_%d",i++);
+        str = edje_object_data_get(wd->chk,labels);
+        if (!str) break;
+        length = strlen(str);
+        while ((str[counter]!= ' ') && (counter < length))
+          counter++;
+        if (counter == length)
+          continue;
+        strncpy(s1, str, counter);
+        s1[counter] = '\0';
+        strncpy(buffer, str + counter, sizeof(buffer));
+        edje_object_part_text_set(wd->chk, s1, E_(buffer));
+     }
    _sizing_eval(obj);
 }
 
@@ -283,11 +307,7 @@ _content_unset_hook(Evas_Object *obj, const char *part)
    if (!wd->icon) return NULL;
    Evas_Object *icon = wd->icon;
    elm_widget_sub_object_del(obj, wd->icon);
-   evas_object_event_callback_del_full(wd->icon,
-                                       EVAS_CALLBACK_CHANGED_SIZE_HINTS,
-                                       _changed_size_hints, obj);
-   edje_object_part_unswallow(wd->chk, wd->icon);
-   wd->icon = NULL;
+   edje_object_part_unswallow(wd->chk, icon);
    return icon;
 }
 
@@ -345,17 +365,17 @@ _elm_check_label_set(Evas_Object *obj, const char *item, const char *label)
         else
            edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
         edje_object_message_signal_process(wd->chk);
-        edje_object_part_text_set(wd->chk, "elm.text", label);
+        edje_object_part_text_escaped_set(wd->chk, "elm.text", label);
      }
    else if ((item) && (!strcmp(item, "on")))
      {
         eina_stringshare_replace(&wd->ontext, label);
-        edje_object_part_text_set(wd->chk, "elm.ontext", wd->ontext);
+        edje_object_part_text_escaped_set(wd->chk, "elm.ontext", wd->ontext);
      }
    else if ((item) && (!strcmp(item, "off")))
      {
         eina_stringshare_replace(&wd->offtext, label);
-        edje_object_part_text_set(wd->chk, "elm.offtext", wd->offtext);
+        edje_object_part_text_escaped_set(wd->chk, "elm.offtext", wd->offtext);
      }
    _sizing_eval(obj);
 }