示例#1
0
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;
}
示例#2
0
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();
}
示例#3
0
文件: registry.c 项目: lpoijk/ibus
static void
bus_registry_load_in_dir (BusRegistry *registry,
                          const gchar *dirname)
{
    g_assert (BUS_IS_REGISTRY (registry));
    g_assert (dirname);

    GError *error = NULL;
    GDir *dir;
    const gchar *filename;

    dir = g_dir_open (dirname, 0, &error);

    if (dir == NULL) {
        g_warning ("Unable open directory %s : %s", dirname, error->message);
        g_error_free (error);
        return;
    }

    while ((filename = g_dir_read_name (dir)) != NULL) {
        glong size;
        gchar *path;
        IBusComponent *component;

        size = g_utf8_strlen (filename, -1);
        if (g_strcmp0 (MAX (filename, filename + size -4), ".xml" ) != 0)
            continue;

        path = g_build_filename (dirname, filename, NULL);
        component = ibus_component_new_from_file (path);
        if (component != NULL) {
            g_object_ref_sink (component);
            registry->components = g_list_append (registry->components, component);
        }

        g_free (path);
    }

    g_dir_close (dir);
}