IBusComponent * ibus_libthai_get_component () { IBusComponent *component; component = ibus_component_new_from_file (LIBTHAI_XML); if (!component) { /* fallback to manually creation */ component = ibus_component_new ("org.freedesktop.IBus.LibThai", "LibThai Component", VERSION, "GPL", "Theppitak Karoonboonyanan <*****@*****.**>", "http://linux.thai.net/project/libthai", "", "ibus-libthai"); ibus_component_add_engine (component, ibus_engine_desc_new ("libthai", "LibThai", "LibThai-based input method", "th", "GPL", "Theppitak Karoonboonyanan <*****@*****.**>", PKGDATADIR"/icons/ibus-libthai.svg", "us,th")); } return component; }
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 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 (); }
IBusComponent* ibus_unikey_get_component() { IBusComponent* component; IBusEngineDesc* engine; component = ibus_component_new("org.freedesktop.IBus.Unikey", "Unikey", PACKAGE_VERSION, "GPLv3", "Lê Quốc Tuấn <*****@*****.**>", PACKAGE_BUGREPORT, "", PACKAGE_NAME); #if IBUS_CHECK_VERSION(1,3,99) engine = ibus_engine_desc_new_varargs ("name", "Unikey", "longname", "Unikey", "description", IU_DESC, "language", "vi", "license", "GPLv3", "author", "Lê Quốc Tuấn <*****@*****.**>", "icon", PKGDATADIR"/icons/ibus-unikey.png", "layout", "us", "rank", 99, "setup", LIBEXECDIR "/ibus-setup-unikey", NULL); #else engine = ibus_engine_desc_new ("Unikey", "Unikey", IU_DESC, "vi", "GPLv3", "Lê Quốc Tuấn <*****@*****.**>", PKGDATADIR"/icons/ibus-unikey.png", "us"); engine->rank = 99; #endif ibus_component_add_engine(component, engine); return component; }
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); }
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; }