Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Command-line option support for gio::Application
Browse files Browse the repository at this point in the history
This patch depends on the one adding OptionArg and OptionFlags to glib-rs.
  • Loading branch information
philn committed Oct 27, 2018
1 parent 522c683 commit 3a7065c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ manual = [
"GLib.IOCondition",
"GLib.KeyFile",
"GLib.MainContext",
"GLib.OptionArg",
"GLib.OptionFlags",
"GLib.Priority",
"GLib.SeekType",
"GLib.Source",
Expand Down
16 changes: 10 additions & 6 deletions src/auto/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl Application {
pub trait ApplicationExt {
fn activate(&self);

//#[cfg(any(feature = "v2_42", feature = "dox"))]
//fn add_main_option<'a, P: Into<Option<&'a str>>>(&self, long_name: &str, short_name: glib::Char, flags: /*Ignored*/glib::OptionFlags, arg: /*Ignored*/glib::OptionArg, description: &str, arg_description: P);
#[cfg(any(feature = "v2_42", feature = "dox"))]
fn add_main_option<'a, P: Into<Option<&'a str>>>(&self, long_name: &str, short_name: glib::Char, flags: glib::OptionFlags, arg: glib::OptionArg, description: &str, arg_description: P);

//#[cfg(any(feature = "v2_40", feature = "dox"))]
//fn add_main_option_entries(&self, entries: /*Ignored*/&[&glib::OptionEntry]);
Expand Down Expand Up @@ -183,10 +183,14 @@ impl<O: IsA<Application> + IsA<glib::object::Object>> ApplicationExt for O {
}
}

//#[cfg(any(feature = "v2_42", feature = "dox"))]
//fn add_main_option<'a, P: Into<Option<&'a str>>>(&self, long_name: &str, short_name: glib::Char, flags: /*Ignored*/glib::OptionFlags, arg: /*Ignored*/glib::OptionArg, description: &str, arg_description: P) {
// unsafe { TODO: call ffi::g_application_add_main_option() }
//}
#[cfg(any(feature = "v2_42", feature = "dox"))]
fn add_main_option<'a, P: Into<Option<&'a str>>>(&self, long_name: &str, short_name: glib::Char, flags: glib::OptionFlags, arg: glib::OptionArg, description: &str, arg_description: P) {
let arg_description = arg_description.into();
let arg_description = arg_description.to_glib_none();
unsafe {
ffi::g_application_add_main_option(self.to_glib_none().0, long_name.to_glib_none().0, short_name.to_glib(), flags.to_glib(), arg.to_glib(), description.to_glib_none().0, arg_description.0);
}
}

//#[cfg(any(feature = "v2_40", feature = "dox"))]
//fn add_main_option_entries(&self, entries: /*Ignored*/&[&glib::OptionEntry]) {
Expand Down
2 changes: 1 addition & 1 deletion src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c385982)
from gir-files (https://github.com/gtk-rs/gir-files @ a08aa4c)
from gir-files (https://github.com/gtk-rs/gir-files @ c49dfc7)

0 comments on commit 3a7065c

Please sign in to comment.