summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseungha.son <seungha.son@samsung.com>2016-11-30 18:05:04 +0900
committerseungha.son <seungha.son@samsung.com>2016-11-30 19:32:25 +0900
commit4e834fcf17d69005828f3aea8f46be55bc337bbe (patch)
tree16f37ac369fafc9656dcd1c57a70484ddd73bd4f
parent5eb83544e46b793f7e83bea800764bbed79ee15e (diff)
downloadnotification-4e834fcf17d69005828f3aea8f46be55bc337bbe.tar.gz
notification-4e834fcf17d69005828f3aea8f46be55bc337bbe.tar.bz2
notification-4e834fcf17d69005828f3aea8f46be55bc337bbe.zip
Signed-off-by: seungha.son <seungha.son@samsung.com> Change-Id: I15f700b2c80d487da509431897847b7ec52fcb95
-rw-r--r--include/notification_private.h2
-rwxr-xr-xsrc/notification.c34
-rwxr-xr-xsrc/notification_internal.c4
-rwxr-xr-xsrc/notification_ipc.c2
4 files changed, 28 insertions, 14 deletions
diff --git a/include/notification_private.h b/include/notification_private.h
index 86866b4..06eca17 100644
--- a/include/notification_private.h
+++ b/include/notification_private.h
@@ -97,6 +97,7 @@ struct _notification {
int timeout;
int text_input_max_length;
bool event_flag;
+ bool is_translation;
uid_t uid;
};
@@ -158,6 +159,7 @@ typedef enum notification_data_type {
NOTIFICATION_DATA_TYPE_TIMEOUT,
NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH,
NOTIFICATION_DATA_TYPE_EVENT_FLAG,
+ NOTIFICATION_DATA_TYPE_TRANSLATION,
NOTIFICATION_DATA_TYPE_UID,
} notification_data_type_e;
diff --git a/src/notification.c b/src/notification.c
index c8f950c..d3a7735 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -462,21 +462,24 @@ EXPORT_API int notification_get_text(notification_h noti,
snprintf(buf_key, sizeof(buf_key), "%d", type);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL && noti->domain != NULL
- && noti->dir != NULL) {
- /* Get application string */
- bindtextdomain(noti->domain, noti->dir);
- get_str = dgettext(noti->domain, ret_val);
- if (get_str == ret_val) /* not found */
- get_str = NULL;
- } else if (ret_val != NULL) {
- /* Get system string */
- get_str = dgettext("sys_string", ret_val);
- if (get_str == ret_val) /* not found */
+ if (noti->is_translation == false) {
+ if (ret_val != NULL && noti->domain != NULL
+ && noti->dir != NULL) {
+ /* Get application string */
+ bindtextdomain(noti->domain, noti->dir);
+
+ get_str = dgettext(noti->domain, ret_val);
+ if (get_str == ret_val) /* not found */
+ get_str = NULL;
+ } else if (ret_val != NULL) {
+ /* Get system string */
+ get_str = dgettext("sys_string", ret_val);
+ if (get_str == ret_val) /* not found */
+ get_str = NULL;
+ } else {
get_str = NULL;
- } else {
- get_str = NULL;
+ }
}
}
@@ -505,7 +508,7 @@ EXPORT_API int notification_get_text(notification_h noti,
noti->num_format_args = atoi(ret_val);
}
- if (noti->num_format_args == 0) {
+ if (noti->num_format_args == 0 || noti->is_translation == true) {
*text = (char *)get_str;
} else {
/* Check first variable is count, LEFT pos */
@@ -1436,6 +1439,7 @@ static notification_h _notification_create(notification_type_e type)
noti->ongoing_value_type = NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT;
noti->timeout = 0;
noti->event_flag = false;
+ noti->is_translation = false;
if (getuid() >= REGULAR_UID_MIN) {
noti->caller_pkgname = notification_get_pkgname_by_pid();
@@ -1654,6 +1658,8 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
new_noti->temp_title = NULL;
new_noti->temp_content = NULL;
+ new_noti->is_translation = noti->is_translation;
+
*clone = new_noti;
return NOTIFICATION_ERROR_NONE;
diff --git a/src/notification_internal.c b/src/notification_internal.c
index 298a097..b02b501 100755
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -447,6 +447,8 @@ EXPORT_API int notification_translate_localized_text(notification_h noti)
bundle *b;
notification_text_type_e type = NOTIFICATION_TEXT_TYPE_TITLE;
+ noti->is_translation = false;
+
for (; type < NOTIFICATION_TEXT_TYPE_MAX; type++) {
ret = notification_get_text(noti, type, &ret_text);
if (ret == NOTIFICATION_ERROR_NONE && ret_text) {
@@ -474,6 +476,8 @@ EXPORT_API int notification_translate_localized_text(notification_h noti)
}
}
+ noti->is_translation = true;
+
return ret;
}
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index 6c5fb5b..045fdd0 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -1830,6 +1830,7 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h not
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TIMEOUT, g_variant_new_int32(noti->timeout));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, g_variant_new_int32(noti->text_input_max_length));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_EVENT_FLAG, g_variant_new_int32(noti->event_flag));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TRANSLATION, g_variant_new_int32(noti->is_translation));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_UID, g_variant_new_int32(noti->uid));
result_body = g_variant_builder_end(&builder);
@@ -1985,6 +1986,7 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti,
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TIMEOUT, "i", &noti->timeout);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, "i", &noti->text_input_max_length);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_EVENT_FLAG, "i", &noti->event_flag);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TRANSLATION, "i", &noti->is_translation);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", &noti->uid);
noti->caller_pkgname = _dup_string(caller_pkgname);