New file.
authorhanda <handa>
Sun, 27 Jul 2008 02:19:59 +0000 (02:19 +0000)
committerhanda <handa>
Sun, 27 Jul 2008 02:19:59 +0000 (02:19 +0000)
src/scim_m17n_setup.cpp [new file with mode: 0644]

diff --git a/src/scim_m17n_setup.cpp b/src/scim_m17n_setup.cpp
new file mode 100644 (file)
index 0000000..d24103b
--- /dev/null
@@ -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 <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <gtk/gtk.h>
+#define Uses_SCIM_CONFIG_BASE
+#include <scim.h>
+#include <m17n-im-config.h>
+
+#if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS)
+  #include <libintl.h>
+  #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"