Edje text_class: Unified the _object_text_class_set code a bit more.
authortasn <tasn>
Thu, 12 Jul 2012 08:10:29 +0000 (08:10 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 12 Jul 2012 08:10:29 +0000 (08:10 +0000)
There were two code paths, with one missing a couple of calls. Now there's
less code duplication and less bugs.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@73604 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_util.c

index 3f5d19e..3387b79 100644 (file)
@@ -907,7 +907,7 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
 {
    Edje *ed;
    Eina_List *l;
-   Edje_Text_Class *tc;
+   Edje_Text_Class *tc = NULL;
    unsigned int i;
 
    ed = _edje_fetch(obj);
@@ -927,29 +927,24 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
             /* Update new text class properties */
              eina_stringshare_replace(&tc->font, font);
             tc->size = size;
-
-            /* Update edje */
-            ed->dirty = 1;
-             ed->recalc_call = 1;
-#ifdef EDJE_CALC_CACHE
-            ed->text_part_change = 1;
-#endif
-            _edje_recalc(ed);
-            return EINA_TRUE;
+             break;
          }
      }
 
-   /* No matches, create a new text class */
-   tc = calloc(1, sizeof(Edje_Text_Class));
-   if (!tc) return EINA_FALSE;
-   tc->name = eina_stringshare_add(text_class);
-   if (!tc->name)
+   if (!tc)
      {
-       free(tc);
-       return EINA_FALSE;
+        /* No matches, create a new text class */
+        tc = calloc(1, sizeof(Edje_Text_Class));
+        if (!tc) return EINA_FALSE;
+        tc->name = eina_stringshare_add(text_class);
+        if (!tc->name)
+          {
+             free(tc);
+             return EINA_FALSE;
+          }
+        tc->font = eina_stringshare_add(font);
+        tc->size = size;
      }
-   tc->font = eina_stringshare_add(font);
-   tc->size = size;
 
    for (i = 0; i < ed->table_parts_size; i++)
      {