summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorm.biliavskyi <m.biliavskyi@samsung.com>2013-10-30 22:04:57 +0900
committerCedric Bail <cedric.bail@free.fr>2013-10-30 22:30:15 +0900
commit6af736860250f1f57c8fdd959495cc6be71b15ad (patch)
treedd99e26654958def3870741c27bc875708dbc32a /src
parentdae7b7349ecf79a41b0e89edc5e501b690119da4 (diff)
edje: make function which change style tag param's (name, value) and delete tag return Eina_Bool.
This patch make the following function return Eina_Bool so the caller can detect errors. edje_edit_style_tag_value_set edje_edit_style_tag_name_set edje_edit_style_tag_del Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v, seoz Differential Revision: https://phab.enlightenment.org/D294 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h12
-rw-r--r--src/lib/edje/edje_edit.c31
2 files changed, 26 insertions, 17 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 0b1e5c48ac..47285c6920 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -602,8 +602,10 @@ EAPI const char * edje_edit_style_tag_value_get(Evas_Object *obj, const char *st
602 * @param style Style containing the tag to change. 602 * @param style Style containing the tag to change.
603 * @param tag Name of the tag to set the value for. 603 * @param tag Name of the tag to set the value for.
604 * @param new_value Value for the tag. 604 * @param new_value Value for the tag.
605 *
606 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
605 */ 607 */
606EAPI void edje_edit_style_tag_value_set(Evas_Object *obj, const char *style, const char *tag, const char *new_value); 608EAPI Eina_Bool edje_edit_style_tag_value_set(Evas_Object *obj, const char *style, const char *tag, const char *new_value);
607 609
608/** Set the name of the given tag. 610/** Set the name of the given tag.
609 * 611 *
@@ -611,8 +613,10 @@ EAPI void edje_edit_style_tag_value_set(Evas_Object *obj, const char *style, con
611 * @param style Style containing the tag to rename. 613 * @param style Style containing the tag to rename.
612 * @param tag Tag to rename. 614 * @param tag Tag to rename.
613 * @param new_name New name for the tag. 615 * @param new_name New name for the tag.
616 *
617 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
614 */ 618 */
615EAPI void edje_edit_style_tag_name_set(Evas_Object *obj, const char *style, const char *tag, const char *new_name); 619EAPI Eina_Bool edje_edit_style_tag_name_set(Evas_Object *obj, const char *style, const char *tag, const char *new_name);
616 620
617/** Add a new tag to the given text style. 621/** Add a new tag to the given text style.
618 * 622 *
@@ -631,8 +635,10 @@ EAPI Eina_Bool edje_edit_style_tag_add(Evas_Object *obj, const char *style, cons
631 * @param obj Object being edited. 635 * @param obj Object being edited.
632 * @param style Style from where to remove the tag. 636 * @param style Style from where to remove the tag.
633 * @param tag Tag to delete. 637 * @param tag Tag to delete.
638 *
639 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
634 */ 640 */
635EAPI void edje_edit_style_tag_del(Evas_Object *obj, const char *style, const char *tag); 641EAPI Eina_Bool edje_edit_style_tag_del(Evas_Object *obj, const char *style, const char *tag);
636 642
637 643
638//@} 644//@}
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 22d3b6db0c..dabed3a0c2 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -1645,21 +1645,21 @@ edje_edit_style_tags_list_get(Evas_Object * obj, const char* style)
1645 return tags; 1645 return tags;
1646} 1646}
1647 1647
1648EAPI void 1648EAPI Eina_Bool
1649edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name) 1649edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name)
1650{ 1650{
1651 Edje_Style_Tag *t; 1651 Edje_Style_Tag *t;
1652 1652
1653 GET_ED_OR_RETURN(); 1653 GET_ED_OR_RETURN(EINA_FALSE);
1654 //printf("SET TAG NAME for '%s' FOR STYLE '%s'\n", tag, style);
1655 1654
1656 if (!ed->file || !ed->file->styles || !style || !tag) 1655 if (!ed->file || !ed->file->styles || !style || !tag)
1657 return; 1656 return EINA_FALSE;
1658 1657
1659 t = _edje_edit_style_tag_get(ed, style, tag); 1658 t = _edje_edit_style_tag_get(ed, style, tag);
1660 if (!t) return; 1659 if (!t) return EINA_FALSE;
1661 _edje_if_string_free(ed, t->key); 1660 _edje_if_string_free(ed, t->key);
1662 t->key = eina_stringshare_add(new_name); 1661 t->key = eina_stringshare_add(new_name);
1662 return EINA_TRUE;
1663} 1663}
1664 1664
1665EAPI const char* 1665EAPI const char*
@@ -1680,21 +1680,21 @@ edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char*
1680 return NULL; 1680 return NULL;
1681} 1681}
1682 1682
1683EAPI void 1683EAPI Eina_Bool
1684edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value) 1684edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value)
1685{ 1685{
1686 Edje_Style_Tag *t; 1686 Edje_Style_Tag *t;
1687 1687
1688 GET_ED_OR_RETURN(); 1688 GET_ED_OR_RETURN(EINA_FALSE);
1689 //printf("SET TAG VALUE for '%s' FOR STYLE '%s'\n", tag, style);
1690 1689
1691 if (!ed->file || !ed->file->styles || !style || !tag) 1690 if (!ed->file || !ed->file->styles || !style || !tag || !new_value)
1692 return; 1691 return EINA_FALSE;
1693 1692
1694 t = _edje_edit_style_tag_get(ed, style, tag); 1693 t = _edje_edit_style_tag_get(ed, style, tag);
1695 if (!t) return; 1694 if (!t) return EINA_FALSE;
1696 _edje_if_string_free(ed, t->value); 1695 _edje_if_string_free(ed, t->value);
1697 t->value = eina_stringshare_add(new_value); 1696 t->value = eina_stringshare_add(new_value);
1697 return EINA_TRUE;
1698} 1698}
1699 1699
1700EAPI Eina_Bool 1700EAPI Eina_Bool
@@ -1722,17 +1722,19 @@ edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_na
1722 return EINA_TRUE; 1722 return EINA_TRUE;
1723} 1723}
1724 1724
1725EAPI void 1725EAPI Eina_Bool
1726edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag) 1726edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag)
1727{ 1727{
1728 Edje_Style *s; 1728 Edje_Style *s;
1729 Edje_Style_Tag *t; 1729 Edje_Style_Tag *t;
1730 1730
1731 GET_ED_OR_RETURN(); 1731 GET_ED_OR_RETURN(EINA_FALSE);
1732 //printf("DEL TAG '%s' IN STYLE '%s'\n", tag, style); 1732 if (!ed->file || !ed->file->styles || !style || !tag )
1733 return EINA_FALSE;
1733 1734
1734 s = _edje_edit_style_get(ed, style); 1735 s = _edje_edit_style_get(ed, style);
1735 t = _edje_edit_style_tag_get(ed, style, tag); 1736 t = _edje_edit_style_tag_get(ed, style, tag);
1737 if (!s || !t) return EINA_FALSE;
1736 1738
1737 s->tags = eina_list_remove(s->tags, t); 1739 s->tags = eina_list_remove(s->tags, t);
1738 _edje_if_string_free(ed, t->key); 1740 _edje_if_string_free(ed, t->key);
@@ -1741,6 +1743,7 @@ edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag)
1741 _edje_if_string_free(ed, t->text_class); 1743 _edje_if_string_free(ed, t->text_class);
1742 free(t); 1744 free(t);
1743 t = NULL; 1745 t = NULL;
1746 return EINA_TRUE;
1744} 1747}
1745 1748
1746/*******************/ 1749/*******************/