Elm label: Adjusted according to latest evas/edje changes.
authorTom Hacohen <tom@stosb.com>
Wed, 7 Mar 2012 14:02:42 +0000 (14:02 +0000)
committerTom Hacohen <tom@stosb.com>
Wed, 7 Mar 2012 14:02:42 +0000 (14:02 +0000)
SVN revision: 68953

src/lib/elm_label.c

index 93cc7a1..a9025af 100644 (file)
@@ -28,6 +28,7 @@ static int _get_value_in_key_string(const char *oldstring, const char *key, char
 static int _strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *value, int deleteflag);
 static int _stringshare_key_value_replace(const char **srcstring, const char *key, const char *value, int deleteflag);
 static void _label_sliding_change(Evas_Object *obj);
+static void _label_format_set(Evas_Object *obj, const char *format);
 
 static void
 _elm_recalc_job(void *data)
@@ -97,7 +98,7 @@ _theme_hook(Evas_Object *obj)
    _elm_widget_mirrored_reload(obj);
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
    _theme_change(obj);
-   edje_object_part_text_style_user_set(wd->lbl, "elm.text", wd->format);
+   _label_format_set(wd->lbl, wd->format);
    edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
    edje_object_scale_set(wd->lbl, elm_widget_scale_get(obj) *
                          _elm_config->scale);
@@ -146,6 +147,15 @@ _lbl_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *e
    if (wd->linewrap) _sizing_eval(data);
 }
 
+static void
+_label_format_set(Evas_Object *obj, const char *format)
+{
+   if (format)
+      edje_object_part_text_style_user_push(obj, "elm.text", format);
+   else
+      edje_object_part_text_style_user_pop(obj, "elm.text");
+}
+
 static int
 _get_value_in_key_string(const char *oldstring, const char *key, char **value)
 {
@@ -303,8 +313,7 @@ _elm_label_label_set(Evas_Object *obj, const char *item, const char *label)
    if (item && strcmp(item, "default")) return;
    if (!label) label = "";
    eina_stringshare_replace(&wd->label, label);
-   edje_object_part_text_style_user_set(wd->lbl, "elm.text",
-         wd->format);
+   _label_format_set(wd->lbl, wd->format);
    edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
    wd->changed = 1;
    _sizing_eval(obj);
@@ -357,8 +366,7 @@ elm_label_add(Evas_Object *parent)
    _elm_theme_object_set(obj, wd->lbl, "label", "base", "default");
    wd->format = eina_stringshare_add("");
    wd->label = eina_stringshare_add("<br>");
-   edje_object_part_text_style_user_set(wd->lbl, "elm.text",
-         wd->format);
+   _label_format_set(wd->lbl, wd->format);
    edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
 
    elm_widget_resize_object_set(obj, wd->lbl);
@@ -416,8 +424,7 @@ elm_label_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
    if (_stringshare_key_value_replace(&wd->format,
             "wrap", wrap_str, 0) == 0)
      {
-        edje_object_part_text_style_user_set(wd->lbl, "elm.text",
-              wd->format);
+        _label_format_set(wd->lbl, wd->format);
         edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
         wd->changed = 1;
         _sizing_eval(obj);
@@ -443,8 +450,7 @@ elm_label_wrap_width_set(Evas_Object *obj, Evas_Coord w)
    if (wd->wrap_w == w) return;
    if (wd->ellipsis)
      {
-        edje_object_part_text_style_user_set(wd->lbl, "elm.text",
-              wd->format);
+        _label_format_set(wd->lbl, wd->format);
         edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
      }
    wd->wrap_w = w;
@@ -529,8 +535,7 @@ elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis)
    if (_stringshare_key_value_replace(&wd->format,
             "ellipsis", eina_strbuf_string_get(fontbuf), removeflag) == 0)
      {
-        edje_object_part_text_style_user_set(wd->lbl, "elm.text",
-              wd->format);
+        _label_format_set(wd->lbl, wd->format);
         edje_object_part_text_set(wd->lbl, "elm.text", wd->label);
         wd->changed = 1;
         _sizing_eval(obj);