From a525546de2b87db7f0aaa346e7a5077a649198df Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 5 Aug 2009 16:07:51 +0300 Subject: [PATCH] Ticket #1435 (Editor search options i18n) * Fix runtime translation of search types array; * reworked function mc_search_get_types_strings_array. Thanks to dmartina for bugreport. Signed-off-by: Slava Zanko --- src/search/lib.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/search/lib.c b/src/search/lib.c index 99db25bf0..7ceeb4994 100644 --- a/src/search/lib.c +++ b/src/search/lib.c @@ -243,21 +243,19 @@ mc_search__toupper_case_str (const char *charset, const char *str, gsize str_len gchar ** mc_search_get_types_strings_array (void) { - GString *tmp; gchar **ret; + int index; const mc_search_type_str_t *type_str; const mc_search_type_str_t *types_str = mc_search_types_list_get (); - tmp = g_string_new (""); - type_str = types_str; - while (type_str->str) { - if (tmp->len) - g_string_append (tmp, "__||__"); - g_string_append (tmp, type_str->str); - type_str++; + ret = g_malloc0(sizeof(char**) * sizeof(types_str) ); + if (ret == NULL) + return NULL; + + for (index=0, type_str = types_str; type_str->str != NULL; type_str++, index++){ + ret[index] = g_strdup(_(type_str->str)); } - ret = g_strsplit (tmp->str, "__||__", -1); - g_string_free (tmp, TRUE); + return ret; }