Closed tataDan closed 2 years ago
I have a cancel button as created as follows: let cancel_button = gtk::Button::with_label("Cancel");
let cancel_button = gtk::Button::with_label("Cancel");
This code does print the text to the console as expected:
cancel_button.connect_clicked(glib::clone!(@weak window => move |_| { println!("Cancel button clicked"); }));
Suppose I wanted to use this button to gracefully exit the application (basically doing what clicking on the close icon in the titlle bar would do).
What would be the best way to do this?
If you use gio::Application / gtk::Application then call quit() on it. If you just use a mainloop, call quit() on that.
gio::Application
gtk::Application
quit()
I have a cancel button as created as follows:
let cancel_button = gtk::Button::with_label("Cancel");
This code does print the text to the console as expected:
Suppose I wanted to use this button to gracefully exit the application (basically doing what clicking on the close icon in the titlle bar would do).
What would be the best way to do this?