Beispiel #1
0
static void
init_settings(void)
{
    settings_init();
    settings_load();
    
    hotkey_t hk;
    settings_get(TRIGGER_KEY, &hk);
    INIT_KEY_SETTING(trigger);

    settings_get(ENG_KEY, &hk);
    INIT_KEY_SETTING(english);

    varchar colorstr;
    settings_get(PREEDIT_COLOR, colorstr);
    INIT_COLOR_SETTING(background_color_btn);

    settings_get(PREEDIT_FONT_COLOR, colorstr);
    INIT_COLOR_SETTING(font_color_btn);

    varchar fontstr;
    settings_get(PREEDIT_FONT, fontstr);
    gtk_font_button_set_font_name(font_btn, fontstr);

    double scale;
    settings_get(PREEDIT_OPACITY, &scale);
    gtk_adjustment_set_value(opacity_value, scale);

    int ncandi;
    settings_get(CANDIDATES_SIZE, &ncandi);
    gtk_adjustment_set_value(ncandidates, ncandi);
}
Beispiel #2
0
static void
init_settings(void)
{
    settings_init();
    settings_load();

    hotkey_t hk;
    settings_get(TRIGGER_KEY, &hk);
    INIT_KEY_SETTING(trigger);

    settings_get(ENG_KEY, &hk);
    INIT_KEY_SETTING(english);

    varchar colorstr;
    settings_get(PREEDIT_COLOR, colorstr);
    INIT_COLOR_SETTING(background_color_btn);

    settings_get(PREEDIT_FONT_COLOR, colorstr);
    INIT_COLOR_SETTING(font_color_btn);

    varchar fontstr;
    settings_get(PREEDIT_FONT, fontstr);
    gtk_font_button_set_font_name(font_btn, fontstr);


    gtk_adjustment_set_value(opacity_value,
                             settings_get_double(PREEDIT_OPACITY));

    gtk_adjustment_set_value(ncandidates, settings_get_int(CANDIDATES_SIZE));

    gtk_toggle_button_set_active(minus_plus_check,
                                 settings_get_int(PAGE_MINUS_PLUS));
    gtk_toggle_button_set_active(comma_period_check,
                                 settings_get_int(PAGE_COMMA_PERIOD));
    gtk_toggle_button_set_active(paren_check,
                                 settings_get_int(PAGE_PAREN));

    gtk_toggle_button_set_active(fuzzy_seg_check,
                                 settings_get_int(FUZZY_SEGMENTATION));
    gtk_toggle_button_set_active(fuzzy_inner_seg_check,
                                 settings_get_int(FUZZY_INNER_SEGMENTATION));

    gtk_toggle_button_set_active(cancel_on_backspace_check,
                                 settings_get_int(CANCEL_ON_BACKSPACE));

    gtk_toggle_button_set_active(smart_punct_check,
                                 settings_get_int(SMART_PUNCT));

    gtk_toggle_button_set_active(shuangpin_check,
                                 settings_get_int(SHUANGPIN));
    varchar scheme;
    int i;
    settings_get(SHUANGPIN_SCHEME, scheme);
    for (i = 0; i < UI_SHUANGPIN_SCHEMES_NUM; i++) {
        if (strcmp(ui_shuangpin_schemes[i], scheme) == 0) {
            gtk_combo_box_set_active(shuangpin_combo, i);
            break;
        }
    }

    /* init status */
    settings_get_int(INIT_PUNC_TYPE)?
        gtk_toggle_button_set_active(punc_english_radio, TRUE):
        gtk_toggle_button_set_active(punc_chinese_radio, TRUE);
    settings_get_int(INIT_WIDTH)?
        gtk_toggle_button_set_active(half_width_radio, TRUE):
        gtk_toggle_button_set_active(full_width_radio, TRUE);
    settings_get_int(INIT_LANGUAGE)?
        gtk_toggle_button_set_active(lang_english_radio, TRUE):
        gtk_toggle_button_set_active(lang_chinese_radio, TRUE);

    /* skin */
    varchar skin_name;
    settings_get(SKIN_NAME, skin_name);
    int idx = list_skins(skin_name);
    gtk_combo_box_set_active(skin_combo, idx);

    gtk_toggle_button_set_active(hide_icbar_check,
                                 settings_get_int(HIDE_ICBAR));

}