[gnome-boxes] app: Refactor activate()



commit 5f16f76d7e9b2926226d04a1bb62c801579a278c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Mar 15 14:26:51 2016 +0000

    app: Refactor activate()
    
    We're about to add another async call here, which will require another
    level of .begin .end calls, which would make this method look much
    uglier. Let's put all the async calls into a separate async method.

 src/app.vala |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index b0454cb..39c2c6f 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -164,13 +164,7 @@ private class Boxes.App: Gtk.Application {
         var window = add_new_window ();
         window.set_state (UIState.COLLECTION);
 
-        setup_default_source.begin ((obj, result) => {
-            setup_default_source.end (result);
-            is_ready = true;
-            ready ();
-
-            setup_sources.begin ();
-        });
+        activate_async.begin ();
     }
 
     static bool opt_fullscreen;
@@ -390,6 +384,15 @@ private class Boxes.App: Gtk.Application {
         }
     }
 
+    private async void activate_async () {
+        yield setup_default_source ();
+
+        is_ready = true;
+        ready ();
+
+        setup_sources.begin ();
+    }
+
     private async void setup_default_source () {
         var path = get_user_pkgconfig_source (DEFAULT_SOURCE_NAME);
         var create_session_source = true;


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