From 958c782e41408abd35fa3e1eedc5557dea780781 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 23 Mar 2007 01:16:54 +0000 Subject: [PATCH] *** empty log message *** --- AUTHORS | 8 ++++-- Makefile.am | 7 +++-- README | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ po/ja.po | 16 +++++------ src/m17n-im-config.h | 49 ++++++++++++++++++++++++++++++--- src/main.c | 62 ++++++++++++++++++++++++++++++++---------- src/mim-config.c | 60 +++++++++++++++++++++++++++++----------- 7 files changed, 228 insertions(+), 48 deletions(-) diff --git a/AUTHORS b/AUTHORS index 57d7707..76e2942 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,6 @@ -Kenichi Handa -Naoto Takahashi +Core developers: + + Kenichi Handa + Mikiko Nishikimi + Naoto Takahashi + Satoru Tomura diff --git a/Makefile.am b/Makefile.am index 6ba88a7..d1b4128 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,10 @@ -# Makefile.am -- top level Makefile for the m17n library. -# Copyright (C) 2003, 2004 +# Makefile.am -- Makefile for the m17n-im-config package +# Copyright (C) 2007 # National Institute of Advanced Industrial Science and Technology (AIST) # Registration Number H15PRO112 -# This file is part of the m17n library. +# This file is part of the m17n-im-config package; a sub-part of the +# m17n library. # The m17n library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License diff --git a/README b/README index e69de29..4ddab4f 100644 --- a/README +++ b/README @@ -0,0 +1,74 @@ +This directory tree holds version 0.9.0 of the m17n-im-config package. +Copyright (C) 2007 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H15PRO112 +See the end for copying conditions. + +(1) What is this package. + +This package provides: + +(1-1) C library to create a GTK+ widget for per-user configuration of +input methods provided by the m17n. + +(1-2) Standalone GTK+ program that uses the above widget. + + +(2) How to install. + +(2-1) Prerequisite + +This package requires these libralies: + + * the m17n library of version 1.3.4 or the later. + + * GTK+ version 2.4.0 or the later + +(2-2) From CVS working directory + +Run the script "bootstrap.sh" in this directory. It is tested that +the script run successfully with these versions of autotools. + + libtool-1.5.6 + automake-1.4-p6 + autoconf-2.59 + +Then, proceed to the next step. + +(2-3) From the tarball. + +Run the following commands: + + % ./configure + % make + % make install + + +(3) Documentaion + + + +---------------------------------------------------------------------- +Copyright information + +Copyright (C) 2007 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H15PRO112 + +This file is part of the m17n-im-config package; a sub-part of the +m17n library.. + +The m17n library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public License +as published by the Free Software Foundation; either version 2.1 of +the License, or (at your option) any later version. + +The m17n library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with the m17n library; if not, write to the Free +Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. diff --git a/po/ja.po b/po/ja.po index c475ed3..b1b29c3 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: m17n-im-config 0.9.0\n" "Report-Msgid-Bugs-To: m17n-lib@m17n.org\n" -"POT-Creation-Date: 2007-03-19 11:23+0900\n" +"POT-Creation-Date: 2007-03-20 23:25+0900\n" "PO-Revision-Date: 2007-03-18 18:19+0900\n" "Last-Translator: Kenichi Handa \n" "Language-Team: Japanese \n" @@ -25,31 +25,31 @@ msgstr " msgid "Default" msgstr "¥Ç¥Õ¥©¥ë¥ÈÃÍ" -#: src/mim-config.c:317 +#: src/mim-config.c:315 msgid "global" msgstr "¥°¥í¡¼¥Ð¥ë" -#: src/mim-config.c:467 +#: src/mim-config.c:465 msgid "default" msgstr "¥Ç¥Õ¥©¥ë¥ÈÃÍ" -#: src/mim-config.c:468 +#: src/mim-config.c:466 msgid "customized" msgstr "¥æ¡¼¥¶ÀßÄê" -#: src/mim-config.c:469 +#: src/mim-config.c:467 msgid "modified" msgstr "Êѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹" -#: src/mim-config.c:470 +#: src/mim-config.c:468 msgid "uncustomizable" msgstr "Êѹ¹ÉÔ²Ä" -#: src/mim-config.c:480 +#: src/mim-config.c:478 msgid "Input Method" msgstr "ÆþÎϥ᥽¥Ã¥É" -#: src/mim-config.c:485 +#: src/mim-config.c:483 msgid "status" msgstr "¾õÂÖ" diff --git a/src/m17n-im-config.h b/src/m17n-im-config.h index cd0281b..f3dc539 100644 --- a/src/m17n-im-config.h +++ b/src/m17n-im-config.h @@ -1,10 +1,51 @@ +/* m17n-im-config.c -- M17N input method configuration header file + Copyright (C) 2007 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H15PRO112 + + This file is part of the m17n-im-config package; a sub-part of the + m17n library. + + The m17n library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The m17n library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the m17n library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + 02111-1307, USA. */ + +#ifndef _M17N_IM_CONFIG_H_ +#define _M17N_IM_CONFIG_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + + +extern int mim_config_init (void); +extern int mim_config_fini (void); + typedef struct _MimConfigCallback { void (*func) (gboolean modified, gpointer arg); gpointer arg; } MimConfigCallback; -GtkWidget *mim_config_widget (MimConfigCallback *callback); -gboolean mim_config_modified (GtkWidget *config); -gboolean mim_config_revert (GtkWidget *config); -gboolean mim_config_save (GtkWidget *config); +extern GtkWidget *mim_config_widget (MimConfigCallback *callback); +extern gboolean mim_config_modified (GtkWidget *config); +extern gboolean mim_config_revert (GtkWidget *config); +extern gboolean mim_config_save (GtkWidget *config); + +#ifdef __cplusplus +} +#endif + +#endif /* _M17N_IM_CONFIG_H_ */ diff --git a/src/main.c b/src/main.c index d4590fd..498d651 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,26 @@ +/* main.c -- M17N input method configuration tool + Copyright (C) 2007 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H15PRO112 + + This file is part of the m17n-im-config package; a sub-part of the + m17n library. + + The m17n library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The m17n library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the m17n library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + 02111-1307, USA. */ + #include #include #include @@ -5,11 +28,21 @@ #include #include +/* Argument to callback functions. */ + struct ConfigSaveRevert { - GtkWidget *config, *save, *revert; + /* IM configuration widget created by mim_config_widget (). */ + GtkWidget *config; + /* Button widget "revert" */ + GtkWidget *revert; + /* Button widget "save" */ + GtkWidget *save; }; + +/* Called when the status of configuration (modified or not) is + changed. */ void status_changed_cb (gboolean modified, gpointer data) { @@ -19,28 +52,20 @@ status_changed_cb (gboolean modified, gpointer data) { if (! modified) { - gtk_widget_set_sensitive (config_save_revert->save, FALSE); gtk_widget_set_sensitive (config_save_revert->revert, FALSE); + gtk_widget_set_sensitive (config_save_revert->save, FALSE); } } else { if (modified) { - gtk_widget_set_sensitive (config_save_revert->save, TRUE); gtk_widget_set_sensitive (config_save_revert->revert, TRUE); + gtk_widget_set_sensitive (config_save_revert->save, TRUE); } } } -static gboolean -delete (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - gtk_main_quit (); - return FALSE; -} - - static void revert_clicked_cb (GtkButton *button, gpointer data) { @@ -114,6 +139,12 @@ main (int argc, char **argv) bind_textdomain_codeset ("m17n-im-config", "UTF-8"); #endif gtk_init (&argc, &argv); + if (mim_config_init () < 0) + { + g_print ("m17n-im-config initialization error\n"); + exit (1); + } + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (window, 500, 300); gtk_window_set_title (GTK_WINDOW (window), _("M17N-IM Configuration")); @@ -137,7 +168,7 @@ main (int argc, char **argv) +---------------------------------------+ */ - vbox = gtk_vbox_new (FALSE, 10); + vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); revert = gtk_button_new_from_stock (GTK_STOCK_REVERT_TO_SAVED); @@ -147,8 +178,8 @@ main (int argc, char **argv) quit = gtk_button_new_from_stock (GTK_STOCK_QUIT); ok = gtk_button_new_from_stock (GTK_STOCK_OK); - config_save_revert.save = save; config_save_revert.revert = revert; + config_save_revert.save = save; callback.func = status_changed_cb; callback.arg = &config_save_revert; config = mim_config_widget (&callback); @@ -166,15 +197,16 @@ main (int argc, char **argv) hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing (GTK_BOX (hbox), 10); + gtk_box_set_spacing (GTK_BOX (hbox), 5); gtk_container_add (GTK_CONTAINER (hbox), revert); gtk_container_add (GTK_CONTAINER (hbox), save); gtk_container_add (GTK_CONTAINER (hbox), quit); gtk_container_add (GTK_CONTAINER (hbox), ok); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5); gtk_widget_show_all (window); gtk_main (); + mim_config_fini (); return 0; } diff --git a/src/mim-config.c b/src/mim-config.c index ff2dc31..3d41031 100644 --- a/src/mim-config.c +++ b/src/mim-config.c @@ -1,3 +1,26 @@ +/* mim-config.c -- M17N input method configuration + Copyright (C) 2007 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H15PRO112 + + This file is part of the m17n-im-config package; a sub-part of the + m17n library. + + The m17n library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The m17n library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the m17n library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + 02111-1307, USA. */ + #include #include #include @@ -263,13 +286,6 @@ tree_activated_cb (GtkTreeView *tree, GtkTreePath *path, } } -static gboolean -config_deleted_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - M17N_FINI (); - return FALSE; -} - typedef struct _MimTable { gchar *lang; @@ -447,14 +463,9 @@ set_as_saved (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, /* Public API */ -GtkWidget * -mim_config_widget (MimConfigCallback *callback) +int +mim_config_init () { - GtkWidget *tree, *config; - GtkTreeStore *store; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - M17N_INIT (); #if ENABLE_NLS @@ -467,6 +478,25 @@ mim_config_widget (MimConfigCallback *callback) mim_status_str[MIM_STATUS_MODIFIED] = _("modified"); mim_status_str[MIM_STATUS_NO] = _("uncustomizable"); + return 0; +} + +int +mim_config_fini () +{ + M17N_FINI (); + + return 0; +} + +GtkWidget * +mim_config_widget (MimConfigCallback *callback) +{ + GtkWidget *tree, *config; + GtkTreeStore *store; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + store = make_store_for_input_methods (); tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (G_OBJECT (store)); @@ -492,8 +522,6 @@ mim_config_widget (MimConfigCallback *callback) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (config), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (config), tree); - g_signal_connect (G_OBJECT (config), "destroy", - G_CALLBACK (config_deleted_cb), NULL); g_object_set_data (G_OBJECT (config), CONFIG_TREE_VIEW, tree); -- 1.7.10.4