How do I handle command line arguments like --config <file> in a rust based gtk application?
Add a call to gtk::Application::add_main_option as shown in the GTK Documentation. First:
gtk_app.add_main_option(
  "config",
  glib::Char::new("c"),
  glib::OptionFlags::IN_MAIN,
  glib::OptionArg::Filename,
  "some description",
  Some("some other description")
);
then add a call to:
gtk_app.connect_handle_local_options( ... );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With