Debian Codegraph @

src/gtk-im/imhime.c

raw
1 /*
2 * Copyright (C) 2020 The HIME team, Taiwan
3 * GTK - The GIMP Toolkit
4 * Copyright (C) 2000 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <string.h>
22
23 #include "gtkimcontexthime.h"
24 #include "gtkintl.h"
25
26 static const GtkIMContextInfo hime_info = {
27 "hime", /* unique identification string */
28 N_ ("hime Input Method"), /* human-readable name */
29 GETTEXT_PACKAGE, /* Translation domain to be used with dgettext() */
30 GTK_LOCALEDIR, /* Name of locale directory for use with bindtextdomain() */
31 "zh:ja" /* A colon-separated list of locales where this input method should
32 be the default. */
33 };
34
35 static const GtkIMContextInfo *info_list[] = {
36 &hime_info};
37
38 void im_module_init (GTypeModule *type_module) {
39 gtk_im_context_hime_register_type (type_module);
40 }
41
42 void im_module_exit (void) {
43 gtk_im_context_hime_shutdown ();
44 }
45
46 void im_module_list (const GtkIMContextInfo ***contexts,
47 int *n_contexts) {
48 *contexts = info_list;
49 *n_contexts = G_N_ELEMENTS (info_list);
50 }
51
52 GtkIMContext *im_module_create (const gchar *context_id) {
53 if (strcmp (context_id, "hime") == 0) {
54 return gtk_im_context_hime_new ();
55 }
56
57 return NULL;
58 }