Esempio n. 1
0
void
bus_panel_proxy_focus_out (BusPanelProxy    *panel,
                           BusInputContext  *context)
{
    g_assert (BUS_IS_PANEL_PROXY (panel));
    g_assert (BUS_IS_INPUT_CONTEXT (context));

    g_assert (panel->focused_context == context);

    /* uninstall signal handlers */
    gint i;
    for (i = 0; i < G_N_ELEMENTS (__signals); i++) {
        g_signal_handlers_disconnect_by_func (context,
                                              __signals[i].callback,
                                              panel);
    }

    const gchar *path = ibus_service_get_path ((IBusService *)context);

    ibus_proxy_call ((IBusProxy *) panel,
                     "FocusOut",
                     IBUS_TYPE_OBJECT_PATH, &path,
                     G_TYPE_INVALID);

    g_object_unref (panel->focused_context);
    panel->focused_context = NULL;
}
Esempio n. 2
0
void
bus_panel_proxy_focus_in (BusPanelProxy     *panel,
                          BusInputContext   *context)
{
    g_assert (BUS_IS_PANEL_PROXY (panel));
    g_assert (BUS_IS_INPUT_CONTEXT (context));

    if (panel->focused_context == context)
        return;

    if (panel->focused_context != NULL)
        bus_panel_proxy_focus_out (panel, panel->focused_context);

    g_object_ref_sink (context);
    panel->focused_context = context;

    const gchar *path = ibus_service_get_path ((IBusService *)context);

    ibus_proxy_call ((IBusProxy *) panel,
                     "FocusIn",
                     IBUS_TYPE_OBJECT_PATH, &path,
                     G_TYPE_INVALID);

    /* install signal handlers */
    gint i;
    for (i = 0; i < G_N_ELEMENTS (__signals); i++) {
        g_signal_connect (context,
                          __signals[i].name,
                          __signals[i].callback,
                          panel);
    }
}
Esempio n. 3
0
gboolean
bus_dbus_impl_unregister_object (BusDBusImpl *dbus,
                                 IBusService *object)
{
    g_assert (BUS_IS_DBUS_IMPL (dbus));
    g_assert (IBUS_IS_SERVICE (object));

    const gchar *path;
    
    if (G_UNLIKELY (IBUS_OBJECT_DESTROYED (dbus))) {
        return FALSE;
    }

    path = ibus_service_get_path (object);
    g_return_val_if_fail (path, FALSE);

    g_return_val_if_fail  (g_hash_table_lookup (dbus->objects, path) == object, FALSE);

    g_signal_handlers_disconnect_by_func (object, G_CALLBACK (_object_destroy_cb), dbus);

    g_hash_table_remove (dbus->objects, path);
    g_object_unref (object);

    return TRUE;
}
Esempio n. 4
0
gboolean
bus_dbus_impl_register_object (BusDBusImpl *dbus,
                               IBusService *object)
{
    g_assert (BUS_IS_DBUS_IMPL (dbus));
    g_assert (IBUS_IS_SERVICE (object));

    const gchar *path;
    
    if (G_UNLIKELY (IBUS_OBJECT_DESTROYED (dbus))) {
        return FALSE;
    }

    path = ibus_service_get_path (object);

    g_return_val_if_fail (path, FALSE);

    g_return_val_if_fail  (g_hash_table_lookup (dbus->objects, path) == NULL, FALSE);

    g_object_ref (object);
    g_hash_table_insert (dbus->objects, (gpointer)path, object);

    g_signal_connect (object, "destroy", G_CALLBACK (_object_destroy_cb), dbus);

    return TRUE;
}
Esempio n. 5
0
static void
_send_signal (IBusEngine  *engine,
              const gchar *name,
              GType        first_arg_type,
              ...)
{
    g_assert (IBUS_IS_ENGINE (engine));
    g_assert (name != NULL);

    va_list args;
    const gchar *path;
    IBusEnginePrivate *priv;

    priv = IBUS_ENGINE_GET_PRIVATE (engine);

    path = ibus_service_get_path ((IBusService *)engine);

    va_start (args, first_arg_type);
    ibus_connection_send_signal_valist (priv->connection,
                                        path,
                                        IBUS_INTERFACE_ENGINE,
                                        name,
                                        first_arg_type,
                                        args);
    va_end (args);
}
Esempio n. 6
0
static void
ibus_service_get_property (IBusService *service,
    guint prop_id, GValue *value, GParamSpec *pspec)
{
    switch (prop_id) {
    case PROP_PATH:
        g_value_set_string (value, ibus_service_get_path (service));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (service, prop_id, pspec);
    }
}