* @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
+ */
+EINA_DEPRECATED EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part);
+
EAPI void elm_language_set(const char *lang);
/**
- * Set the text for an objects' 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
- *
- * @ingroup General
- */
-EAPI void elm_object_domain_translatable_text_part_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_translatable_text_set(obj, text) elm_object_domain_translatable_text_part_set((obj), NULL, NULL, (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
- *
- * @ingroup General
- */
-EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part);
-
-#define elm_object_translatable_text_get(obj) elm_object_translatable_text_part_get((obj), NULL)
-
-/**
* @}
*/
}
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
}
EAPI void
+elm_object_item_domain_translatable_part_text_set(Elm_Object_Item *it, const char *part, const char *domain, const char *text)
+{
+ _elm_widget_item_domain_translatable_part_text_set((Elm_Widget_Item *)it, part, domain, text);
+}
+
+EAPI const char *
+elm_object_item_translatable_part_text_get(const Elm_Object_Item *it, const char *part)
+{
+ return _elm_widget_item_translatable_part_text_get((Elm_Widget_Item *)it, part);
+}
+
+EAPI void
elm_object_access_info_set(Evas_Object *obj, const char *txt)
{
elm_widget_access_info_set(obj, txt);
#define elm_object_text_get(obj) elm_object_part_text_get((obj), NULL)
/**
+ * 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
+ *
+ * @since 1.8
+ *
+ * @ingroup General
+ */
+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_part_text_set((obj), NULL, (domain), (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
+ *
+ * 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
+ *
+ * @see elm_object_translatable_part_text_set()
+ *
+ * @since 1.8
+ *
+ * @ingroup General
+ */
+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_part_text_get((obj), NULL)
+
+/**
* Set the content on part of a given container widget
*
* @param obj The Elementary container widget
#define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL)
/**
+ * Set the text for an object item'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 item using
+ * elm_object_item_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 it The object item 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
+ *
+ * @ingroup General
+ * @since 1.8
+ */
+EAPI void elm_object_item_domain_translatable_part_text_set(Elm_Object_Item *it, const char *part, const char *domain, const char *text);
+
+#define elm_object_item_domain_translatable_text_set(it, domain, text) elm_object_item_domain_translatable_part_text_set((it), NULL, (domain), (text))
+
+#define elm_object_item_translatable_text_set(it, text) elm_object_item_domain_translatable_part_text_set((it), NULL, NULL, (text))
+
+/**
+ * Gets the original string set as translatable for an object item.
+ *
+ * When setting translated strings, the function elm_object_item_part_text_get()
+ * will return the translation returned by @c gettext(). To get the original
+ * string use this function.
+ *
+ * @param it The object item.
+ * @param part The name of the part that was set
+ *
+ * @return The original, untranslated string
+ *
+ * @ingroup General
+ * @since 1.8
+ */
+EAPI const char *elm_object_item_translatable_part_text_get(const Elm_Object_Item *it, const char *part);
+
+#define elm_object_item_translatable_text_get(it) elm_object_item_translatable_part_text_get((it), NULL)
+
+/**
* Set the text to read out when in accessibility mode
*
* @param it The object item which is to be described
return NULL;
}
-EAPI void
-elm_widget_domain_translatable_text_part_set(Evas_Object *obj,
- const char *part,
- const char *domain,
- const char *label)
+static Eina_Bool
+_translatable_part_text_set(Eina_List **translate_strings, const char *part, const char *domain, const char *label)
{
const char *str;
- Eina_List *l;
+ Eina_List *t, *l;
Elm_Translate_String_Data *ts = NULL;
- API_ENTRY return;
+ t = *translate_strings;
str = eina_stringshare_add(part);
- EINA_LIST_FOREACH(sd->translate_strings, l, ts)
- if (ts->id == str)
- break;
- else
- ts = NULL;
+ EINA_LIST_FOREACH(t, l, ts)
+ {
+ if (ts->id == str) break;
+ else ts = NULL;
+ }
if (!ts && !label)
eina_stringshare_del(str);
else if (!ts)
{
ts = malloc(sizeof(Elm_Translate_String_Data));
- if (!ts) return;
+ if (!ts) return EINA_FALSE;
ts->id = str;
ts->domain = eina_stringshare_add(domain);
ts->string = eina_stringshare_add(label);
- sd->translate_strings = eina_list_append(sd->translate_strings, ts);
+ t = eina_list_append(t, ts);
}
else
{
}
else
{
- sd->translate_strings = eina_list_remove_list(
- sd->translate_strings, l);
+ t = eina_list_remove_list(t, l);
eina_stringshare_del(ts->id);
eina_stringshare_del(ts->domain);
eina_stringshare_del(ts->string);
eina_stringshare_del(str);
}
+ *translate_strings = t;
+ return EINA_TRUE;
+}
+
+EAPI void
+elm_widget_domain_translatable_part_text_set(Evas_Object *obj,
+ const char *part,
+ const char *domain,
+ const char *label)
+{
+ API_ENTRY return;
+
+ if (!_translatable_part_text_set(&sd->translate_strings, part, domain,
+ label)) return;
#ifdef HAVE_GETTEXT
if (label && label[0])
label = dgettext(domain, label);
elm_widget_text_part_set(obj, part, label);
}
-EAPI const char *
-elm_widget_translatable_text_part_get(const Evas_Object *obj,
- const char *part)
+static const char *
+_translatable_part_text_get(Eina_List *translate_strings, const char *part)
{
- const char *str, *ret = NULL;
- Eina_List *l;
Elm_Translate_String_Data *ts;
- API_ENTRY return NULL;
+ const char*ret = NULL, *str;
+ Eina_List *l;
str = eina_stringshare_add(part);
- EINA_LIST_FOREACH(sd->translate_strings, l, ts)
+ EINA_LIST_FOREACH(translate_strings, l, ts)
if (ts->id == str)
{
ret = ts->string;
break;
}
eina_stringshare_del(str);
+
return ret;
}
+EAPI const char *
+elm_widget_translatable_part_text_get(const Evas_Object *obj,
+ const char *part)
+{
+ API_ENTRY return NULL;
+ return _translatable_part_text_get(sd->translate_strings, part);
+}
+
EAPI void
elm_widget_translate(Evas_Object *obj)
{
EAPI void
_elm_widget_item_free(Elm_Widget_Item *item)
{
+ Elm_Translate_String_Data *ts;
Elm_Widget_Item_Signal_Data *wisd;
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
free(wisd);
}
+ EINA_LIST_FREE(item->translate_strings, ts)
+ {
+ eina_stringshare_del(ts->id);
+ eina_stringshare_del(ts->domain);
+ eina_stringshare_del(ts->string);
+ free(ts);
+ }
+
EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
free(item);
}
item->disable_func = func;
}
+EAPI void
+_elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item,
+ const char *part,
+ const char *domain,
+ const char *label)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+
+ if (!_translatable_part_text_set(&item->translate_strings, part, domain,
+ label)) return;
+#ifdef HAVE_GETTEXT
+ if (label && label[0])
+ label = dgettext(domain, label);
+#endif
+ _elm_widget_item_part_text_set(item, part, label);
+}
+
+EAPI const char *
+_elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item,
+ const char *part)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+ return _translatable_part_text_get(item->translate_strings, part);
+}
+
typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip;
struct _Elm_Widget_Item_Tooltip
Evas_Object *access_obj;
const char *access_info;
Eina_List *access_order;
+ Eina_List *translate_strings;
Eina_List *signals;
Eina_Bool disabled : 1;
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);
EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item);
EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func);
EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
+EAPI void _elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item, const char *part, const char *domain, const char *label);
+EAPI const char * _elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item, const char *part);
+EAPI void _elm_widget_item_translate(Elm_Widget_Item *item);
/**
* Function to operate on a given widget's scrollabe children when necessary.