Skip to content

Commit

Permalink
Don't use FileChooserNative.run
Browse files Browse the repository at this point in the history
Be async, be cool :-)
  • Loading branch information
jiri-janousek committed Apr 25, 2018
1 parent b4f4170 commit a372b81
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/nuvolakit-runner/components/developer/WebViewSidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,20 @@ public class WebViewSidebar: Gtk.Grid {
filter.set_filter_name("PNG images");
filter.add_pattern("*.png");
dialog.add_filter(filter);
if (dialog.run() == Gtk.ResponseType.ACCEPT) {
try {
snapshot.save(dialog.get_filename(), "png", "compression", "9", null);
} catch (GLib.Error e) {
app.show_warning("Failed to save snapshot", e.message);
dialog.response.connect((response_id) => {
if (response_id == Gtk.ResponseType.ACCEPT) {
try {
snapshot.save(dialog.get_filename(), "png", "compression", "9", null);
} catch (GLib.Error e) {
app.show_warning("Failed to save snapshot", e.message);
}
}
}
dialog.destroy();
dialog.destroy();
});
dialog.show();
} else {
app.show_warning("Snapshot failure", "Failed to take a snapshot.");
}

}
#endif
}
Expand Down

0 comments on commit a372b81

Please sign in to comment.