From 8a7e65441c024c5cb2b33530866884aaf4baa9e7 Mon Sep 17 00:00:00 2001 From: handa Date: Sun, 27 Jul 2008 02:19:59 +0000 Subject: [PATCH] New file. --- src/scim_m17n_setup.cpp | 110 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 src/scim_m17n_setup.cpp diff --git a/src/scim_m17n_setup.cpp b/src/scim_m17n_setup.cpp new file mode 100644 index 0000000..d24103b --- /dev/null +++ b/src/scim_m17n_setup.cpp @@ -0,0 +1,110 @@ +/* scim_m17n_setup.cpp - SCIM Setup Module of m17n imengine module + Copyright (C) 2008 + 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 +#include +#include +#include +#define Uses_SCIM_CONFIG_BASE +#include +#include + +#if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS) + #include + #define _(String) dgettext(GETTEXT_PACKAGE,String) + #define N_(String) (String) +#else + #define _(String) (String) + #define N_(String) (String) + #define bindtextdomain(Package,Directory) + #define textdomain(domain) + #define bind_textdomain_codeset(domain,codeset) +#endif + +using namespace scim; + +#define scim_module_init m17n_imengine_setup_LTX_scim_module_init +#define scim_module_exit m17n_imengine_setup_LTX_scim_module_exit + +#define scim_setup_module_create_ui m17n_imengine_setup_LTX_scim_setup_module_create_ui +#define scim_setup_module_get_category m17n_imengine_setup_LTX_scim_setup_module_get_category +#define scim_setup_module_get_name m17n_imengine_setup_LTX_scim_setup_module_get_name +#define scim_setup_module_get_description m17n_imengine_setup_LTX_scim_setup_module_get_description +#define scim_setup_module_load_config m17n_imengine_setup_LTX_scim_setup_module_load_config +#define scim_setup_module_save_config m17n_imengine_setup_LTX_scim_setup_module_save_config +#define scim_setup_module_query_changed m17n_imengine_setup_LTX_scim_setup_module_query_changed + +static GtkWidget *widget = 0; + +// Module Interface. +extern "C" { + void scim_module_init (void) + { + } + + void scim_module_exit (void) + { + } + + GtkWidget *scim_setup_module_create_ui (void) + { + if (! widget) + { + widget = mim_config_new (NULL, NULL); + gtk_widget_show_all (widget); + } + return widget; + } + + String scim_setup_module_get_category (void) + { + return String ("IMEngine"); + } + + String scim_setup_module_get_name (void) + { + return String (_("M17N Lib")); + } + + String scim_setup_module_get_description (void) + { + return String (_("An IMEngine Module for m17n-lib input methods.")); + } + + void scim_setup_module_load_config (const ConfigPointer &config) + { + mim_config_revert (widget); + } + + void scim_setup_module_save_config (const ConfigPointer &config) + { + mim_config_save (widget); + } + + bool scim_setup_module_query_changed () + { + return mim_config_modified (widget); + } +} // extern "C" -- 1.7.10.4