Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputMethod: Fix ProgressDialog is not used #459

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/Dialogs/InstallEngineDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

public class Pantheon.Keyboard.InputMethodPage.InstallEngineDialog : Granite.MessageDialog {
private Gtk.ListBox listbox;
private InstallList? engines_filter;

public InstallEngineDialog (Gtk.Window parent) {
Expand Down Expand Up @@ -52,7 +53,7 @@ public class Pantheon.Keyboard.InputMethodPage.InstallEngineDialog : Granite.Mes
language_header.pack_start (back_button);
language_header.set_center_widget (language_title);

var listbox = new Gtk.ListBox () {
listbox = new Gtk.ListBox () {
expand = true
};
listbox.set_filter_func (filter_function);
Expand Down Expand Up @@ -115,13 +116,10 @@ public class Pantheon.Keyboard.InputMethodPage.InstallEngineDialog : Granite.Mes
((EnginesRow) listbox.get_selected_row ()).selected = true;
install_button.sensitive = true;
});
}

response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.OK) {
string engine_to_install = ((EnginesRow) listbox.get_selected_row ()).engine_name;
UbuntuInstaller.get_default ().install (engine_to_install);
}
});
public string get_selected_engine_name () {
return ((EnginesRow) listbox.get_selected_row ()).engine_name;
}

[CCode (instance_pos = -1)]
Expand Down
19 changes: 18 additions & 1 deletion src/Widgets/InputMethod/AddEnginesPopover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,26 @@ public class Pantheon.Keyboard.InputMethodPage.AddEnginesPopover : Gtk.Popover {
install_button.clicked.connect (() => {
popdown ();

var installer = UbuntuInstaller.get_default ();
var install_dialog = new InstallEngineDialog ((Gtk.Window) get_toplevel ());
install_dialog.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.OK) {
string engine_to_install = install_dialog.get_selected_engine_name ();
install_dialog.destroy ();
installer.install (engine_to_install);

var progress_dialog = new ProgressDialog () {
transient_for = (Gtk.Window) get_toplevel ()
};
installer.progress_changed.connect ((p) => {
progress_dialog.progress = p;
});
progress_dialog.run ();
} else {
install_dialog.destroy ();
}
});
install_dialog.run ();
install_dialog.destroy ();
});

cancel_button.clicked.connect (() => {
Expand Down