From: Alexis Laferrière Date: Wed, 6 Sep 2017 15:51:00 +0000 (-0400) Subject: app: update clients to use `root_window` X-Git-Url: http://nitlanguage.org app: update clients to use `root_window` Signed-off-by: Alexis Laferrière --- diff --git a/contrib/benitlux/src/client/views/home_views.nit b/contrib/benitlux/src/client/views/home_views.nit index 402c173..460e1be 100644 --- a/contrib/benitlux/src/client/views/home_views.nit +++ b/contrib/benitlux/src/client/views/home_views.nit @@ -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 diff --git a/contrib/tnitter/src/tnitter_app.nit b/contrib/tnitter/src/tnitter_app.nit index 8218004..760af3d 100644 --- a/contrib/tnitter/src/tnitter_app.nit +++ b/contrib/tnitter/src/tnitter_app.nit @@ -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 diff --git a/examples/calculator/src/calculator.nit b/examples/calculator/src/calculator.nit index 6cfb1aa..32799ca 100644 --- a/examples/calculator/src/calculator.nit +++ b/examples/calculator/src/calculator.nit @@ -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