| OLD | NEW |
| 1 /* vim:set et sts=4: */ | 1 /* vim:set et sts=4: */ |
| 2 /* | 2 /* |
| 3 * Copyright © 2009 Red Hat, Inc. All rights reserved. | 3 * Copyright © 2009 Red Hat, Inc. All rights reserved. |
| 4 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com> | 4 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com> |
| 5 * | 5 * |
| 6 * This file is part of the ibus-chewing Project. | 6 * This file is part of the ibus-chewing Project. |
| 7 * | 7 * |
| 8 * This program is free software; you can redistribute it and/or | 8 * This program is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU General Public License | 9 * modify it under the terms of the GNU General Public License |
| 10 * as published by the Free Software Foundation; either version 2 | 10 * as published by the Free Software Foundation; either version 2 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 gpointer user_data) | 52 gpointer user_data) |
| 53 { | 53 { |
| 54 g_debug ("bus disconnected"); | 54 g_debug ("bus disconnected"); |
| 55 ibus_quit (); | 55 ibus_quit (); |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 static void | 59 static void |
| 60 start_component (void) | 60 start_component (void) |
| 61 { | 61 { |
| 62 ibus_init(); |
| 62 bus = ibus_bus_new (); | 63 bus = ibus_bus_new (); |
| 63 g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NU
LL); | 64 g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NU
LL); |
| 64 iConfig = ibus_bus_get_config (bus); | 65 iConfig = ibus_bus_get_config (bus); |
| 65 if (iConfig) | 66 if (iConfig) |
| 66 g_object_ref_sink (iConfig); | 67 g_object_ref_sink (iConfig); |
| 67 | 68 |
| 68 IBusConnection *iConnection=ibus_bus_get_connection (bus); | 69 factory = ibus_factory_new (ibus_bus_get_connection (bus)); |
| 69 factory = ibus_factory_new (iConnection); | |
| 70 ibus_factory_add_engine (factory, "chewing", IBUS_TYPE_CHEWING_ENGINE); | 70 ibus_factory_add_engine (factory, "chewing", IBUS_TYPE_CHEWING_ENGINE); |
| 71 | 71 |
| 72 if (ibus) { | 72 if (ibus) { |
| 73 ibus_bus_request_name (bus, "org.freedesktop.IBus.Chewing", 0); | 73 ibus_bus_request_name (bus, "org.freedesktop.IBus.Chewing", 0); |
| 74 }else { | 74 }else { |
| 75 IBusComponent *component; | 75 IBusComponent *component; |
| 76 // component = ibus_component_new_from_file ( DATADIR "/ibus/component/ch
ewing.xml"); | 76 // component = ibus_component_new_from_file ( DATADIR "/ibus/component/ch
ewing.xml"); |
| 77 component=ibus_component_new("org.freedesktop.IBus.Chewing", | 77 component=ibus_component_new("org.freedesktop.IBus.Chewing", |
| 78 _("Chewing component"), PKGDATADIR, "GPLv2+", | 78 _("Chewing component"), PKGDATADIR, "GPLv2+", |
| 79 _("Peng Huang, Ding-Yi Chen"), | 79 _("Peng Huang, Ding-Yi Chen"), |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 if (!g_option_context_parse (context, &argc, &argv, &error)) { | 149 if (!g_option_context_parse (context, &argc, &argv, &error)) { |
| 150 g_print ("Option parsing failed: %s\n", error->message); | 150 g_print ("Option parsing failed: %s\n", error->message); |
| 151 exit (-1); | 151 exit (-1); |
| 152 } | 152 } |
| 153 | 153 |
| 154 g_option_context_free (context); | 154 g_option_context_free (context); |
| 155 start_component (); | 155 start_component (); |
| 156 return 0; | 156 return 0; |
| 157 } | 157 } |
| OLD | NEW |