From f47e31320406e6ce7abbd5e4f21cf4b9e50410ce Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 22 Sep 2006 01:41:01 +0000 Subject: [PATCH] *** empty log message *** --- gdkdraw.c | 8 ++++---- m17n-imconf.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/gdkdraw.c b/gdkdraw.c index e1408bc..1da56d9 100644 --- a/gdkdraw.c +++ b/gdkdraw.c @@ -7,7 +7,7 @@ #include #include -#define FONT_PT_SIZE 60 +#define FONT_PT_SIZE 40 gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) @@ -37,6 +37,8 @@ main (int argc, char **argv) MSymbol utf8; char *family_names = NULL; + gtk_init (&argc, &argv); + if (argc < 2) { fprintf (stderr, "Usage: gdkdraw LANGUAGE\n"); @@ -177,8 +179,6 @@ main (int argc, char **argv) PangoAttrList *attr_list; PangoAttribute *attr_size; - gtk_init (&argc, &argv); - attr_list = pango_attr_list_new (); attr_size = pango_attr_size_new (FONT_PT_SIZE * PANGO_SCALE); attr_size->start_index = 0, attr_size->end_index = title_len; @@ -214,7 +214,6 @@ main (int argc, char **argv) box = gtk_vbox_new (FALSE, 0); text = gtk_image_new_from_pixbuf (pixbuf); label = gtk_label_new ((gchar *) title); - gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_box_pack_start (GTK_BOX (box), text, TRUE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), label, TRUE, FALSE, 0); @@ -225,6 +224,7 @@ main (int argc, char **argv) GTK_SIGNAL_FUNC (destroy), NULL); gtk_widget_show (text); gtk_widget_show (label); + gtk_label_set_attributes (GTK_LABEL (label), attr_list); gtk_widget_show (box); gtk_widget_show (window); gtk_main (); diff --git a/m17n-imconf.c b/m17n-imconf.c index d24aa26..90eb87f 100644 --- a/m17n-imconf.c +++ b/m17n-imconf.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -84,6 +85,30 @@ eval_close (MPlist *arg) } MPlist * +eval_get_description (MPlist *arg) +{ + MSymbol lang, name; + MText *mt; + MPlist *plist; + + if (! SYMBOLP (arg)) + ERROR (error_invalid_arg); + lang = mplist_value (arg); + arg = mplist_next (arg); + if (! SYMBOLP (arg)) + ERROR (error_invalid_arg); + name = mplist_value (arg); + mt = minput_get_description (lang, name); + if (! mt) + ERROR (error_command_fail); + plist = mplist (); + mplist_add (plist, Mtext, mt); + m17n_object_unref (mt); + return plist; +} + + +MPlist * parse_arg_common (MPlist *arg, MSymbol *lang, MSymbol *name, MSymbol *target) { if (TAILP (arg)) @@ -189,6 +214,7 @@ struct EvalFunc { {eval_set, "set SYMBOL FORM"}, {eval_open, "open LANG NAME"}, {eval_close, "close SYMBOL"}, + {eval_get_description, "get-description LANG NAME"}, {eval_get_command, "get-command [LANG NAME [COMMAND]]"}, {eval_config_command, "config-command LANG NAME [COMMAND [(KEY ...) ...]]"}, {eval_get_variable, "get-variable [LANG NAME [VARIABLE]]"}, @@ -235,21 +261,25 @@ eval (MPlist *plist) void init (void) { + int n; + M17N_INIT (); Merror = msymbol ("error"); Mvalue = msymbol ("value"); Meval_function = msymbol ("eval-function"); - msymbol_put (msymbol ("help"), Meval_function, eval_functions + 0); - msymbol_put (msymbol ("set"), Meval_function, eval_functions + 1); - msymbol_put (msymbol ("open"), Meval_function, eval_functions + 2); - msymbol_put (msymbol ("close"), Meval_function, eval_functions + 3); - msymbol_put (msymbol ("get-command"), Meval_function, eval_functions + 4); - msymbol_put (msymbol ("config-command"), Meval_function, eval_functions + 5); - msymbol_put (msymbol ("get-variable"), Meval_function, eval_functions + 6); - msymbol_put (msymbol ("config-variable"), Meval_function, eval_functions + 7); - msymbol_put (msymbol ("save-config"), Meval_function, eval_functions + 8); + n = 0; + msymbol_put (msymbol ("help"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("set"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("open"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("close"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("get-description"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("get-command"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("config-command"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("get-variable"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("config-variable"), Meval_function, eval_functions + n), n++; + msymbol_put (msymbol ("save-config"), Meval_function, eval_functions + n); error_invalid_format = mplist (); mplist_add (error_invalid_format, Msymbol, Merror); @@ -289,6 +319,8 @@ main () { char line[256]; + setlocale (LC_ALL, ""); + init (); while (printf ("> ") && fgets (line, 256, stdin) != NULL) -- 1.7.10.4