1 /* vim:set et sts=4: */
2 /* ibus-hangul - The Hangul Engine For IBus
3 * Copyright (C) 2008-2009 Peng Huang <shawn.p.huang@gmail.com>
4 * Copyright (C) 2009-2011 Choe Hwanjin <choe.hwanjin@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program 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
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 static IBusBus *bus = NULL;
35 static IBusFactory *factory = NULL;
38 static gboolean ibus = FALSE;
39 static gboolean verbose = FALSE;
41 static const GOptionEntry entries[] =
43 { "ibus", 'i', 0, G_OPTION_ARG_NONE, &ibus, "component is executed by ibus", NULL },
44 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "verbose", NULL },
50 ibus_disconnected_cb (IBusBus *bus,
53 g_debug ("bus disconnected");
59 start_component (void)
61 IBusComponent *component;
65 bus = ibus_bus_new ();
66 g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL);
68 ibus_hangul_init (bus);
70 component = ibus_component_new ("org.freedesktop.IBus.Hangul",
71 N_("Korean input method"),
74 "Peng Huang <shawn.p.huang@gmail.com>",
75 "http://code.google.com/p/ibus/",
78 ibus_component_add_engine (component,
79 ibus_engine_desc_new ("hangul",
80 N_("Korean Input Method"),
81 N_("Korean Input Method"),
84 "Peng Huang <shawn.p.huang@gmail.com>",
85 PKGDATADIR"/icon/ibus-hangul.svg",
88 factory = ibus_factory_new (ibus_bus_get_connection (bus));
90 ibus_factory_add_engine (factory, "hangul", IBUS_TYPE_HANGUL_ENGINE);
93 ibus_bus_request_name (bus, "org.freedesktop.IBus.Hangul", 0);
96 ibus_bus_register_component (bus, component);
99 g_object_unref (component);
107 main (gint argc, gchar **argv)
109 GError *error = NULL;
110 GOptionContext *context;
112 setlocale (LC_ALL, "");
114 bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
115 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
116 textdomain(GETTEXT_PACKAGE);
118 context = g_option_context_new ("- ibus hangul engine component");
120 g_option_context_add_main_entries (context, entries, "ibus-hangul");
122 if (!g_option_context_parse (context, &argc, &argv, &error)) {
123 g_print ("Option parsing failed: %s\n", error->message);