static void ibus_hangul_engine_property_activate (IBusEngine *engine, const gchar *prop_name, guint prop_state) { if (strcmp(prop_name, "setup") == 0) { GError *error = NULL; gchar *argv[2] = { NULL, }; argv[0] = "ibus-setup-hangul"; argv[1] = NULL; g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error); } else if (strcmp(prop_name, "hanja_mode") == 0) { IBusHangulEngine *hangul = (IBusHangulEngine *) engine; hangul->hanja_mode = !hangul->hanja_mode; if (hangul->hanja_mode) { ibus_property_set_state (hangul->prop_hanja_mode, PROP_STATE_CHECKED); } else { ibus_property_set_state (hangul->prop_hanja_mode, PROP_STATE_UNCHECKED); } ibus_engine_update_property (engine, hangul->prop_hanja_mode); ibus_hangul_engine_flush (hangul); } }
IBusProperty * ibus_property_new (const gchar *key, IBusPropType type, IBusText *label, const gchar *icon, IBusText *tooltip, gboolean sensitive, gboolean visible, IBusPropState state, IBusPropList *prop_list) { g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (type >= PROP_TYPE_NORMAL && type <= PROP_TYPE_SEPARATOR, NULL); IBusProperty *prop; prop = (IBusProperty *)g_object_new (IBUS_TYPE_PROPERTY, NULL); prop->key = g_strdup (key); prop->type = type; ibus_property_set_label (prop, label); ibus_property_set_icon (prop, icon); ibus_property_set_tooltip (prop, tooltip); ibus_property_set_sensitive (prop, sensitive); ibus_property_set_visible (prop, visible); ibus_property_set_state (prop, state); ibus_property_set_sub_props (prop, prop_list); return prop; }
void ibus_chewing_engine_property_activate(IBusEngine *engine, const gchar *prop_name, guint prop_state){ IBUS_CHEWING_LOG(3,"[I3] property_activate(-, %s, %u)", prop_name, prop_state); Self *self=SELF(engine); gboolean needRefresh=TRUE; if (strcmp(prop_name,"chewing_chieng_prop")==0){ /* Toggle Chinese <-> English */ chewing_set_ChiEngMode(self->context, !chewing_get_ChiEngMode(self->context)); }else if (strcmp(prop_name,"chewing_alnumSize_prop")==0){ /* Toggle Full <-> Half */ chewing_set_ShapeMode(self->context, !chewing_get_ShapeMode(self->context)); }else if (strcmp(prop_name,"chewing_settings_prop")==0){ #if IBUS_CHECK_VERSION(1, 4, 0) if (ibus_property_get_state(self->settings_prop)==PROP_STATE_UNCHECKED) #else if (self->settings_prop->state==PROP_STATE_UNCHECKED) #endif { if (gtk_dialog_run(GTK_DIALOG(self->setting_dialog))==GTK_RESPONSE_OK){ self_save_config_all(self); } gtk_widget_hide(self->setting_dialog); #if IBUS_CHECK_VERSION(1, 4, 0) ibus_property_set_state(self->settings_prop,PROP_STATE_UNCHECKED); #else self->settings_prop->state=PROP_STATE_UNCHECKED; #endif } }else{ IBUS_CHEWING_LOG(3,"[I3] property_activate(-, %s, %u) not recognized",prop_name, prop_state); needRefresh=FALSE; } if (needRefresh) self_refresh_property(self,prop_name); }
void SunPinyinProperty::init(bool state) { m_state = state; int which = m_state ? 1 : 0; PropertyInfo& info = m_info[which]; ibus_property_set_label(*this, info.label); ibus_property_set_icon(*this, info.icon.c_str()); ibus_property_set_tooltip(*this, info.tooltip); ibus_property_set_visible(*this, TRUE); ibus_property_set_state(*this, state ? PROP_STATE_CHECKED : PROP_STATE_UNCHECKED); }
static void ibus_hangul_engine_focus_in (IBusEngine *engine) { IBusHangulEngine *hangul = (IBusHangulEngine *) engine; if (hangul->hanja_mode) { ibus_property_set_state (hangul->prop_hanja_mode, PROP_STATE_CHECKED); } else { ibus_property_set_state (hangul->prop_hanja_mode, PROP_STATE_UNCHECKED); } ibus_engine_register_properties (engine, hangul->prop_list); ibus_hangul_engine_update_preedit_text (hangul); if (hangul->hanja_list != NULL) { ibus_hangul_engine_update_lookup_table_ui (hangul); } parent_class->focus_in (engine); }
static void ibus_unikey_engine_property_activate(IBusEngine* engine, const gchar* prop_name, guint prop_state) { IBusProperty* prop; IBusText* label; guint i, j; unikey = (IBusUnikeyEngine*)engine; // input method active if (strncmp(prop_name, CONFIG_INPUTMETHOD, strlen(CONFIG_INPUTMETHOD)) == 0) { for (i=0; i<NUM_INPUTMETHOD; i++) { if (strcmp(prop_name + strlen(CONFIG_INPUTMETHOD)+1, Unikey_IMNames[i]) == 0) { unikey->im = Unikey_IM[i]; // update label for (j=0; j<unikey->prop_list->properties->len; j++) { prop = ibus_prop_list_get(unikey->prop_list, j); if (prop==NULL) return; else if (strcmp(ibus_property_get_key(prop), CONFIG_INPUTMETHOD) == 0) { label = ibus_text_new_from_static_string(Unikey_IMNames[i]); ibus_property_set_label(prop, label); break; } } // end update label // update property state for (j=0; j<unikey->menu_im->properties->len; j++) { prop = ibus_prop_list_get(unikey->menu_im, j); if (prop==NULL) return; else if (strcmp(ibus_property_get_key(prop), prop_name)==0) ibus_property_set_state(prop, PROP_STATE_CHECKED); else ibus_property_set_state(prop, PROP_STATE_UNCHECKED); } // end update property state break; } } } // end input method active // output charset active else if (strncmp(prop_name, CONFIG_OUTPUTCHARSET, strlen(CONFIG_OUTPUTCHARSET)) == 0) { for (i=0; i<NUM_OUTPUTCHARSET; i++) { if (strcmp(prop_name+strlen(CONFIG_OUTPUTCHARSET)+1, Unikey_OCNames[i]) == 0) { unikey->oc = Unikey_OC[i]; // update label for (j=0; j<unikey->prop_list->properties->len; j++) { prop = ibus_prop_list_get(unikey->prop_list, j); if (prop==NULL) return; else if (strcmp(ibus_property_get_key(prop), CONFIG_OUTPUTCHARSET)==0) { label = ibus_text_new_from_static_string(Unikey_OCNames[i]); ibus_property_set_label(prop, label); break; } } // end update label // update property state for (j=0; j<unikey->menu_oc->properties->len; j++) { prop = ibus_prop_list_get(unikey->menu_oc, j); if (prop==NULL) return; else if (strcmp(ibus_property_get_key(prop), prop_name) == 0) ibus_property_set_state(prop, PROP_STATE_CHECKED); else ibus_property_set_state(prop, PROP_STATE_UNCHECKED); } // end update property state break; } } } // end output charset active // spellcheck active else if (strcmp(prop_name, CONFIG_SPELLCHECK) == 0) { unikey->ukopt.spellCheckEnabled = !unikey->ukopt.spellCheckEnabled; // update state for (j = 0; j < unikey->menu_opt->properties->len ; j++) { prop = ibus_prop_list_get(unikey->menu_opt, j); if (prop == NULL) return; else if (strcmp(ibus_property_get_key(prop), CONFIG_SPELLCHECK) == 0) { ibus_property_set_state(prop, (unikey->ukopt.spellCheckEnabled == 1)? PROP_STATE_CHECKED:PROP_STATE_UNCHECKED); break; } } // end update state } // end spellcheck active // MacroEnabled active else if (strcmp(prop_name, CONFIG_MACROENABLED) == 0) { unikey->ukopt.macroEnabled = !unikey->ukopt.macroEnabled; // update state for (j = 0; j < unikey->menu_opt->properties->len ; j++) { prop = ibus_prop_list_get(unikey->menu_opt, j); if (prop == NULL) return; else if (strcmp(ibus_property_get_key(prop), CONFIG_MACROENABLED) == 0) { ibus_property_set_state(prop, (unikey->ukopt.macroEnabled == 1)? PROP_STATE_CHECKED:PROP_STATE_UNCHECKED); break; } } // end update state } // end MacroEnabled active // MouseCapture active else if (strcmp(prop_name, CONFIG_MOUSECAPTURE) == 0) { unikey->mouse_capture = !unikey->mouse_capture; // update state for (j = 0; j < unikey->menu_opt->properties->len ; j++) { prop = ibus_prop_list_get(unikey->menu_opt, j); if (prop == NULL) return; else if (strcmp(ibus_property_get_key(prop), CONFIG_MOUSECAPTURE) == 0) { ibus_property_set_state(prop, (unikey->mouse_capture == 1)? PROP_STATE_CHECKED:PROP_STATE_UNCHECKED); break; } } // end update state } // end MouseCapture active // if Run setup else if (strcmp(prop_name, "RunSetupGUI") == 0) { system(LIBEXECDIR "/ibus-setup-unikey &"); } // END Run setup ibus_unikey_engine_reset(engine); UnikeySetInputMethod(unikey->im); UnikeySetOutputCharset(unikey->oc); UnikeySetOptions(&unikey->ukopt); }