From: handa Date: Wed, 14 Dec 2005 03:41:52 +0000 (+0000) Subject: (minput_get_title_icon): Check the default icon for the X-Git-Tag: REL-1-3-0~15 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da0afecbe6a7127b1d965bf88ed14618b93e1d6a;p=m17n%2Fm17n-lib.git (minput_get_title_icon): Check the default icon for the input method. --- diff --git a/src/input.c b/src/input.c index 0cd4967..cf39fca 100644 --- a/src/input.c +++ b/src/input.c @@ -3792,7 +3792,8 @@ minput_get_title_icon (MSymbol language, MSymbol name) { MPlist *plist = load_partial_im_info (language, name, Mnil, Mtitle); MPlist *pl; - MText *mt = NULL; + char *file = NULL; + MText *mt; if (! plist) return NULL; @@ -3807,23 +3808,31 @@ minput_get_title_icon (MSymbol language, MSymbol name) M17N_OBJECT_UNREF (plist); plist = pl; pl = MPLIST_NEXT (pl); - if (MPLIST_MTEXT_P (pl) - && mtext_nchars (MPLIST_MTEXT (pl)) > 0) + if (MPLIST_MTEXT_P (pl)) { - char *file; - - mt = MPLIST_MTEXT (pl); - file = mdatabase__find_file ((char *) MTEXT_DATA (mt)); - if (file) + if (mtext_nchars (MPLIST_MTEXT (pl)) > 0) { - mt = mtext_from_data (file, strlen (file), MTEXT_FORMAT_UTF_8); - mplist_set (pl, Mtext, mt); - M17N_OBJECT_UNREF (mt); + mt = MPLIST_MTEXT (pl); + file = mdatabase__find_file ((char *) MTEXT_DATA (mt)); } - else - mt = NULL; } - if (! mt) + else if (language != Mnil && name != Mnil) + + { + file = alloca (MSYMBOL_NAMELEN (language) + MSYMBOL_NAMELEN (name) + 12); + sprintf (file, "icon/%s-%s.png", (char *) MSYMBOL_NAME (language), + (char *) MSYMBOL_NAME (name)); + file = mdatabase__find_file (file); + } + + if (file) + { + mt = mtext__from_data (file, strlen (file), MTEXT_FORMAT_UTF_8, 1); + free (file); + mplist_set (pl, Mtext, mt); + M17N_OBJECT_UNREF (mt); + } + else mplist_set (pl, Mnil, NULL); return plist; }