static void selKeys_set_callback(PropertyContext *ctx, GValue *value){ #ifdef IBUS_CHEWING_MAIN IBusChewingEngine *engine=(IBusChewingEngine *) ctx->userData; ibus_chewing_engine_set_selKeys_string(engine,g_value_get_string(value)); if (!engine->table){ engine->table=g_object_ref_sink(ibus_lookup_table_new(strlen(g_value_get_string(value)),0,FALSE,TRUE)); } ibus_chewing_engine_set_lookup_table_label(engine,g_value_get_string(value)); #endif }
static void candPerPage_set_callback(PropertyContext *ctx, GValue *value){ #ifdef IBUS_CHEWING_MAIN IBusChewingEngine *engine=(IBusChewingEngine *) ctx->userData; chewing_set_candPerPage(engine->context,g_value_get_int(value)); if (engine->table){ ibus_lookup_table_clear(engine->table); engine->table->page_size=g_value_get_int(value); }else{ engine->table=g_object_ref_sink(ibus_lookup_table_new(g_value_get_int(value),0,FALSE,TRUE)); } #endif }
IBusLookupTable *ibus_chewing_lookup_table_new(IBusChewingProperties * iProperties, ChewingContext * context) { guint size = mkdg_properties_get_uint_by_key (iProperties->properties, "cand-per-page"); gboolean cursorShow = FALSE; gboolean wrapAround = TRUE; IBusLookupTable *iTable = ibus_lookup_table_new (size, 0, cursorShow, wrapAround); ibus_chewing_lookup_table_resize(iTable, iProperties, context); return g_object_ref_sink(iTable); }
static void ibus_hangul_engine_init (IBusHangulEngine *hangul) { IBusProperty* prop; IBusText* label; IBusText* tooltip; hangul->context = hangul_ic_new (hangul_keyboard->str); hangul_ic_connect_callback (hangul->context, "transition", ibus_hangul_engine_on_transition, hangul); hangul->preedit = ustring_new(); hangul->hanja_list = NULL; hangul->hangul_mode = TRUE; hangul->hanja_mode = FALSE; hangul->last_lookup_method = LOOKUP_METHOD_PREFIX; hangul->prop_list = ibus_prop_list_new (); g_object_ref_sink (hangul->prop_list); label = ibus_text_new_from_string (_("Hanja lock")); tooltip = ibus_text_new_from_string (_("Enable/Disable Hanja mode")); prop = ibus_property_new ("hanja_mode", PROP_TYPE_TOGGLE, label, NULL, tooltip, TRUE, TRUE, PROP_STATE_UNCHECKED, NULL); g_object_ref_sink (prop); ibus_prop_list_append (hangul->prop_list, prop); hangul->prop_hanja_mode = prop; label = ibus_text_new_from_string (_("Setup")); tooltip = ibus_text_new_from_string (_("Configure hangul engine")); prop = ibus_property_new ("setup", PROP_TYPE_NORMAL, label, "gtk-preferences", tooltip, TRUE, TRUE, PROP_STATE_UNCHECKED, NULL); ibus_prop_list_append (hangul->prop_list, prop); hangul->table = ibus_lookup_table_new (9, 0, TRUE, FALSE); g_object_ref_sink (hangul->table); g_signal_connect (config, "value-changed", G_CALLBACK(ibus_config_value_changed), hangul); }
static void ibus_m17n_engine_init (IBusM17NEngine *m17n) { IBusText* label; IBusText* tooltip; m17n->prop_list = ibus_prop_list_new (); g_object_ref_sink (m17n->prop_list); m17n->status_prop = ibus_property_new ("status", PROP_TYPE_NORMAL, NULL, NULL, NULL, TRUE, FALSE, 0, NULL); g_object_ref_sink (m17n->status_prop); ibus_prop_list_append (m17n->prop_list, m17n->status_prop); #ifdef HAVE_SETUP label = ibus_text_new_from_string ("Setup"); tooltip = ibus_text_new_from_string ("Configure M17N engine"); m17n->setup_prop = ibus_property_new ("setup", PROP_TYPE_NORMAL, label, "gtk-preferences", tooltip, TRUE, TRUE, PROP_STATE_UNCHECKED, NULL); g_object_ref_sink (m17n->setup_prop); ibus_prop_list_append (m17n->prop_list, m17n->setup_prop); #endif /* HAVE_SETUP */ m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE); g_object_ref_sink (m17n->table); m17n->context = NULL; }
void ibus_engine_update_lookup_table_fast (IBusEngine *engine, IBusLookupTable *table, gboolean visible) { IBusLookupTable *new_table; IBusText *text; gint page_begin; gint i; if (table->candidates->len < table->page_size << 2) { ibus_engine_update_lookup_table (engine, table, visible); return; } page_begin = (table->cursor_pos / table->page_size) * table->page_size; new_table = ibus_lookup_table_new (table->page_size, 0, table->cursor_visible, table->round); for (i = page_begin; i < page_begin + table->page_size && i < table->candidates->len; i++) { ibus_lookup_table_append_candidate (new_table, ibus_lookup_table_get_candidate (table, i)); } for (i = 0; (text = ibus_lookup_table_get_label (table, i)) != NULL; i++) { ibus_lookup_table_append_label (new_table, text); } ibus_lookup_table_set_cursor_pos (new_table, ibus_lookup_table_get_cursor_in_page (table)); ibus_lookup_table_set_orientation (new_table, ibus_lookup_table_get_orientation (table)); ibus_engine_update_lookup_table (engine, new_table, visible); if (g_object_is_floating (table)) { g_object_unref (table); } }