コード例 #1
0
ファイル: registry.c プロジェクト: lpoijk/ibus
static void
bus_registry_destroy (BusRegistry *registry)
{
#ifdef G_THREADS_ENABLED
    if (registry->thread) {
        g_mutex_lock (registry->mutex);
        registry->thread_running = FALSE;
        g_mutex_unlock (registry->mutex);
        g_cond_signal (registry->cond);
        g_thread_join (registry->thread);
        registry->thread = NULL;
    }
#endif

    bus_registry_remove_all (registry);

    g_hash_table_destroy (registry->engine_table);
    registry->engine_table = NULL;

#ifdef G_THREADS_ENABLED
    g_cond_free (registry->cond);
    registry->cond = NULL;

    g_mutex_free (registry->mutex);
    registry->mutex = NULL;
#endif

    IBUS_OBJECT_CLASS (bus_registry_parent_class)->destroy (IBUS_OBJECT (registry));
}
コード例 #2
0
static void
ibus_lanxang_engine_destroy (IBusLanXangEngine *lanxang_engine)
{
  g_object_unref (lanxang_engine->lx_iengine);
  IBUS_OBJECT_CLASS (ibus_lanxang_engine_parent_class)->destroy (
                      IBUS_OBJECT (lanxang_engine));
}
コード例 #3
0
ファイル: ibusfactory.c プロジェクト: iwaim/ibus
static void
ibus_factory_destroy (IBusFactory *factory)
{
    GList *list;
    IBusFactoryPrivate *priv;
    priv = IBUS_FACTORY_GET_PRIVATE (factory);

    list = g_list_copy (priv->engine_list);
    g_list_foreach (list, (GFunc) ibus_object_destroy, NULL);
    g_list_free (priv->engine_list);
    g_list_free (list);
    priv->engine_list = NULL;

    if (priv->engine_table) {
        g_hash_table_destroy (priv->engine_table);
    }

    if (priv->connection) {
        ibus_service_remove_from_connection ((IBusService *)factory,
                                             priv->connection);
        g_object_unref (priv->connection);
    }

    IBUS_OBJECT_CLASS(factory_parent_class)->destroy (IBUS_OBJECT (factory));
}
コード例 #4
0
ファイル: engineproxy.c プロジェクト: XueWei/ibus
static void
bus_engine_proxy_real_destroy (BusEngineProxy *engine)
{
    if (engine->prop_list) {
        g_object_unref (engine->prop_list);
        engine->prop_list = NULL;
    }

    if (ibus_proxy_get_connection ((IBusProxy *) engine)) {
        ibus_proxy_call ((IBusProxy *) engine,
                         "Destroy",
                         G_TYPE_INVALID);
    }

    if (engine->desc) {
        g_object_unref (engine->desc);
        engine->desc = NULL;
    }

    if (engine->keymap) {
        g_object_unref (engine->keymap);
        engine->keymap = NULL;
    }

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (engine));
}
コード例 #5
0
ファイル: ibusconnection.c プロジェクト: XueWei/ibus
static void
ibus_connection_destroy (IBusConnection *connection)
{
    IBusConnectionPrivate *priv;
    priv = IBUS_CONNECTION_GET_PRIVATE (connection);

    if (priv->connection) {
        dbus_connection_remove_filter (priv->connection,
                                       (DBusHandleMessageFunction) _connection_handle_message_cb,
                                       connection);
    }

    if (!priv->shared && priv->connection) {
        dbus_connection_close (priv->connection);
        dbus_connection_unref (priv->connection);
        priv->connection = NULL;
        goto _out;
    }

    if (priv->shared && priv->connection) {
        g_warn_if_fail (_connections != NULL);
        if (_connections != NULL) {
            g_hash_table_remove (_connections, priv->connection);
        }
        dbus_connection_unref (priv->connection);
        priv->connection = NULL;
        goto _out;
    }
_out:
    parent_class->destroy (IBUS_OBJECT (connection));
}
コード例 #6
0
void
ibus_sunpinyin_engine_destroy(IBusEngine *py_engine)
{
    
    delete GET_PY_ENGINE(py_engine);
    GET_PY_ENGINE(py_engine) = NULL;
    IBUS_OBJECT_CLASS (parent_class)->destroy( IBUS_OBJECT(py_engine));
}
コード例 #7
0
ファイル: ibusserializable.c プロジェクト: iwaim/ibus
static void
ibus_serializable_destroy (IBusSerializable *object)
{
    IBusSerializablePrivate *priv;
    priv = IBUS_SERIALIZABLE_GET_PRIVATE (object);

    g_datalist_clear (&priv->attachments);

    parent_class->destroy (IBUS_OBJECT (object));
}
コード例 #8
0
ファイル: ibusconfig.c プロジェクト: colorant/ibus
static void
ibus_config_real_destroy (IBusConfig *config)
{
    if (ibus_proxy_get_connection ((IBusProxy *) config) != NULL) {
        ibus_proxy_call ((IBusProxy *) config,
                         "Destroy",
                         G_TYPE_INVALID);
    }

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (config));
}
コード例 #9
0
ファイル: ibusserver.c プロジェクト: definite/ibus
static void
ibus_server_destroy (IBusServer *server)
{
    IBusServerPrivate *priv;
    priv = IBUS_SERVER_GET_PRIVATE (server);

    if (priv->server) {
        dbus_server_unref (priv->server);
        priv->server = NULL;
    }

    IBUS_OBJECT_CLASS(ibus_server_parent_class)->destroy (IBUS_OBJECT (server));
}
コード例 #10
0
ファイル: ibusservice.c プロジェクト: colorant/ibus
static void
ibus_service_destroy (IBusService *service)
{
    IBusServicePrivate *priv;
    priv = IBUS_SERVICE_GET_PRIVATE (service);

    ibus_service_remove_from_all_connections (service);

    g_free (priv->path);
    priv->path = NULL;

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (service));
}
コード例 #11
0
ファイル: ibusenginedesc.c プロジェクト: luoxsbupt/ibus
static void
ibus_engine_desc_destroy (IBusEngineDesc *desc)
{
    g_free (desc->name);
    g_free (desc->longname);
    g_free (desc->description);
    g_free (desc->language);
    g_free (desc->license);
    g_free (desc->author);
    g_free (desc->icon);
    g_free (desc->layout);

    IBUS_OBJECT_CLASS (parent_class)->destroy (IBUS_OBJECT (desc));
}
コード例 #12
0
ファイル: ibusinputcontext.c プロジェクト: BBIO/ibus
static void
ibus_input_context_real_destroy (IBusInputContext *context)
{
    IBusInputContextPrivate *priv;
    priv = IBUS_INPUT_CONTEXT_GET_PRIVATE (context);

    if (priv->own && ibus_proxy_get_connection ((IBusProxy *) context) != NULL) {
        ibus_proxy_call (IBUS_PROXY (context),
                         "Destroy",
                         G_TYPE_INVALID);
    }

    IBUS_OBJECT_CLASS(ibus_input_context_parent_class)->destroy (IBUS_OBJECT (context));
}
コード例 #13
0
ファイル: ibusengine.c プロジェクト: definite/ibus
static void
ibus_engine_destroy (IBusEngine *engine)
{
    IBusEnginePrivate *priv;
    priv = IBUS_ENGINE_GET_PRIVATE (engine);

    g_free (priv->name);

    if (priv->connection) {
        g_object_unref (priv->connection);
        priv->connection = NULL;
    }

    IBUS_OBJECT_CLASS(ibus_engine_parent_class)->destroy (IBUS_OBJECT (engine));
}
コード例 #14
0
ファイル: panelproxy.c プロジェクト: hychen/ibus
static void
bus_panel_proxy_real_destroy (BusPanelProxy *panel)
{
    if (ibus_proxy_get_connection ((IBusProxy *)panel) != NULL) {
        ibus_proxy_call ((IBusProxy *) panel,
                         "Destroy",
                         G_TYPE_INVALID);
    }

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

    IBUS_OBJECT_CLASS(bus_panel_proxy_parent_class)->destroy (IBUS_OBJECT (panel));
}
コード例 #15
0
ファイル: server.c プロジェクト: hychen/ibus
static void
bus_server_destroy (BusServer *server)
{
    g_assert (BUS_IS_SERVER (server));

    ibus_object_destroy ((IBusObject *) server->dbus);
    g_object_unref (server->dbus);
    ibus_object_destroy ((IBusObject *) server->ibus);
    g_object_unref (server->ibus);

    while (g_main_loop_is_running (server->loop)) {
        g_main_loop_quit (server->loop);
    }
    g_main_loop_unref (server->loop);

    IBUS_OBJECT_CLASS (bus_server_parent_class)->destroy (IBUS_OBJECT (server));
}
コード例 #16
0
ファイル: panelproxy.c プロジェクト: iwaim/ibus
static void
bus_panel_proxy_real_destroy (BusPanelProxy *panel)
{
    BusPanelProxyPrivate *priv;
    priv = BUS_PANEL_PROXY_GET_PRIVATE (panel);

    if (ibus_proxy_get_connection ((IBusProxy *)panel) != NULL) {
        ibus_proxy_call ((IBusProxy *) panel,
                         "Destroy",
                         G_TYPE_INVALID);
    }

    if (priv->focused_context) {
        bus_panel_proxy_focus_out (panel, priv->focused_context);
        priv->focused_context = NULL;
    }

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (panel));
}
コード例 #17
0
ファイル: connection.c プロジェクト: iwaim/ibus
static void
bus_connection_destroy (BusConnection *connection)
{
    GList *name;
    BusConnectionPrivate *priv;

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (connection));

    priv = BUS_CONNECTION_GET_PRIVATE (connection);

    if (priv->unique_name) {
        g_free (priv->unique_name);
        priv->unique_name = NULL;
    }

    for (name = priv->names; name != NULL; name = name->next) {
        g_free (name->data);
    }
    g_list_free (priv->names);
    priv->names = NULL;
}
コード例 #18
0
ファイル: factoryproxy.c プロジェクト: luoxsbupt/ibus
static void
bus_factory_proxy_destroy (BusFactoryProxy *factory)
{
    GList *p;

    for (p = factory->engine_list; p != NULL ; p = p->next) {
        IBusEngineDesc *desc = (IBusEngineDesc *)p->data;
        g_object_steal_data ((GObject *)desc, "factory");
        g_object_unref (desc);
    }
    g_list_free (factory->engine_list);
    factory->engine_list = NULL;

    if (factory->component) {
        g_object_steal_data ((GObject *)factory->component, "factory");
        g_object_unref (factory->component);
        factory->component = NULL;
    }

    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (factory));
}
コード例 #19
0
ファイル: ibusproxy.c プロジェクト: BBIO/ibus
gboolean
ibus_proxy_handle_signal (IBusProxy     *proxy,
                          DBusMessage   *message)
{
    g_assert (IBUS_IS_PROXY (proxy));
    g_assert (message != NULL);

    gboolean retval = FALSE;
    IBusProxyPrivate *priv;
    priv = IBUS_PROXY_GET_PRIVATE (proxy);

    if (ibus_message_is_signal (message, DBUS_SERVICE_DBUS, "NameOwnerChanged")) {
        gchar *name, *old_name, *new_name;
        IBusError *error;

        if (!ibus_message_get_args (message,
                                    &error,
                                    G_TYPE_STRING, &name,
                                    G_TYPE_STRING, &old_name,
                                    G_TYPE_STRING, &new_name,
                                    G_TYPE_INVALID)) {
            g_warning ("%s :%s", error->name, error->message);
            ibus_error_free (error);
        }

        if (g_strcmp0 (priv->unique_name, old_name) == 0) {
            ibus_object_destroy (IBUS_OBJECT (proxy));
            return FALSE;
        }
    }

    if (g_strcmp0 (ibus_message_get_path (message), priv->path) == 0) {
        g_signal_emit (proxy, proxy_signals[IBUS_SIGNAL], 0, message, &retval);
    }

    return retval;
}
コード例 #20
0
ファイル: ibusobject.c プロジェクト: BBIO/ibus
/**
 * ibus_object_new:
 *
 * Creates a new instance of an #IBusObject.
 *
 * Returns: a new instance of #IBusObject.
 */
IBusObject *
ibus_object_new (void)
{
    return IBUS_OBJECT (g_object_new (IBUS_TYPE_OBJECT, NULL));
}
コード例 #21
0
ファイル: ibusproxy.c プロジェクト: BBIO/ibus
static void
ibus_proxy_destroy (IBusProxy *proxy)
{
    IBusProxyPrivate *priv;
    priv = IBUS_PROXY_GET_PRIVATE (proxy);

    if (priv->connection) {

        g_signal_handlers_disconnect_by_func (priv->connection,
                                              (GCallback) _connection_ibus_signal_cb,
                                              proxy);
        g_signal_handlers_disconnect_by_func (priv->connection,
                                              (GCallback) _connection_destroy_cb,
                                              proxy);

        if (priv->name != NULL) {

            IBusError *error;
            gchar *rule;

            rule = g_strdup_printf ("type='signal',"
                                    "sender='"      DBUS_SERVICE_DBUS   "',"
                                    "path='"        DBUS_PATH_DBUS      "',"
                                    "interface='"   DBUS_INTERFACE_DBUS "',"
                                    "member='NameOwnerChanged',"
                                    "arg0='%s'",
                                    priv->unique_name);

            if (!ibus_connection_call (priv->connection,
                                       DBUS_SERVICE_DBUS,
                                       DBUS_PATH_DBUS,
                                       DBUS_INTERFACE_DBUS,
                                       "RemoveMatch",
                                       &error,
                                       G_TYPE_STRING, &rule,
                                       G_TYPE_INVALID,
                                       G_TYPE_INVALID)) {

                g_warning ("%s: %s", error->name, error->message);
                ibus_error_free (error);
            }
            g_free (rule);

            rule =  g_strdup_printf ("type='signal',"
                                     "sender='%s',"
                                     "path='%s'",
                                     priv->unique_name,
                                     priv->path);

            if (!ibus_connection_call (priv->connection,
                                       DBUS_SERVICE_DBUS,
                                       DBUS_PATH_DBUS,
                                       DBUS_INTERFACE_DBUS,
                                       "RemoveMatch",
                                       &error,
                                       G_TYPE_STRING, &rule,
                                       G_TYPE_INVALID,
                                       G_TYPE_INVALID)) {

                g_warning ("%s: %s", error->name, error->message);
                ibus_error_free (error);
            }
            g_free (rule);

        }
    }

    g_free (priv->name);
    g_free (priv->unique_name);
    g_free (priv->path);
    g_free (priv->interface);

    priv->name = NULL;
    priv->path = NULL;
    priv->interface = NULL;

    if (priv->connection) {
        g_object_unref (priv->connection);
        priv->connection = NULL;
    }

    IBUS_OBJECT_CLASS(ibus_proxy_parent_class)->destroy (IBUS_OBJECT (proxy));
}
コード例 #22
0
ファイル: ibusobservedpath.c プロジェクト: iwaim/ibus
static void
ibus_observed_path_destroy (IBusObservedPath *path)
{
    g_free (path->path);
    IBUS_OBJECT_CLASS (parent_class)->destroy (IBUS_OBJECT (path));
}
コード例 #23
0
ファイル: ibuspanelservice.c プロジェクト: BBIO/ibus
static void
ibus_panel_service_real_destroy (IBusPanelService *panel)
{
    IBUS_OBJECT_CLASS(ibus_panel_service_parent_class)->destroy (IBUS_OBJECT (panel));
}
コード例 #24
0
ファイル: ibusconnection.c プロジェクト: XueWei/ibus
static void
ibus_connection_disconnected (IBusConnection         *connection)
{
    ibus_object_destroy (IBUS_OBJECT (connection));
}