Permalink
Browse files

add case width and language settings to init status tab for completen…

…ess.
  • Loading branch information...
1 parent a9d38c0 commit 0acabc033a9b9d475df2260917126e65f88190b5 @picospuch picospuch committed Jan 9, 2013
View
66 wrapper/xim/data/settings_ui.xml
@@ -43,12 +43,6 @@
<property name="page_size">0.01</property>
<signal name="value-changed" handler="state_changed" swapped="no"/>
</object>
- <object class="GtkListStore" id="skin_list">
- <columns>
- <!-- column-name text -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkDialog" id="settings_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -874,6 +868,24 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -939,13 +951,12 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
- <object class="GtkRadioButton" id="punc_english">
+ <object class="GtkRadioButton" id="punc_english_radio">
<property name="label" translatable="yes">English</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
@@ -956,15 +967,14 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="punc_chinese">
+ <object class="GtkRadioButton" id="punc_chinese_radio">
<property name="label" translatable="yes">Chinese</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">punc_english</property>
+ <property name="group">punc_english_radio</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
<packing>
@@ -987,13 +997,12 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
- <object class="GtkRadioButton" id="case_full">
- <property name="label" translatable="yes">Full</property>
+ <object class="GtkRadioButton" id="half_width_radio">
+ <property name="label" translatable="yes">Half</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
@@ -1004,15 +1013,14 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="case_half">
- <property name="label" translatable="yes">Half</property>
+ <object class="GtkRadioButton" id="full_width_radio">
+ <property name="label" translatable="yes">Full</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">case_full</property>
+ <property name="group">half_width_radio</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
<packing>
@@ -1035,13 +1043,12 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
- <object class="GtkRadioButton" id="lang_english">
+ <object class="GtkRadioButton" id="lang_english_radio">
<property name="label" translatable="yes">English</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
@@ -1052,15 +1059,14 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="lang_chinese">
+ <object class="GtkRadioButton" id="lang_chinese_radio">
<property name="label" translatable="yes">Chinese</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">lang_english</property>
+ <property name="group">lang_english_radio</property>
<signal name="toggled" handler="state_changed" swapped="no"/>
</object>
<packing>
@@ -1083,6 +1089,12 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">3</property>
@@ -1092,7 +1104,7 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">InitStatus</property>
+ <property name="label" translatable="yes">Init Status</property>
</object>
<packing>
<property name="position">3</property>
@@ -1138,4 +1150,10 @@ requires restart or relogin to take effect,&lt;/i&gt;</property>
</row>
</data>
</object>
+ <object class="GtkListStore" id="skin_list">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
</interface>
View
4 wrapper/xim/data/xim_config_default
@@ -5,3 +5,7 @@ preedit_opacity=1.00
preedit_color=#FFFFB3
preedit_font=Sans 10
preedit_font_color=#000000
+init_punc_type=0
+init_width=1
+init_language=0
+
View
2 wrapper/xim/ic.c
@@ -144,6 +144,8 @@ __reset_ic(IC* ic)
memset(ic, 0, sizeof(IC));
ic->icid = id;
ic->is_chn_punc = !((bool) settings_get_int(INIT_PUNC_TYPE));
+ ic->is_full = !((bool) settings_get_int(INIT_WIDTH));
+ ic->is_english = (bool) settings_get_int(INIT_LANGUAGE);
}
void
View
35 wrapper/xim/preferences.c
@@ -73,8 +73,12 @@ static GtkToggleButton* shuangpin_check = NULL;
static GtkComboBox* shuangpin_combo = NULL;
static GtkComboBox* skin_combo = NULL;
static GtkToggleButton* hide_icbar_check = NULL;
-static GtkToggleButton* punc_english = NULL;
-static GtkToggleButton* punc_chinese = NULL;
+static GtkToggleButton* punc_english_radio = NULL;
+static GtkToggleButton* punc_chinese_radio = NULL;
+static GtkToggleButton* half_width_radio = NULL;
+static GtkToggleButton* full_width_radio = NULL;
+static GtkToggleButton* lang_english_radio = NULL;
+static GtkToggleButton* lang_chinese_radio = NULL;
#define RETRIEVE(name, macro) \
name = macro(gtk_builder_get_object(builder, # name))
@@ -242,6 +246,17 @@ init_settings(void)
}
}
+ /* 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);
@@ -251,8 +266,6 @@ init_settings(void)
gtk_toggle_button_set_active(hide_icbar_check,
settings_get_int(HIDE_ICBAR));
- settings_get_int(INIT_PUNC_TYPE)?gtk_toggle_button_set_active(punc_english, TRUE):
- gtk_toggle_button_set_active(punc_chinese, TRUE);
}
static void
@@ -284,8 +297,12 @@ init(void)
RETRIEVE(shuangpin_combo, GTK_COMBO_BOX);
RETRIEVE(skin_combo, GTK_COMBO_BOX);
RETRIEVE(hide_icbar_check, GTK_TOGGLE_BUTTON);
- RETRIEVE(punc_english, GTK_TOGGLE_BUTTON);
- RETRIEVE(punc_chinese, GTK_TOGGLE_BUTTON);
+ RETRIEVE(punc_english_radio, GTK_TOGGLE_BUTTON);
+ RETRIEVE(punc_chinese_radio, GTK_TOGGLE_BUTTON);
+ RETRIEVE(half_width_radio, GTK_TOGGLE_BUTTON);
+ RETRIEVE(full_width_radio, GTK_TOGGLE_BUTTON);
+ RETRIEVE(lang_english_radio, GTK_TOGGLE_BUTTON);
+ RETRIEVE(lang_chinese_radio, GTK_TOGGLE_BUTTON);
init_settings();
@@ -385,8 +402,10 @@ state_changed()
/* whether hide icbar */
settings_set_int(HIDE_ICBAR, gtk_toggle_button_get_active(hide_icbar_check));
- /* init */
- settings_set_int(INIT_PUNC_TYPE, gtk_toggle_button_get_active(punc_english));
+ /* init status */
+ settings_set_int(INIT_PUNC_TYPE, gtk_toggle_button_get_active(punc_english_radio));
+ settings_set_int(INIT_WIDTH, gtk_toggle_button_get_active(half_width_radio));
+ settings_set_int(INIT_LANGUAGE, gtk_toggle_button_get_active(lang_english_radio));
settings_save();
send_reload();
View
8 wrapper/xim/settings.c
@@ -67,6 +67,8 @@ static const char* setting_names[] = {
"skin_name",
"hide_icbar",
"init_punc_type",
+ "init_width",
+ "init_language",
NULL
};
@@ -269,8 +271,10 @@ __init_default_values()
/* whether hide icbar */
settings_set_int(HIDE_ICBAR, 0);
- /* init punc type */
+ /* init status */
settings_set_int(INIT_PUNC_TYPE, 0);
+ settings_set_int(INIT_WIDTH, 1);
+ settings_set_int(INIT_LANGUAGE, 0);
}
#define REGISTER(k, type, efunc, dfunc) \
@@ -306,6 +310,8 @@ settings_init()
REGISTER(SKIN_NAME, varchar, __varchar_enc, __varchar_dec);
REGISTER(HIDE_ICBAR, int, __int_enc, __int_dec);
REGISTER(INIT_PUNC_TYPE, int, __int_enc, __int_dec);
+ REGISTER(INIT_WIDTH, int, __int_enc, __int_dec);
+ REGISTER(INIT_LANGUAGE, int, __int_enc, __int_dec);
__init_default_values();
}
View
4 wrapper/xim/settings.h
@@ -77,7 +77,9 @@ typedef enum {
SMART_PUNCT,
SKIN_NAME,
HIDE_ICBAR,
- INIT_PUNC_TYPE
+ INIT_PUNC_TYPE,
+ INIT_WIDTH,
+ INIT_LANGUAGE
} setting_key_t;
#define MAX_KEY 0xFF

0 comments on commit 0acabc0

Please sign in to comment.