Esempio n. 1
0
int main()
{
    g_type_init ();

    GMainLoop *mainloop;
    IBusConnection *connection;
    IBusService *service;

    mainloop = g_main_loop_new (NULL, FALSE);
    connection = ibus_connection_open ("unix:path=/tmp/ibus-phuang/ibus--0.0");
    service = IBUS_SERVICE (ibus_engine_new ("/a/Engine", connection));
    g_main_loop_run (mainloop);
    return 0;
}
Esempio n. 2
0
static void
ibus_bus_connect (IBusBus *bus)
{
    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

    /* destry old connection at first */
    if (priv->connection != NULL) {
        ibus_object_destroy ((IBusObject *)priv->connection);
        g_assert (priv->connection == NULL);
    }

    if (ibus_get_address () != NULL) {
        priv->connection = ibus_connection_open (ibus_get_address ());
    }

    if (priv->connection) {
        ibus_bus_hello (bus);

        g_signal_connect (priv->connection,
                          "destroy",
                          (GCallback) _connection_destroy_cb,
                          bus);
        g_signal_emit (bus, bus_signals[CONNECTED], 0);

        if (priv->watch_dbus_signal) {
            ibus_bus_watch_dbus_signal (bus);
        }

        /** Watch ibus signals. */
        const gchar *rule =
            "type='signal',"
            "path='" IBUS_PATH_IBUS "',"
            "interface='" IBUS_INTERFACE_IBUS "'";

        ibus_bus_add_match (bus, rule);
        g_signal_connect (priv->connection,
                          "ibus-signal",
                          (GCallback) _connection_ibus_signal_cb,
                          bus);
    }
}
Esempio n. 3
0
File: ibusbus.c Progetto: BBIO/ibus
static void
ibus_bus_connect (IBusBus *bus)
{
    IBusBusPrivate *priv;
    priv = IBUS_BUS_GET_PRIVATE (bus);

#if 0
    socket_path = ibus_get_socket_path ();

    if (stat (socket_path, &buf) != 0) {
        g_warning ("Can not get stat from %s!", socket_path);
        return;
    }
    if (buf.st_uid != ibus_get_daemon_uid ()) {
        g_warning ("The owner of %s is not %s!", socket_path, ibus_get_user_name ());
        return;
    }

    if (priv->connection != NULL) {
        ibus_object_destroy ((IBusObject *) priv->connection);
    }
#endif
    if (ibus_get_address () != NULL) {
        priv->connection = ibus_connection_open (ibus_get_address ());
    }

    if (priv->connection) {
        ibus_bus_hello (bus);
        g_signal_connect (priv->connection,
                          "destroy",
                          (GCallback) _connection_destroy_cb,
                          bus);
        g_signal_emit (bus, bus_signals[CONNECTED], 0);

        if (priv->watch_dbus_signal) {
            ibus_bus_watch_dbus_signal (bus);
        }
    }
}