app: update clients to use `root_window`
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 6 Sep 2017 15:51:00 +0000 (11:51 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 8 Sep 2017 21:18:55 +0000 (17:18 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/benitlux/src/client/views/home_views.nit
contrib/tnitter/src/tnitter_app.nit
examples/calculator/src/calculator.nit

index 402c173..460e1be 100644 (file)
@@ -19,24 +19,9 @@ import beer_views
 import social_views
 import user_views
 
-redef class App
-       redef fun on_create
-       do
-               if debug then print "App::on_create"
-
-               # Create the main window
-               show_home
-               super
-       end
-
-       # Show the home/main windows
-       fun show_home
-       do
-               var window = new HomeWindow
-               window.refresh
-               push_window window
-       end
+redef fun root_window do return new HomeWindow
 
+redef class App
        redef fun on_log_in
        do
                super
index 8218004..760af3d 100644 (file)
@@ -38,18 +38,7 @@ import model
 # Delay in seconds before the next request after an error
 fun request_delay_on_error: Float do return 60.0
 
-redef class App
-       redef fun on_create
-       do
-               # Create the main window
-               push_window new TnitterWindow
-               super
-       end
-end
-
-# Main window
-class TnitterWindow
-       super Window
+redef class Window
 
        private var layout = new VerticalLayout(parent=self)
        private var list_posts = new ListLayout(parent=layout)
@@ -98,7 +87,7 @@ fun tnitter_server_uri: String do return "http://localhost:8080"
 abstract class AsyncTnitterRequest
        super AsyncHttpRequest
 
-       private var window: TnitterWindow
+       private var window: Window
 
        redef fun uri_root do return tnitter_server_uri
 
index 6cfb1aa..32799ca 100644 (file)
@@ -32,16 +32,7 @@ import calculator_logic
 # Show debug output?
 fun debug: Bool do return false
 
-redef class App
-       redef fun on_create
-       do
-               if debug then print "App::on_create"
-
-               # Create the main window
-               push_window new CalculatorWindow
-               super
-       end
-end
+redef fun root_window do return new CalculatorWindow
 
 # The main (and only) window of this calculator
 class CalculatorWindow