From 0ffbd09547763f4f420fa5600775b1a600642568 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 8 Jun 2007 12:33:02 +0000 Subject: [PATCH] *** empty log message *** --- src/mim-config.c | 53 +++++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/mim-config.c b/src/mim-config.c index 6c0e665..42c7cf3 100644 --- a/src/mim-config.c +++ b/src/mim-config.c @@ -248,7 +248,8 @@ tree_activated_cb (GtkTreeView *tree, GtkTreePath *path, typedef struct _MimTable { - gchar *lang_in_locale; + int lang_in_locale; + gchar *encoded_lang; gchar *lang; gchar *name; MSymbol symlang; @@ -266,26 +267,14 @@ sort_im (const void *p1, const void *p2) result = 0; else { - if (t1->lang_in_locale) - { - if (t2->lang_in_locale) - result = strcoll (t1->lang_in_locale, t2->lang_in_locale); - else - result = -1; - } - else if (t2->lang_in_locale) - result = 1; - else if (t1->lang) - { - if (t2->lang) - result = strcmp (t1->lang, t2->lang); - else - result = -1; - } - else if (t2->lang) - result = 1; + if (t1->lang_in_locale != t2->lang_in_locale) + return (t1->lang_in_locale ? -1 : 1); + if ((! t1->encoded_lang) != (! t2->encoded_lang)) + return (t1->encoded_lang ? -1 : 1); + if (t1->encoded_lang) + result = strcoll (t1->encoded_lang, t2->encoded_lang); else - result = 0; + result = strcmp (t1->lang, t2->lang); } return (result ? result : strcmp (t1->name, t2->name)); @@ -363,13 +352,16 @@ make_store_for_input_methods () imtable[i].symlang = tag[1]; imtable[i].symname = tag[2]; imtable[i].name = msymbol_name (tag[2]); - imtable[i].lang = imtable[i].lang_in_locale = NULL; + imtable[i].lang = imtable[i].encoded_lang = NULL; + imtable[i].lang_in_locale = 0; if (tag[1] != Mt) { - pl = mlanguage_name_list (tag[1], Mnil); - if (! pl) - pl = mlanguage_name_list (tag[1], Meng); + pl = mlanguage_name_list (tag[1], Mnil, Mnil, Mnil); + if (pl) + imtable[i].lang_in_locale = 1; + else + pl = mlanguage_name_list (tag[1], Meng, Mnil, Mnil); if (pl) { MText *mt = mplist_value (pl); @@ -381,15 +373,16 @@ make_store_for_input_methods () nbytes = mconv_encode (converter, mt); if (converter->result == MCONVERSION_RESULT_SUCCESS) { - conv_buf[nbytes] = '\0'; - imtable[i].lang_in_locale = alloca (nbytes + 1); - if (imtable[i].lang_in_locale) - memcpy (imtable[i].lang_in_locale, conv_buf, - nbytes + 1); + imtable[i].encoded_lang = alloca (nbytes + 1); + if (imtable[i].encoded_lang) + { + memcpy (imtable[i].encoded_lang, conv_buf, nbytes); + imtable[i].encoded_lang[nbytes] = '\0'; + } } } else if (locale_is_utf8) - imtable[i].lang_in_locale + imtable[i].encoded_lang = mtext_data (mt, NULL, NULL, NULL, NULL); imtable[i].lang = mtext_data (mt, NULL, NULL, NULL, NULL); } -- 1.7.10.4