void fcitx_im_dialog_dispose(GObject* object) { FcitxImDialog* self = FCITX_IM_DIALOG(object); if (self->array) { g_ptr_array_set_free_func(self->array, (GDestroyNotify) fcitx_im_item_free); g_ptr_array_free(self->array, FALSE); self->array = NULL; } if (self->improxy) { g_signal_handlers_disconnect_by_func(self->improxy, G_CALLBACK(_fcitx_im_dialog_imlist_changed_cb), self); g_object_unref(self->improxy); self->improxy = NULL; } if (self->langset) { g_hash_table_destroy(self->langset); self->langset = NULL; } if (self->language) { g_free(self->language); self->language = NULL; } G_OBJECT_CLASS (fcitx_im_dialog_parent_class)->dispose (object); }
void fcitx_im_dialog_finalize(GObject* object) { FcitxImDialog* self = FCITX_IM_DIALOG(object); if (self->array) { g_ptr_array_set_free_func(self->array, fcitx_im_item_free); g_ptr_array_free(self->array, FALSE); self->array = NULL; } if (self->improxy) g_object_unref(self->improxy); G_OBJECT_CLASS (fcitx_im_dialog_parent_class)->finalize (object); }
void _fcitx_im_dialog_response_cb(GtkDialog *dialog, gint response, gpointer user_data) { FcitxImDialog* self = FCITX_IM_DIALOG(dialog); if (response == GTK_RESPONSE_OK) { GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self->availimview)); add_foreach_context context; context.self = self; context.changed = FALSE; gtk_tree_selection_selected_foreach(selection, add_foreach, &context); if (context.changed) fcitx_input_method_set_imlist(self->improxy, self->array); } gtk_widget_destroy(GTK_WIDGET(dialog)); }
static GObject * fcitx_im_dialog_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties) { GObject *obj; FcitxImDialog *self; GtkWidget *widget; obj = G_OBJECT_CLASS (fcitx_im_dialog_parent_class)->constructor (gtype, n_properties, properties); self = FCITX_IM_DIALOG (obj); widget = GTK_WIDGET(gtk_builder_get_object (self->builder, "im_dialog")); GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(self)); gtk_container_add (GTK_CONTAINER (content_area), widget); _fcitx_im_dialog_connect(self); return obj; }