*** empty log message ***
[m17n/m17n-im-config.git] / src / scim-m17n-setup.cpp
1 /* scim-m17n-setup.cpp - SCIM Setup Module of m17n imengine module
2    Copyright (C) 2008
3      National Institute of Advanced Industrial Science and Technology (AIST)
4      Registration Number H15PRO112
5
6    This file is part of the m17n-im-config package; a sub-part of the
7    m17n library.
8
9    The m17n library is free software; you can redistribute it and/or
10    modify it under the terms of the GNU Lesser General Public License
11    as published by the Free Software Foundation; either version 2.1 of
12    the License, or (at your option) any later version.
13
14    The m17n library is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    Lesser General Public License for more details.
18
19    You should have received a copy of the GNU Lesser General Public
20    License along with the m17n library; if not, write to the Free
21    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22    02111-1307, USA.  */
23
24 #include <dirent.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #include <errno.h>
29 #include <gtk/gtk.h>
30 #define Uses_SCIM_CONFIG_BASE
31 #include <scim.h>
32 #include <m17n-im-config.h>
33
34 #if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS)
35   #include <libintl.h>
36   #define _(String) dgettext(GETTEXT_PACKAGE,String)
37   #define N_(String) (String)
38 #else
39   #define _(String) (String)
40   #define N_(String) (String)
41   #define bindtextdomain(Package,Directory)
42   #define textdomain(domain)
43   #define bind_textdomain_codeset(domain,codeset)
44 #endif
45
46 using namespace scim;
47
48 #define scim_module_init m17n_imengine_setup_LTX_scim_module_init
49 #define scim_module_exit m17n_imengine_setup_LTX_scim_module_exit
50
51 #define scim_setup_module_create_ui       m17n_imengine_setup_LTX_scim_setup_module_create_ui
52 #define scim_setup_module_get_category    m17n_imengine_setup_LTX_scim_setup_module_get_category
53 #define scim_setup_module_get_name        m17n_imengine_setup_LTX_scim_setup_module_get_name
54 #define scim_setup_module_get_description m17n_imengine_setup_LTX_scim_setup_module_get_description
55 #define scim_setup_module_load_config     m17n_imengine_setup_LTX_scim_setup_module_load_config
56 #define scim_setup_module_save_config     m17n_imengine_setup_LTX_scim_setup_module_save_config
57 #define scim_setup_module_query_changed   m17n_imengine_setup_LTX_scim_setup_module_query_changed
58
59 static GtkWidget *widget = 0;
60
61 // Module Interface.
62 extern "C" {
63     void scim_module_init (void)
64     {
65     }
66
67     void scim_module_exit (void)
68     {
69     }
70
71     GtkWidget *scim_setup_module_create_ui (void)
72     {
73       if (! widget)
74         {
75           widget = mim_config_new (NULL, NULL);
76           gtk_widget_show_all (widget);
77         }
78       return widget;
79     }
80
81     String scim_setup_module_get_category (void)
82     {
83         return String ("IMEngine");
84     }
85
86     String scim_setup_module_get_name (void)
87     {
88         return String (_("M17N Lib"));
89     }
90
91     String scim_setup_module_get_description (void)
92     {
93         return String (_("An IMEngine Module for m17n-lib input methods."));
94     }
95
96     void scim_setup_module_load_config (const ConfigPointer &config)
97     {
98         mim_config_revert (widget);
99     }
100
101     void scim_setup_module_save_config (const ConfigPointer &config)
102     {
103         mim_config_save (widget);
104     }
105
106     bool scim_setup_module_query_changed ()
107     {
108         return mim_config_modified (widget);
109     }
110 } // extern "C"