static void fcitx_im_context_finalize(GObject *obj) { FcitxLog(LOG_LEVEL, "fcitx_im_context_finalize"); FcitxIMContext *context = FCITX_IM_CONTEXT(obj); FcitxIMClientClose(context->client); context->client = NULL; if (context->preedit_string) g_free(context->preedit_string); context->preedit_string = NULL; }
int main() { if (get_im_socket() == -1) return 1; GIOChannel *iochannel_fbterm = g_io_channel_unix_new(get_im_socket()); g_io_add_watch(iochannel_fbterm, (GIOCondition)(G_IO_IN | G_IO_HUP | G_IO_ERR), (GIOFunc)iochannel_fbterm_callback, NULL); g_type_init(); client = FcitxIMClientOpen(_fcitx_fbterm_connect_cb, _fcitx_fbterm_destroy_cb, NULL); register_im_callbacks(cbs); connect_fbterm(1); main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(main_loop); FcitxIMClientClose(client); g_io_channel_unref(iochannel_fbterm); g_main_loop_unref(main_loop); return 0; }