From 5cd0d3a7d175db33ec84827f0bb59dc95d13b5e3 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Tue, 12 Feb 2013 11:43:39 +0000 Subject: [PATCH] elemenatry - replace elm_object_domain_translatable_text_part_set()/text_part_get() with elm_object_domain_transltable_part_text_set(), part_text_get() SVN revision: 83856 --- ChangeLog | 4 ++++ NEWS | 5 ++++- src/lib/elm_deprecated.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/lib/elm_main.c | 20 ++++++++++++++++---- src/lib/elm_object.h | 16 +++++++++++----- src/lib/elm_widget.c | 20 ++++++++++---------- src/lib/elm_widget.h | 16 ++++++++-------- 7 files changed, 99 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 640a7e9..60079d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1001,3 +1001,7 @@ * Fix elc_player pause state to be in sync. * Fix time string display to handle hours right. + +2013-02-12 ChunEon Park (Hermet) + + * replace elm_object_domain_translatable_text_part_set(), elm_object_translatable_text_part_get() with elm_object_domain)translatable_part_text_set(), elm_object_translatable_part_text_get(). diff --git a/NEWS b/NEWS index ef4b132..c02815b 100644 --- a/NEWS +++ b/NEWS @@ -34,7 +34,9 @@ Additions: * Add elm_index smart callback - "language,changed". * Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress". * Add elm_glview, elm_gengrid smart callback - "language,changed". - * Add APIs - elm_object_item_translatable_part_text_set(), elm_object_item_translatable_part_text_get(). + * Add APIs - elm_object_item_domain_translatable_part_text_set(), elm_object_item_translatable_part_text_get(). + * Add APIs - elm_object_domain_translatable_part_text_set(), elm_object_translatable_part_text_get(). + Improvements: @@ -150,6 +152,7 @@ Removals: to deprecation. Thus, people using that (unstable) API will have to adapt themselves. * Deprecate elm_label_slide_set(), elm_label_slide_get(). + * Deprecate elm_object_domain_translatable_text_part_set(), elm_object_translatable_text_part_get(). Changes since Elementary 1.0.0: ------------------------- diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index a664a0e..a201351 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -487,3 +487,49 @@ EINA_DEPRECATED EAPI void elm_label_slide_set(Evas_Object * @ingroup Label */ EINA_DEPRECATED EAPI Eina_Bool elm_label_slide_get(const Evas_Object *obj); + +/** + * Set the text for an object's part, marking it as translatable. + * + * The string to set as @p text must be the original one. Do not pass the + * return of @c gettext() here. Elementary will translate the string + * internally and set it on the object using elm_object_part_text_set(), + * also storing the original string so that it can be automatically + * translated when the language is changed with elm_language_set(). + * + * The @p domain will be stored along to find the translation in the + * correct catalog. It can be NULL, in which case it will use whatever + * domain was set by the application with @c textdomain(). This is useful + * in case you are building a library on top of Elementary that will have + * its own translatable strings, that should not be mixed with those of + * programs using the library. + * + * @param obj The object containing the text part + * @param part The name of the part to set + * @param domain The translation domain to use + * @param text The original, non-translated text to set + * + * @deprecated Use elm_object_domain_translatable_part_text_set() instead. + * + * @ingroup General + */ +EINA_DEPRECATED EAPI void elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text); + +/** + * Gets the original string set as translatable for an object + * + * When setting translated strings, the function elm_object_part_text_get() + * will return the translation returned by @c gettext(). To get the + * original string use this function. + * + * @param obj The object + * @param part The name of the part that was set + * + * @return The original, untranslated string + * + * @deprecated Use elm_object_translatable_part_text_get() instead. + * + * @ingroup General + */ +EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part); + diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 1e5d02f..c67a12d 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -1085,17 +1085,29 @@ elm_object_part_text_get(const Evas_Object *obj, const char *part) } EAPI void -elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text) +elm_object_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text) { EINA_SAFETY_ON_NULL_RETURN(obj); - elm_widget_domain_translatable_text_part_set(obj, part, domain, text); + elm_widget_domain_translatable_part_text_set(obj, part, domain, text); } EAPI const char * -elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part) +elm_object_translatable_part_text_get(const Evas_Object *obj, const char *part) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); - return elm_widget_translatable_text_part_get(obj, part); + return elm_widget_translatable_part_text_get(obj, part); +} + +EINA_DEPRECATED EAPI void +elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text) +{ + elm_object_domain_translatable_part_text_set(obj, part, domain, text); +} + +EINA_DEPRECATED EAPI const char * +elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part) +{ + return elm_object_translatable_part_text_get(obj, part); } EAPI void diff --git a/src/lib/elm_object.h b/src/lib/elm_object.h index 9b00d1c..6dd412b 100644 --- a/src/lib/elm_object.h +++ b/src/lib/elm_object.h @@ -49,13 +49,15 @@ EAPI const char *elm_object_part_text_get(const Evas_Object *ob * @param domain The translation domain to use * @param text The original, non-translated text to set * + * @since 1.8 + * * @ingroup General */ -EAPI void elm_object_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text); +EAPI void elm_object_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text); -#define elm_object_domain_translatable_text_set(obj, domain, text) elm_object_domain_translatable_text_part_set((obj), NULL, (domain), (text)) +#define elm_object_domain_translatable_text_set(obj, domain, text) elm_object_domain_translatable_part_text_set((obj), NULL, (domain), (text)) -#define elm_object_translatable_text_set(obj, text) elm_object_domain_translatable_text_part_set((obj), NULL, NULL, (text)) +#define elm_object_translatable_text_set(obj, text) elm_object_domain_translatable_part_text_set((obj), NULL, NULL, (text)) /** * Gets the original string set as translatable for an object @@ -69,11 +71,15 @@ EAPI void elm_object_domain_translatable_text_part_set(Evas_Object *obj, co * * @return The original, untranslated string * + * @see elm_object_translatable_part_text_set() + * + * @since 1.8 + * * @ingroup General */ -EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part); +EAPI const char *elm_object_translatable_part_text_get(const Evas_Object *obj, const char *part); -#define elm_object_translatable_text_get(obj) elm_object_translatable_text_part_get((obj), NULL) +#define elm_object_translatable_text_get(obj) elm_object_translatable_part_text_get((obj), NULL) /** * Set the content on part of a given container widget diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index bbae69c..54668fd 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -3605,17 +3605,17 @@ _elm_widget_text_part_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list) } EAPI void -elm_widget_domain_translatable_text_part_set(Evas_Object *obj, +elm_widget_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *label) { ELM_WIDGET_CHECK(obj); - eo_do(obj, elm_wdg_domain_translatable_text_part_set(part, domain, label)); + eo_do(obj, elm_wdg_domain_translatable_part_text_set(part, domain, label)); } static void -_elm_widget_domain_translatable_text_part_set(Eo *obj, void *_pd, va_list *list) +_elm_widget_domain_translatable_part_text_set(Eo *obj, void *_pd, va_list *list) { const char *part = va_arg(*list, const char *); const char *domain = va_arg(*list, const char *); @@ -3672,17 +3672,17 @@ _elm_widget_domain_translatable_text_part_set(Eo *obj, void *_pd, va_list *list) } EAPI const char * -elm_widget_translatable_text_part_get(const Evas_Object *obj, +elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part) { ELM_WIDGET_CHECK(obj) NULL; const char *ret = NULL; - eo_do((Eo *) obj, elm_wdg_translatable_text_part_get(part, &ret)); + eo_do((Eo *) obj, elm_wdg_translatable_part_text_get(part, &ret)); return ret; } static void -_elm_widget_translatable_text_part_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +_elm_widget_translatable_part_text_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) { const char *part = va_arg(*list, const char *); const char **ret = va_arg(*list, const char **); @@ -5510,8 +5510,8 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TEXT_PART_SET), _elm_widget_text_part_set), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TEXT_PART_GET), _elm_widget_text_part_get), - EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_TEXT_PART_SET), _elm_widget_domain_translatable_text_part_set), - EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATABLE_TEXT_PART_GET), _elm_widget_translatable_text_part_get), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_PART_TEXT_SET), _elm_widget_domain_translatable_part_text_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATABLE_PART_TEXT_GET), _elm_widget_translatable_part_text_get), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_INFO_SET), _elm_widget_access_info_set), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS_INFO_GET), _elm_widget_access_info_get), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME_SET), _elm_widget_theme_set), @@ -5646,8 +5646,8 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TEXT_PART_SET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TEXT_PART_GET, "description here"), - EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_TEXT_PART_SET, "description here"), - EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TRANSLATABLE_TEXT_PART_GET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_PART_TEXT_SET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TRANSLATABLE_PART_TEXT_GET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ACCESS_INFO_SET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ACCESS_INFO_GET, "description here"), diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index ff62222..82f2296 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -684,8 +684,8 @@ EAPI unsigned int elm_widget_focus_order_get(const Evas_Object *obj); EAPI void elm_widget_activate(Evas_Object *obj, Elm_Activate act); EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label); EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part); -EAPI void elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text); -EAPI const char *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part); +EAPI void elm_widget_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text); +EAPI const char *elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part); EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part); EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); @@ -1073,8 +1073,8 @@ enum ELM_WIDGET_SUB_ID_TEXT_PART_SET, ELM_WIDGET_SUB_ID_TEXT_PART_GET, - ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_TEXT_PART_SET, - ELM_WIDGET_SUB_ID_TRANSLATABLE_TEXT_PART_GET, + ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_PART_TEXT_SET, + ELM_WIDGET_SUB_ID_TRANSLATABLE_PART_TEXT_GET, ELM_WIDGET_SUB_ID_ACCESS_INFO_SET, ELM_WIDGET_SUB_ID_ACCESS_INFO_GET, @@ -1791,7 +1791,7 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); /** - * @def elm_wdg_domain_translatable_text_part_set + * @def elm_wdg_domain_translatable_part_text_set * @since 1.8 * * No description supplied by the EAPI. @@ -1801,10 +1801,10 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); * @param[in] label * */ -#define elm_wdg_domain_translatable_text_part_set(part, domain, label) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_TEXT_PART_SET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(const char *, domain), EO_TYPECHECK(const char *, label) +#define elm_wdg_domain_translatable_part_text_set(part, domain, label) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DOMAIN_TRANSLATABLE_PART_TEXT_SET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(const char *, domain), EO_TYPECHECK(const char *, label) /** - * @def elm_wdg_translatable_text_part_get + * @def elm_wdg_translatable_part_text_get * @since 1.8 * * No description supplied by the EAPI. @@ -1813,7 +1813,7 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); * @param[out] ret * */ -#define elm_wdg_translatable_text_part_get(part, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATABLE_TEXT_PART_GET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(const char **, ret) +#define elm_wdg_translatable_part_text_get(part, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATABLE_PART_TEXT_GET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(const char **, ret) /** -- 2.7.4