[gnome-games/wip/exalm/dialogs: 2/3] application: Stop using dialog.run()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/dialogs: 2/3] application: Stop using dialog.run()
- Date: Wed, 24 Mar 2021 18:00:35 +0000 (UTC)
commit 776c9e6fd5dff14f5c6548db7d8a3cc541c19c60
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Mar 24 22:57:37 2021 +0500
application: Stop using dialog.run()
src/ui/application.vala | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 8ff9e7b6..d589c690 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -165,12 +165,18 @@ public class Games.Application : Gtk.Application {
return is_flatpak;
}
- public void add_game_files () {
+ private void add_game_files () {
+ add_game_files_async.begin ();
+ }
+
+ private async void add_game_files_async () {
var chooser = new Gtk.FileChooserDialog (
- _("Select game files"), window, Gtk.FileChooserAction.OPEN,
+ _("Select game files"),
+ window,
+ Gtk.FileChooserAction.OPEN,
_("_Cancel"), Gtk.ResponseType.CANCEL,
- _("_Add"), Gtk.ResponseType.ACCEPT);
-
+ _("_Add"), Gtk.ResponseType.ACCEPT
+ );
chooser.select_multiple = true;
@@ -179,13 +185,15 @@ public class Games.Application : Gtk.Application {
foreach (var mime_type in game_collection.get_accepted_mime_types ())
filter.add_mime_type (mime_type);
- if (chooser.run () == Gtk.ResponseType.ACCEPT)
+ var response = yield DialogUtils.run_async (chooser);
+
+ if (response == Gtk.ResponseType.ACCEPT)
foreach (unowned string uri_string in chooser.get_uris ()) {
var uri = new Uri (uri_string);
add_cached_uri (uri);
}
- chooser.close ();
+ chooser.destroy ();
}
protected override void open (File[] files, string hint) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]