]> Pileus Git - ~andy/gtk/blob - modules/input/imxim.c
Bug 99192 - Add --with-include-input-modules
[~andy/gtk] / modules / input / imxim.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <config.h>
21 #include "gtk/gtkintl.h"
22 #include "gtk/gtkimmodule.h"
23 #include "gtkimcontextxim.h"
24 #include <string.h>
25
26 static const GtkIMContextInfo xim_ja_info = { 
27   "xim",                           /* ID */
28   N_("X Input Method"),            /* Human readable name */
29   GETTEXT_PACKAGE,                 /* Translation domain */
30   GTK_LOCALEDIR,                   /* Dir for bindtextdomain (not strictly needed for "gtk+") */
31   "ko:ja:th:zh"                    /* Languages for which this module is the default */
32 };
33
34 static const GtkIMContextInfo *info_list[] = {
35   &xim_ja_info
36 };
37
38 #ifndef INCLUDE_IM_xim
39 #define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
40 #else
41 #define MODULE_ENTRY(function) _gtk_immodule_xim_ ## function
42 #endif
43
44 void
45 MODULE_ENTRY (init) (GTypeModule *type_module)
46 {
47   gtk_im_context_xim_register_type (type_module);
48 }
49
50 void 
51 MODULE_ENTRY (exit) (void)
52 {
53   gtk_im_context_xim_shutdown ();
54 }
55
56 void 
57 MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
58                      int                      *n_contexts)
59 {
60   *contexts = info_list;
61   *n_contexts = G_N_ELEMENTS (info_list);
62 }
63
64 GtkIMContext *
65 MODULE_ENTRY (create) (const gchar *context_id)
66 {
67   if (strcmp (context_id, "xim") == 0)
68     return gtk_im_context_xim_new ();
69   else
70     return NULL;
71 }