Skip to content

Commit

Permalink
Merge pull request #217 from chewing/default-english-mode
Browse files Browse the repository at this point in the history
feat: Add an option to start ibus-chewing in English mode
  • Loading branch information
kanru authored Jul 22, 2024
2 parents 3bb5fb5 + 731389c commit 66f2019
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 99 deletions.
76 changes: 42 additions & 34 deletions po/ibus-chewing.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-21 08:44+0900\n"
"POT-Creation-Date: 2024-07-22 17:50+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -195,94 +195,102 @@ msgid "Until how many characters should trigger auto-commit"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:159
msgid "Default Use Alphanumeric Mode"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:160
msgid "Automatically switch to alphanumeric mode after startup."
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:165
msgid "Chinese/Alphanumeric Mode Toggle Key"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:163
#: src/setup/ibus-setup-chewing-window.ui:169
msgid "Disable"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:164
#: src/setup/ibus-setup-chewing-window.ui:170
msgid "Caps Lock"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:165
#: src/setup/ibus-setup-chewing-window.ui:171
msgid "Shift"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:166
#: src/setup/ibus-setup-chewing-window.ui:172
msgid "Shift_L"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:167
#: src/setup/ibus-setup-chewing-window.ui:173
msgid "Shift_R"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:179
#: src/setup/ibus-setup-chewing-window.ui:185
msgid "Disable Syncing"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:180
#: src/setup/ibus-setup-chewing-window.ui:186
msgid "Sync with Keyboard State"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:185
#: src/setup/ibus-setup-chewing-window.ui:191
msgid "Sync Caps Lock and IM"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:193
#: src/setup/ibus-setup-chewing-window.ui:199
msgid "No Default"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:194
#: src/setup/ibus-setup-chewing-window.ui:200
msgid "Lower Case"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:195
#: src/setup/ibus-setup-chewing-window.ui:201
msgid "Upper Case"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:199
#: src/setup/ibus-setup-chewing-window.ui:205
msgid "Default English Letter Case"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:200
#: src/setup/ibus-setup-chewing-window.ui:206
msgid "The letter case without pressing the Shift key"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:207
#: src/setup/ibus-setup-chewing-window.ui:213
msgid "Selecting"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:208
#: src/setup/ibus-setup-chewing-window.ui:214
msgid "Configure the candidate selection behavior"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:219
#: src/setup/ibus-setup-chewing-window.ui:225
msgid "Candidates Per Page"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:225
#: src/setup/ibus-setup-chewing-window.ui:231
msgid "Show Page Number"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:231
#: src/setup/ibus-setup-chewing-window.ui:237
msgid "Choose Phrases Backwards"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:232
#: src/setup/ibus-setup-chewing-window.ui:238
msgid "Open candidate list from the last character of a phrase"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:238
#: src/setup/ibus-setup-chewing-window.ui:244
msgid "Use Space Key as Selection Key"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:244
#: src/setup/ibus-setup-chewing-window.ui:250
msgid "Use Vertical Candidate Panel"
msgstr ""

#: src/setup/ibus-setup-chewing-window.ui:245
#: src/setup/ibus-setup-chewing-window.ui:251
msgid "Choose from vertical or horizontal panel"
msgstr ""

Expand All @@ -298,46 +306,46 @@ msgstr ""
msgid "_Chat"
msgstr ""

#: src/ibus-chewing-engine.c:291
#: src/ibus-chewing-engine.c:411
msgid "Switch to Alphanumeric Mode"
msgstr ""

#: src/ibus-chewing-engine.c:293
#: src/ibus-chewing-engine.c:413
msgid "Switch to Chinese Mode"
msgstr ""

#: src/ibus-chewing-engine.c:296
#: src/ibus-chewing-engine.c:415
msgid "Click to toggle Chinese/Alphanumeric Mode"
msgstr ""

#: src/ibus-chewing-engine.c:302
#: src/ibus-chewing-engine.c:419
msgid "Fullwidth Form"
msgstr ""

#: src/ibus-chewing-engine.c:304
#: src/ibus-chewing-engine.c:421
msgid "Halfwidth Form"
msgstr ""

#: src/ibus-chewing-engine.c:307
#: src/ibus-chewing-engine.c:423
msgid "Click to toggle Halfwidth/Fullwidth Form"
msgstr ""

#: src/ibus-chewing-engine.c:313
#: src/ibus-chewing-engine.c:427
msgid "IBus-Chewing Preferences"
msgstr ""

#: src/ibus-chewing-engine.c:315
#: src/ibus-chewing-engine.c:429
msgid "Click to configure IBus-Chewing"
msgstr ""

#: src/main.c:69
#: src/main.c:63
msgid "Cannot connect to IBus!"
msgstr ""

#: src/main.c:96
#: src/main.c:89
msgid "Chewing"
msgstr ""

#: src/main.c:97
#: src/main.c:90
msgid "Chinese chewing input method"
msgstr ""
1 change: 1 addition & 0 deletions src/ibus-chewing-engine-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct _IBusChewingEngine {
gboolean prop_enable_fullwidth_toggle_key;
int prop_max_chi_symbol_len;
char *prop_default_english_case;
gboolean prop_default_use_english_mode;
char *prop_chi_eng_mode_toggle;
gboolean prop_phrase_choice_from_last;
gboolean prop_space_as_selection;
Expand Down
13 changes: 13 additions & 0 deletions src/ibus-chewing-engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ typedef enum {
PROP_ENABLE_FULLWIDTH_TOGGLE_KEY,
PROP_MAX_CHI_SYMBOL_LEN,
PROP_DEFAULT_ENGLISH_CASE,
PROP_DEFAULT_USE_ENGLISH_MODE,
PROP_CHI_ENG_MODE_TOGGLE,
PROP_PHRASE_CHOICE_FROM_LAST,
PROP_SPACE_AS_SELECTION,
Expand Down Expand Up @@ -209,6 +210,9 @@ static void ibus_chewing_engine_set_property(GObject *object, guint property_id,
g_free(self->prop_default_english_case);
self->prop_default_english_case = g_value_dup_string(value);
break;
case PROP_DEFAULT_USE_ENGLISH_MODE:
self->prop_default_use_english_mode = g_value_get_boolean(value);
break;
case PROP_CHI_ENG_MODE_TOGGLE:
g_free(self->prop_chi_eng_mode_toggle);
self->prop_chi_eng_mode_toggle = g_value_dup_string(value);
Expand Down Expand Up @@ -298,6 +302,9 @@ static void ibus_chewing_engine_get_property(GObject *object, guint property_id,
case PROP_DEFAULT_ENGLISH_CASE:
g_value_set_string(value, self->prop_default_english_case);
break;
case PROP_DEFAULT_USE_ENGLISH_MODE:
g_value_set_boolean(value, self->prop_default_use_english_mode);
break;
case PROP_CHI_ENG_MODE_TOGGLE:
g_value_set_string(value, self->prop_chi_eng_mode_toggle);
break;
Expand Down Expand Up @@ -377,6 +384,8 @@ static void ibus_chewing_engine_class_init(IBusChewingEngineClass *klass) {
g_param_spec_int("max-chi-symbol-len", NULL, NULL, 0, 39, 20, G_PARAM_READWRITE);
obj_properties[PROP_DEFAULT_ENGLISH_CASE] =
g_param_spec_string("default-english-case", NULL, NULL, NULL, G_PARAM_READWRITE);
obj_properties[PROP_DEFAULT_USE_ENGLISH_MODE] =
g_param_spec_boolean("default-use-english-mode", NULL, NULL, FALSE, G_PARAM_READWRITE);
obj_properties[PROP_CHI_ENG_MODE_TOGGLE] =
g_param_spec_string("chi-eng-mode-toggle", NULL, NULL, NULL, G_PARAM_READWRITE);
obj_properties[PROP_PHRASE_CHOICE_FROM_LAST] =
Expand Down Expand Up @@ -472,6 +481,7 @@ static void ibus_chewing_engine_init(IBusChewingEngine *self) {
bind_settings("enable-fullwidth-toggle-key");
bind_settings("max-chi-symbol-len");
bind_settings("default-english-case");
bind_settings("default-use-english-mode");
bind_settings("chi-eng-mode-toggle");
bind_settings("phrase-choice-from-last");
bind_settings("space-as-selection");
Expand Down Expand Up @@ -744,6 +754,9 @@ void ibus_chewing_engine_enable(IBusEngine *engine) {
IBUS_CHEWING_LOG(MSG, "* enable(): statusFlags=%x", self->statusFlags);
ibus_chewing_engine_start(self);
ibus_chewing_engine_set_status_flag(self, ENGINE_FLAG_ENABLED);
if (self->prop_default_use_english_mode) {
ibus_chewing_pre_edit_set_chi_eng_mode(self->icPreEdit, FALSE);
}
}

void ibus_chewing_engine_disable(IBusEngine *engine) {
Expand Down
Loading

0 comments on commit 66f2019

Please sign in to comment.