static void start_component (void) { GList *engines, *p; IBusComponent *component; ibus_init (); bus = ibus_bus_new (); g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); component = ibus_xkb_get_component (); factory = ibus_factory_new (ibus_bus_get_connection (bus)); engines = ibus_component_get_engines (component); for (p = engines; p != NULL; p = p->next) { IBusEngineDesc *engine = (IBusEngineDesc *)p->data; ibus_factory_add_engine (factory, engine->name, IBUS_TYPE_XKB_LAYOUT_ENGINE); } if (ibus) { ibus_bus_request_name (bus, "org.freedesktop.IBus.XKBLayouts", 0); } else { ibus_bus_register_component (bus, component); } g_object_unref (component); ibus_main (); }
static gboolean init (void) { ibus_init (); bus = ibus_bus_new (); g_object_ref_sink (bus); g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); ibus_libthai_init (bus); factory = ibus_factory_new (ibus_bus_get_connection (bus)); g_object_ref_sink (factory); ibus_factory_add_engine (factory, "libthai", IBUS_TYPE_LIBTHAI_ENGINE); if (opt_ibus) { ibus_bus_request_name (bus, "org.freedesktop.IBus.LibThai", 0); } else { IBusComponent *component; component = ibus_libthai_get_component (); if (!component) { g_print ("Cannot create LibThai component.\n"); return FALSE; } ibus_bus_register_component (bus, component); } return TRUE; }
static void init_outside(const char * iconfile, const char *exefile) { IBusComponent *component; IBusEngineDesc * desc; ibus_init(); bus = ibus_bus_new(); g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); factory = ibus_factory_new(ibus_bus_get_connection(bus)); ibus_bus_request_name(bus, "org.freedesktop.IBus.handwrite", 0); desc = ibus_engine_desc_new("handwrite", "handwrite", _("hand write recognizer"), "zh_CN", "GPL", MICROCAI_WITHEMAIL, iconfile, "us"); component = ibus_component_new("org.freedesktop.IBus.handwrite", "handwrite", PACKAGE_VERSION, "GPL", MICROCAI_WITHEMAIL, PACKAGE_BUGREPORT, exefile, GETTEXT_PACKAGE); ibus_component_add_engine(component, desc); ibus_bus_register_component(bus, component); ibus_factory_add_engine(factory, "handwrite", IBUS_TYPE_HANDWRITE_ENGINE); g_object_unref(component); }
static void start_component(void) { IBUS_CHEWING_LOG(INFO, "start_component"); ibus_init(); bus = ibus_bus_new(); g_signal_connect(bus, "disconnected", G_CALLBACK(ibus_disconnected_cb), NULL); factory = ibus_factory_new(ibus_bus_get_connection(bus)); ibus_factory_add_engine(factory, "chewing", IBUS_TYPE_CHEWING_ENGINE); if (ibus) { ibus_bus_request_name(bus, QUOTE_ME(PROJECT_SCHEMA_ID), 0); } else { IBusComponent *component = NULL; if (xml) { component = ibus_component_new_from_file(QUOTE_ME(DATA_DIR) "/ibus/component/chewing.xml"); } else { component = ibus_component_new(QUOTE_ME(PROJECT_SCHEMA_ID), _("Chewing component"), QUOTE_ME(PRJ_VER), "GPLv2+", _("Peng Huang, Ding-Yi Chen"), "http://code.google.com/p/ibus", QUOTE_ME(LIBEXEC_DIR) "/ibus-engine-chewing --ibus", QUOTE_ME(PROJECT_NAME)); } IBusEngineDesc *engineDesc = ibus_engine_desc_new_varargs("name", "chewing", "longname", _("Chewing"), "description", _("Chinese chewing input method"), "language", "zh_TW", "license", "GPLv2+", "author", _("Peng Huang, Ding-Yi Chen"), "icon", QUOTE_ME(PRJ_DATA_DIR) "/icons/" QUOTE_ME(PROJECT_NAME) ".png", "layout", "us", "setup", QUOTE_ME(LIBEXEC_DIR) "/ibus-setup-chewing", "version", QUOTE_ME(PRJ_VER), "textdomain", QUOTE_ME(PROJECT_NAME), NULL); ibus_component_add_engine(component, engineDesc); ibus_bus_register_component(bus, component); } ibus_main(); }
static void rime_with_ibus() { ibus_init(); IBusBus *bus = ibus_bus_new(); g_object_ref_sink(bus); if (!ibus_bus_is_connected(bus)) { g_warning("not connected to ibus"); exit(0); } g_signal_connect(bus, "disconnected", G_CALLBACK(ibus_disconnect_cb), NULL); IBusConfig *config = ibus_bus_get_config(bus); if (!config) { g_warning("ibus config not accessible"); } else { g_object_ref_sink(config); ibus_rime_load_settings(config); g_signal_connect(config, "value-changed", G_CALLBACK(ibus_rime_config_value_changed_cb), NULL); } IBusFactory *factory = ibus_factory_new(ibus_bus_get_connection(bus)); g_object_ref_sink(factory); ibus_factory_add_engine(factory, "rime", IBUS_TYPE_RIME_ENGINE); if (!ibus_bus_request_name(bus, "com.googlecode.rimeime.Rime", 0)) { g_error("error requesting bus name"); exit(1); } if (!notify_init("ibus-rime")) { g_error("notify_init failed"); exit(1); } RimeSetupLogging("rime.ibus"); gboolean full_check = FALSE; ibus_rime_start(full_check); ibus_main(); RimeFinalize(); notify_uninit(); if (config) { g_object_unref(config); } g_object_unref(factory); g_object_unref(bus); }
static void init () { ibus_init (); bus = ibus_bus_new (); g_object_ref_sink(bus); if (!ibus_bus_is_connected (bus)) { g_warning("Can not connect to ibus"); exit (0); } g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); IBusConfig* config = ibus_bus_get_config(bus); g_object_ref_sink(config); SunPinyinConfig::set_config(config); component = ibus_component_new ("org.freedesktop.IBus.SunPinyin", "SunPinyin2", "0.1.0", "LGPL/CDDL", "Kov Chai <*****@*****.**>", "http://code.google.com/p/sunpinyin/", "", "ibus-sunpinyin"); ibus_component_add_engine (component, ibus_engine_desc_new ("sunpinyin", "SunPinyin", _("Simplified Chinese Input Method developed by SUN"), "zh_CN", "LGPL/CDDL", "Kov Chai <*****@*****.**>", IBUS_SUNPINYIN_ICON_DIR"/sunpinyin-logo.png", "en")); factory = ibus_factory_new (ibus_bus_get_connection (bus)); ibus_factory_add_engine (factory, "sunpinyin", IBUS_TYPE_SUNPINYIN_ENGINE); if (by_ibus) { ibus_bus_request_name (bus, "org.freedesktop.IBus.SunPinyin", 0); } else { ibus_bus_register_component (bus, component); } ibus_main (); }
static void init (void) { IBusComponent *component; ibus_init (); bus = ibus_bus_new (); g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); ibus_array_init(bus); component = ibus_component_new ("org.freedesktop.IBus.Array", "Array 30 Input Method", "0.0.1", "GPL", "Yu-Chun Wang <*****@*****.**>", "http://code.google.com/p/ibus/", "", "ibus-array"); ibus_component_add_engine (component, ibus_engine_desc_new ("array", "Array 30 Input Method", "Array 30 Input Method", "zh_TW", "GPL", "Yu-Chun Wang <*****@*****.**>", PKGDATADIR"/icon/ibus-array.png", "us")); factory = ibus_factory_new (ibus_bus_get_connection (bus)); ibus_factory_add_engine (factory, "array", IBUS_TYPE_ARRAY_ENGINE); if (ibus) { ibus_bus_request_name (bus, "org.freedesktop.IBus.Array", 0); } else { ibus_bus_register_component (bus, component); } g_object_unref (component); }
static void init_inside() { IBusComponent *component; ibus_init(); bus = ibus_bus_new(); g_signal_connect (bus, "disconnected", G_CALLBACK (ibus_disconnected_cb), NULL); factory = ibus_factory_new(ibus_bus_get_connection(bus)); ibus_bus_request_name(bus, "org.freedesktop.IBus.handwrite", 0); component = ibus_component_new("org.freedesktop.IBus.handwrite", "handwrite", PACKAGE_VERSION, "GPL", MICROCAI_WITHEMAIL, PACKAGE_BUGREPORT, PKGDATADIR, GETTEXT_PACKAGE); ibus_bus_register_component(bus, component); ibus_factory_add_engine(factory, "handwrite", IBUS_TYPE_HANDWRITE_ENGINE); g_object_unref(component); }
static void start_component (void) { GList* engines; GList* p; IBusComponent* component; ibus_init (); UnikeySetup (); bus = ibus_bus_new (); g_signal_connect (bus, "disconnected", G_CALLBACK(ibus_disconnected_cb), NULL); component = ibus_unikey_get_component (); factory = ibus_factory_new (ibus_bus_get_connection (bus)); engines = ibus_component_get_engines (component); for (p = engines; p != NULL; p = p->next) { IBusEngineDesc* engine = (IBusEngineDesc*)p->data; #if IBUS_CHECK_VERSION(1,3,99) ibus_factory_add_engine (factory, ibus_engine_desc_get_name(engine), IBUS_TYPE_UNIKEY_ENGINE); #else ibus_factory_add_engine (factory, engine->name, IBUS_TYPE_UNIKEY_ENGINE); #endif } if (ibus) ibus_bus_request_name (bus, "org.freedesktop.IBus.Unikey", 0); else ibus_bus_register_component (bus, component); g_object_unref (component); ibus_unikey_init (bus); ibus_main (); ibus_unikey_exit (); }
int main(int argc, char* argv[]) { IBusComponent *component; IBusEngineDesc * desc; GError * err = NULL; gboolean have_ibus=FALSE; const gchar * language="zh"; const gchar * icon_dir = NULL; const gchar * locale_dir = NULL; setlocale(LC_ALL, ""); gtk_set_locale(); textdomain(GETTEXT_PACKAGE); GOptionEntry args[] = { {"ibus",'\0',0,G_OPTION_ARG_NONE,&have_ibus}, {"icondir",'\0',0,G_OPTION_ARG_STRING,&icon_dir,_("the icon file"),N_("icon file")}, {"table",'\0',0,G_OPTION_ARG_STRING,&tablefile,_("set table file path"),N_("tablefile")}, {"locale",'\0',0,G_OPTION_ARG_STRING,&locale_dir,_("set locale path"),N_("locale")}, #ifdef WITH_ZINNIA {"lang",'\0',0,G_OPTION_ARG_STRING,&language,_("set languate, accept zh and jp"),N_("lang")}, #endif {0} }; gtk_init_with_args(&argc,&argv,PACKAGE_NAME,args,PACKAGE_NAME,&err); if(G_UNLIKELY(!gtk_gl_init_check(&argc, &argv))) { g_warning("GLX extension not available, use slow soft cairo rendering instead"); } #ifdef WITH_ZINNIA if(strcmp(language,"zh")==0 ||strcmp(language,"zh_CN") ==0 ) { }else if( strcmp(language,"jp") ==0 || strcmp(language,"ja")==0 ) { g_strlcpy(lang,"ja",20); }else { g_error("pass jp or zh to --lang!"); } #endif if(locale_dir) { bindtextdomain(GETTEXT_PACKAGE,locale_dir); } gchar * engine_name = g_strdup_printf("handwrite-%s",lang); gchar * dbus_name = g_strdup_printf("org.freedesktop.IBus.handwrite-%s",lang); ibus_init(); if(icon_dir) realpath(icon_dir, icondir); bus = ibus_bus_new(); g_signal_connect (bus, "disconnected", G_CALLBACK (gtk_main_quit), NULL); factory = ibus_factory_new(ibus_bus_get_connection(bus)); ibus_bus_request_name(bus, dbus_name, 0); // g_free(dbus_name); if (!have_ibus) { char * exefile ; exefile = realpath(argv[0],NULL); component = ibus_component_new(dbus_name, "handwrite", PACKAGE_VERSION, "GPL", MICROCAI_WITHEMAIL, PACKAGE_BUGREPORT, exefile, GETTEXT_PACKAGE); gchar * iconfile = g_strdup_printf("%s/ibus-handwrite.svg",icondir); desc = ibus_engine_desc_new(engine_name, "handwrite", _("hand write recognizer"), lang, "GPL", MICROCAI_WITHEMAIL, iconfile, "us"); ibus_component_add_engine(component, desc); free(exefile); g_free(iconfile); }else { component = ibus_component_new(dbus_name, "handwrite", PACKAGE_VERSION, "GPL", MICROCAI_WITHEMAIL, PACKAGE_BUGREPORT, PKGDATADIR, GETTEXT_PACKAGE); } g_free(dbus_name); ibus_bus_register_component(bus, component); ibus_factory_add_engine(factory, engine_name, IBUS_TYPE_HANDWRITE_ENGINE); g_free(engine_name); g_object_unref(component); GdkScreen * screen = gdk_screen_get_default(); GdkColormap * map = gdk_screen_get_rgba_colormap(screen); if(map) gtk_widget_set_default_colormap(map); printf(_("ibus-handwrite Version %s Start Up\n"), PACKAGE_VERSION); gtk_main(); return 0; }