To both the reviewer and the original author: This introduces new *REAL* warnings. You are returning EINA_FALSE in a function that is meant to return a stringshare.
Copy-pasting code is bad, copy-pasting code without checking it's not absolutely broken is worse. Please check your compilation output and verify you don't introduce any new warnings, especially not severe and obviously wrong ones like this one. I'm pushing a fix now. -- Tom. On 23/02/16 12:25, Vitalii Vorobiov wrote: > furrymyad pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=559cf1e73c6efe8a38ce7b1165ec0191284c6e78 > > commit 559cf1e73c6efe8a38ce7b1165ec0191284c6e78 > Author: Vitalii Vorobiov <vi.vorob...@samsung.com> > Date: Tue Feb 23 11:47:03 2016 +0000 > > Edje_Edit: support new edje top block "text classes" with edje_edit API > > Plenty of new API: > edje_edit_text_classes_list_get - to return total list of text_classes > inside of > loaded collection of groups > edje_edit_text_class_add - add new text class into loaded collection > edje_edit_text_class_del - deleting > edje_edit_text_class_name_set - renaming existing text class into > something new > edje_edit_text_class_font_{get|set} - get/set font name > edje_edit_text_class_size_{get|set} - get/set font size > --- > src/lib/edje/Edje_Edit.h | 114 ++++++++++++++++++++++++++++++++ > src/lib/edje/edje_edit.c | 169 > +++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 283 insertions(+) > > diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h > index c5643b8..2d44e02 100644 > --- a/src/lib/edje/Edje_Edit.h > +++ b/src/lib/edje/Edje_Edit.h > @@ -729,6 +729,120 @@ EAPI Eina_Bool > edje_edit_group_data_name_set(Evas_Object *obj, const char *itemn > > > //@} > +/*****************************************************************************/ > +/*********************** TEXT CLASSES API > ********************************/ > +/*****************************************************************************/ > +/** @name Text Classes API > + * Functions to deal with Text Classes (see @ref edcref). > + */ //@{ > + > +/** Get the list of all the Text Classes in the given edje object. > + * > + * @param obj Object being edited. > + * > + * @return List of strings, each being one text class. > + * The return value should be freed with > edje_edit_string_list_free(). > + * > + * @see edje_edit_string_list_free() > + * > + * @since 1.18 > + */ > +EAPI Eina_List * > +edje_edit_text_classes_list_get(Evas_Object *obj); > + > +/** Create a new text class object in the given edje. > + * > + * If class is already exist then nothing is created and EINA_FALSE returned. > + * > + * @param obj Object being edited. > + * @param name Name for the new text class. > + * > + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Bool > +edje_edit_text_class_add(Evas_Object *obj, const char *name); > + > +/** Delete text class object from edje. > + * > + * @param obj Object being edited. > + * @param name Text class to delete. > + * > + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Bool > +edje_edit_text_class_del(Evas_Object *obj, const char *name); > + > +/** Change name of a text class. > + * > + * @param obj Object being edited. > + * @param name Text class to rename. > + * @param newname New name for the text class. > + * > + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Bool > +edje_edit_text_class_name_set(Evas_Object *obj, const char *name, const char > *newname); > + > +/** Return font name of specified text class. > + * > + * @param obj Object being edited. > + * @param class_name Text class to fetch values. > + * > + * @return font name in case of success, NULL otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Stringshare * > +edje_edit_text_class_font_get(Evas_Object *obj, const char *class_name); > + > +/** Set font for the given text class. > + * > + * NULL is possible value. > + * > + * @param obj Object being edited. > + * @param class_name Text class to set values. > + * @param font Name of font. > + * > + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Bool > +edje_edit_text_class_font_set(Evas_Object *obj, const char *class_name, > const char *font); > + > +/** Return font size of specified text class. > + * > + * @param obj Object being edited. > + * @param class_name Text class to fetch values. > + * > + * @return @c Evas_Font_Size. > + * > + * @since 1.18 > + */ > +EAPI Evas_Font_Size > +edje_edit_text_class_size_get(Evas_Object *obj, const char *class_name); > + > +/** Set font size for specified text class > + * > + * @param obj Object being edited. > + * @param class_name Text class to set values. > + * @param size Font size which is greater or equal than zero (0). > + * > + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. > + * > + * @since 1.18 > + */ > +EAPI Eina_Bool > +edje_edit_text_class_size_set(Evas_Object *obj, const char *class_name, > Evas_Font_Size size); > + > + > +//@} > > /******************************************************************************/ > /*********************** COLOR CLASSES API > ********************************/ > > /******************************************************************************/ > diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c > index c8f50f4..5af8ebf 100644 > --- a/src/lib/edje/edje_edit.c > +++ b/src/lib/edje/edje_edit.c > @@ -7373,6 +7373,175 @@ edje_edit_state_map_on_set(Evas_Object *obj, const > char *part, const char *state > return EINA_TRUE; > } > > +/*********************/ > +/* TEXT CLASSES API */ > +/*********************/ > + > +EAPI Eina_List * > +edje_edit_text_classes_list_get(Evas_Object *obj) > +{ > + Eina_List *classes = NULL; > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(NULL); > + > + if (!ed->file || !ed->file->text_classes) > + return NULL; > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + classes = eina_list_append(classes, eina_stringshare_add(tc->name)); > + > + return classes; > +} > + > +EAPI Eina_Bool > +edje_edit_text_class_add(Evas_Object *obj, const char *name) > +{ > + Eina_List *l; > + Edje_Text_Class *tc, *t; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!name || !ed->file) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (strcmp(tc->name, name) == 0) > + return EINA_FALSE; > + > + t = _alloc(sizeof(Edje_Text_Class)); > + if (!t) return EINA_FALSE; > + > + t->name = eina_stringshare_add(name); > + > + ed->file->text_classes = eina_list_append(ed->file->text_classes, t); > + > + return EINA_TRUE; > +} > + > +EAPI Eina_Bool > +edje_edit_text_class_del(Evas_Object *obj, const char *name) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!name || !ed->file || !ed->file->text_classes) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (strcmp(tc->name, name) == 0) > + { > + _edje_if_string_free(ed, &tc->name); > + _edje_if_string_free(ed, &tc->font); > + ed->file->text_classes = eina_list_remove(ed->file->text_classes, > tc); > + free(tc); > + return EINA_TRUE; > + } > + return EINA_FALSE; > +} > + > +EAPI Eina_Bool > +edje_edit_text_class_name_set(Evas_Object *obj, const char *name, const char > *newname) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!ed->file || !ed->file->text_classes) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (!strcmp(tc->name, name)) > + { > + _edje_if_string_replace(ed, &tc->name, newname); > + return EINA_TRUE; > + } > + > + return EINA_FALSE; > +} > + > +EAPI Eina_Stringshare * > +edje_edit_text_class_font_get(Evas_Object *obj, const char *class_name) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!ed->file || !ed->file->text_classes) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (!strcmp(tc->name, class_name)) > + return eina_stringshare_add(tc->font); > + > + return NULL; > +} > + > +EAPI Eina_Bool > +edje_edit_text_class_font_set(Evas_Object *obj, const char *class_name, > const char *font) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!ed->file || !ed->file->text_classes || !class_name) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (!strcmp(tc->name, class_name)) > + { > + _edje_if_string_replace(ed, &tc->font, font); > + return EINA_TRUE; > + } > + return EINA_FALSE; > +} > + > +EAPI Evas_Font_Size > +edje_edit_text_class_size_get(Evas_Object *obj, const char *class_name) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!ed->file || !ed->file->text_classes) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (!strcmp(tc->name, class_name)) > + return tc->size; > + > + return 0; > +} > + > +EAPI Eina_Bool > +edje_edit_text_class_size_set(Evas_Object *obj, const char *class_name, > Evas_Font_Size size) > +{ > + Eina_List *l; > + Edje_Text_Class *tc; > + > + GET_ED_OR_RETURN(EINA_FALSE); > + > + if (!ed->file || !ed->file->text_classes || !class_name) > + return EINA_FALSE; > + if (size < 0) > + return EINA_FALSE; > + > + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) > + if (!strcmp(tc->name, class_name)) > + { > + tc->size = size; > + return EINA_TRUE; > + } > + return EINA_FALSE; > +} > + > + > /**************/ > /* TEXT API */ > /**************/ > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel