[gnome-boxes] First start experience improvement



commit 45ce19ef948c280037cdab2bc2ccb56789a3047e
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Tue Feb 21 01:54:52 2012 +0100

    First start experience improvement
    
    Currently, when the user starts Boxes for the first time, he ends up
    in an empty collection without message on what to do. Instead,
    starting with the Wizard is slightly better. Proposed patch attached.
    
    Note: there is no yet final decision from the design team on what
    should be done, but only one line of the proposed patch is actually
    implementing the first-time experience policy, and thus could easily
    be changed if needed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670539

 src/app.vala  |   19 ++++++++++++-------
 src/main.vala |    4 +++-
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index d68c870..9d6aec2 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -41,7 +41,7 @@ private class Boxes.App: Boxes.UI {
     public GLib.SimpleAction action_properties;
     public GLib.SimpleAction action_fullscreen;
 
-    public signal void ready ();
+    public signal void ready (bool first_time);
     public signal void item_selected (CollectionItem item);
     private Gtk.Application application;
     private Clutter.TableLayout box_table;
@@ -99,8 +99,6 @@ private class Boxes.App: Boxes.UI {
         });
         application.add_action (action);
 
-
-
         application.startup.connect_after ((app) => {
             var menu = new GLib.Menu ();
             menu.append (_("New"), "app.new");
@@ -125,8 +123,9 @@ private class Boxes.App: Boxes.UI {
             collection.item_removed.connect ((item) => {
                 view.remove_item (item);
             });
-            setup_sources.begin ((obj, rest) => {
-                ready ();
+            setup_sources.begin ((obj, result) => {
+                var first_time = setup_sources.end (result);
+                ready (first_time);
             });
         });
 
@@ -215,8 +214,12 @@ private class Boxes.App: Boxes.UI {
         }
     }
 
-    private async void setup_sources () {
+    private async bool setup_sources () {
+        var first_time = false;
+
         if (!has_pkgconfig_sources ()) {
+            first_time = true;
+
             var src = File.new_for_path (get_pkgdata_source ("QEMU_Session"));
             var dst = File.new_for_path (get_pkgconfig_source ("QEMU Session"));
             try {
@@ -235,11 +238,13 @@ private class Boxes.App: Boxes.UI {
         if (default_connection == null) {
             printerr ("error: missing or failing default libvirt connection");
             application.release (); // will end application
-            return;
+            return false;
         }
 
         var dir = File.new_for_path (get_pkgconfig_source ());
         get_sources_from_dir.begin (dir);
+
+        return first_time;
     }
 
     private async void get_sources_from_dir (File dir) {
diff --git a/src/main.vala b/src/main.vala
index 0c3cc67..3f7ffa7 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -67,11 +67,13 @@ public int main (string[] args) {
 
     var app = new Boxes.App ();
 
-    app.ready.connect (() => {
+    app.ready.connect ((first_time) => {
         if (uris != null) {
             // FIXME: We only handle a single URI from commandline
             var file = File.new_for_commandline_arg (uris[0]);
             app.wizard.open_with_uri (file.get_uri ());
+        } else if (first_time) {
+            app.ui_state = Boxes.UIState.WIZARD;
         }
     });
 



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