@@ -38,7 +38,7 @@ use gtk::{
3838 WindowType ,
3939} ;
4040use gtk:: Orientation :: Vertical ;
41- use relm:: { Component , ContainerWidget , Relm , Widget } ;
41+ use relm:: { Component , ContainerWidget , Relm , Update , Widget } ;
4242
4343use self :: CheckMsg :: * ;
4444use self :: Msg :: * ;
@@ -61,11 +61,10 @@ struct CheckButton {
6161 relm : Relm < CheckButton > ,
6262}
6363
64- impl Widget for CheckButton {
64+ impl Update for CheckButton {
6565 type Model = CheckModel ;
6666 type ModelParam = & ' static str ;
6767 type Msg = CheckMsg ;
68- type Root = gtk:: CheckButton ;
6968
7069 fn model ( _: & Relm < Self > , label : & ' static str ) -> CheckModel {
7170 CheckModel {
@@ -74,10 +73,6 @@ impl Widget for CheckButton {
7473 }
7574 }
7675
77- fn root ( & self ) -> Self :: Root {
78- self . button . clone ( )
79- }
80-
8176 fn update ( & mut self , event : CheckMsg ) {
8277 match event {
8378 Check => {
@@ -99,6 +94,14 @@ impl Widget for CheckButton {
9994 } ,
10095 }
10196 }
97+ }
98+
99+ impl Widget for CheckButton {
100+ type Root = gtk:: CheckButton ;
101+
102+ fn root ( & self ) -> Self :: Root {
103+ self . button . clone ( )
104+ }
102105
103106 fn view ( relm : & Relm < Self > , model : Self :: Model ) -> Rc < RefCell < Self > > {
104107 let button = gtk:: CheckButton :: new_with_label ( model. label ) ;
@@ -126,19 +129,14 @@ struct Win {
126129 window : Window ,
127130}
128131
129- impl Widget for Win {
132+ impl Update for Win {
130133 type Model = ( ) ;
131134 type ModelParam = ( ) ;
132135 type Msg = Msg ;
133- type Root = Window ;
134136
135137 fn model ( _: & Relm < Self > , _: ( ) ) -> ( ) {
136138 }
137139
138- fn root ( & self ) -> Self :: Root {
139- self . window . clone ( )
140- }
141-
142140 fn update ( & mut self , event : Msg ) {
143141 match event {
144142 Quit => gtk:: main_quit ( ) ,
@@ -160,6 +158,14 @@ impl Widget for Win {
160158 } ,
161159 }
162160 }
161+ }
162+
163+ impl Widget for Win {
164+ type Root = Window ;
165+
166+ fn root ( & self ) -> Self :: Root {
167+ self . window . clone ( )
168+ }
163169
164170 fn view ( relm : & Relm < Self > , _model : Self :: Model ) -> Rc < RefCell < Self > > {
165171 let vbox = gtk:: Box :: new ( Vertical , 0 ) ;
0 commit comments