Skip to content

Commit

Permalink
ui/gtk3: Warning dialog for any deprecated IBus XKB engine
Browse files Browse the repository at this point in the history
This is a follow-up of commit 5322c44. That commit introduced
a warning dialog in case of an empty engines list.

This commit makes a differently worded warning dialog be shown
in cases where the engines list is not empty but preload-engines
includes at least one deprecated engine. It also fixes a variable
confusion so a deprecated engine is mentioned in the first kind
of warning dialog and not the US engine.

BUG=#2274
  • Loading branch information
gunnarhj authored and fujiwarat committed Dec 11, 2020
1 parent 5322c44 commit aec2ac7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
37 changes: 24 additions & 13 deletions po/ibus10.pot
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus 1.5.23\n"
"Report-Msgid-Bugs-To: https://github.com/ibus/ibus/issues\n"
"POT-Creation-Date: 2020-11-21 07:09+0900\n"
"PO-Revision-Date: 2020-11-21 07:09+0900\n"
"POT-Creation-Date: 2020-12-11 16:21+0900\n"
"PO-Revision-Date: 2020-12-11 16:21+0900\n"
"Last-Translator: Takao Fujiwara <takao.fujiwara1@gmail.com>\n"
"Language-Team: Source\n"
"Language: \n"
Expand Down Expand Up @@ -402,7 +402,7 @@ msgstr ""
msgid "More…"
msgstr ""

#: setup/engineabout.py:37 setup/setup.ui:1368 ui/gtk3/panel.vala:1176
#: setup/engineabout.py:37 setup/setup.ui:1368 ui/gtk3/panel.vala:1184
msgid "About"
msgstr ""

Expand Down Expand Up @@ -3172,7 +3172,7 @@ msgid "Alias: %s"
msgstr ""

#: ui/gtk3/emojier.vala:2140 ui/gtk3/ibus-extension-gtk3.desktop.in:3
#: ui/gtk3/ibus-ui-emojier.desktop.in:3 ui/gtk3/panel.vala:1161
#: ui/gtk3/ibus-ui-emojier.desktop.in:3 ui/gtk3/panel.vala:1169
msgid "Emoji Choice"
msgstr ""

Expand Down Expand Up @@ -3233,31 +3233,42 @@ msgstr ""
msgid "IBus Panel"
msgstr ""

#: ui/gtk3/panel.vala:970
#: ui/gtk3/panel.vala:975
#, c-format
msgid ""
"Your input method %s does not exist in IBus input methods so \"US\" layout "
"was configured instead of your input method. Please run `ibus-setup` "
"command, open \"Input Method\" tab, and configure your input methods again."
"Your configured input method %s does not exist in IBus input methods so \"US"
"\" layout was configured instead of your input method."
msgstr ""

#: ui/gtk3/panel.vala:1133
#: ui/gtk3/panel.vala:980
msgid ""
"At least one of your configured input methods does not exist in IBus input "
"methods."
msgstr ""

#: ui/gtk3/panel.vala:983
msgid ""
"Please run `ibus-setup` command, open \"Input Method\" tab, and configure "
"your input methods again."
msgstr ""

#: ui/gtk3/panel.vala:1141
msgid "IBus is an intelligent input bus for Linux/Unix."
msgstr ""

#: ui/gtk3/panel.vala:1137
#: ui/gtk3/panel.vala:1145
msgid "translator-credits"
msgstr ""

#: ui/gtk3/panel.vala:1156
#: ui/gtk3/panel.vala:1164
msgid "Preferences"
msgstr ""

#: ui/gtk3/panel.vala:1182
#: ui/gtk3/panel.vala:1190
msgid "Restart"
msgstr ""

#: ui/gtk3/panel.vala:1186
#: ui/gtk3/panel.vala:1194
msgid "Quit"
msgstr ""

Expand Down
30 changes: 19 additions & 11 deletions ui/gtk3/panel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -966,25 +966,33 @@ class Panel : IBus.PanelService {
/* Fedora internal patch could save engines not in simple.xml
* likes 'xkb:cn::chi'.
*/
if (engines.length == 0) {
names = {"xkb:us::eng"};
m_settings_general.set_strv("preload-engines", names);
engines = m_bus.get_engines_by_names(names);
var message = _("Your input method %s does not exist in IBus " +
"input methods so \"US\" layout was configured instead " +
"of your input method. Please run `ibus-setup` command, " +
"open \"Input Method\" tab, and configure your input " +
"methods again.").printf(names[0]);
if (engines.length < names.length) {
string message1;
if (engines.length == 0) {
string[] fallback_names = {"xkb:us::eng"};
m_settings_general.set_strv("preload-engines", fallback_names);
engines = m_bus.get_engines_by_names(fallback_names);
message1 = _("Your configured input method %s does not exist " +
"in IBus input methods so \"US\" layout was " +
"configured instead of your input method."
).printf(names[0]);
} else {
message1 = _("At least one of your configured input methods " +
"does not exist in IBus input methods.");
}
var message2 = _("Please run `ibus-setup` command, open \"Input " +
"Method\" tab, and configure your input methods " +
"again.");
var dialog = new Gtk.MessageDialog(
null,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MessageType.WARNING,
Gtk.ButtonsType.CLOSE,
message);
"%s %s", message1, message2);
dialog.response.connect((id) => {
dialog.destroy();
});
dialog.show();
dialog.show_all();
}

if (m_engines.length == 0) {
Expand Down

0 comments on commit aec2ac7

Please sign in to comment.