[gnome-games] application: Show error when no game found for uri



commit 5b8915c7989e774fc370ada0cd1b7f15b5d34794
Author: Yetizone <andreii lisita gmail com>
Date:   Mon Feb 18 17:25:09 2019 +0200

    application: Show error when no game found for uri

 src/ui/application.vala | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/application.vala b/src/ui/application.vala
index b302b3fc..baf0fc67 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -204,12 +204,18 @@ public class Games.Application : Gtk.Application {
                foreach (var file in files)
                        uris += new Uri.from_file (file);
 
+               // FIXME: This is done because files[0] gets freed after yield
+               var file = files[0];
                var game = yield game_for_uris (uris);
 
-               if (game != null)
-                       window.run_game (game);
-               // else
-                       // TODO Display an error
+               if (game == null) {
+                       var filename = file.get_basename ();
+                       var error_msg = _("An unexpected error occured while trying to run %s").printf 
(filename);
+                       window.show_error (error_msg);
+                       return;
+               }
+
+               window.run_game (game);
        }
 
        protected override void activate () {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]