@@ -97,44 +97,64 @@ impl Application {
9797 fn setup_gactions ( & self ) {
9898 // Quit
9999 let action_quit = gio:: SimpleAction :: new ( "quit" , None ) ;
100- action_quit. connect_activate ( clone ! ( @weak self as app => move |_, _| {
101- // This is needed to trigger the delete event and saving the window state
102- app. main_window( ) . close( ) ;
103- app. quit( ) ;
104- } ) ) ;
100+ action_quit. connect_activate ( clone ! (
101+ #[ weak( rename_to = app) ]
102+ self ,
103+ move |_, _| {
104+ // This is needed to trigger the delete event and saving the window state
105+ app. main_window( ) . close( ) ;
106+ app. quit( ) ;
107+ }
108+ ) ) ;
105109 self . add_action ( & action_quit) ;
106110
107111 // About
108112 let action_about = gio:: SimpleAction :: new ( "about" , None ) ;
109- action_about. connect_activate ( clone ! ( @weak self as app => move |_, _| {
110- app. show_about_dialog( ) ;
111- } ) ) ;
113+ action_about. connect_activate ( clone ! (
114+ #[ weak( rename_to = app) ]
115+ self ,
116+ move |_, _| {
117+ app. show_about_dialog( ) ;
118+ }
119+ ) ) ;
112120 self . add_action ( & action_about) ;
113121
114122 // Select chat
115123 let action_select_chat =
116124 gio:: SimpleAction :: new ( "select-chat" , Some ( glib:: VariantTy :: new ( "(ix)" ) . unwrap ( ) ) ) ;
117- action_select_chat. connect_activate ( clone ! ( @weak self as app => move |_, data| {
118- let ( client_id, chat_id) = data. unwrap( ) . get( ) . unwrap( ) ;
119- app. main_window( ) . select_chat( client_id, chat_id) ;
120- } ) ) ;
125+ action_select_chat. connect_activate ( clone ! (
126+ #[ weak( rename_to = app) ]
127+ self ,
128+ move |_, data| {
129+ let ( client_id, chat_id) = data. unwrap( ) . get( ) . unwrap( ) ;
130+ app. main_window( ) . select_chat( client_id, chat_id) ;
131+ }
132+ ) ) ;
121133 self . add_action ( & action_select_chat) ;
122134
123135 // New login on production server
124136 let action_new_login_production_server =
125137 gio:: SimpleAction :: new ( "new-login-production-server" , None ) ;
126- action_new_login_production_server. connect_activate (
127- clone ! ( @weak self as app => move |_, _| {
128- app. main_window( ) . client_manager_view( ) . add_new_client( false ) ;
129- } ) ,
130- ) ;
138+ action_new_login_production_server. connect_activate ( clone ! (
139+ #[ weak( rename_to = app) ]
140+ self ,
141+ move |_, _| {
142+ app. main_window( )
143+ . client_manager_view( )
144+ . add_new_client( false ) ;
145+ }
146+ ) ) ;
131147 self . add_action ( & action_new_login_production_server) ;
132148
133149 // New login on test server
134150 let action_new_login_test_server = gio:: SimpleAction :: new ( "new-login-test-server" , None ) ;
135- action_new_login_test_server. connect_activate ( clone ! ( @weak self as app => move |_, _| {
136- app. main_window( ) . client_manager_view( ) . add_new_client( true ) ;
137- } ) ) ;
151+ action_new_login_test_server. connect_activate ( clone ! (
152+ #[ weak( rename_to = app) ]
153+ self ,
154+ move |_, _| {
155+ app. main_window( ) . client_manager_view( ) . add_new_client( true ) ;
156+ }
157+ ) ) ;
138158 self . add_action ( & action_new_login_test_server) ;
139159 }
140160
0 commit comments