audrey/src/main.rs

27 lines
807 B
Rust
Raw Normal View History

2024-10-29 10:46:58 +00:00
use gtk::gio;
2024-10-29 10:37:15 +00:00
extern crate adw;
extern crate libsecret;
#[link(name = "audrey")]
#[link(name = "gcrypt")]
#[link(name = "json-glib-1.0")]
#[link(name = "mpv")]
#[link(name = "soup-3.0")]
extern "C" {
fn c_main(argc: std::ffi::c_int, argv: *const *const std::ffi::c_char) -> std::ffi::c_int;
2024-10-29 10:37:15 +00:00
}
fn main() {
2024-10-29 10:46:58 +00:00
gio::resources_register_include!("audrey.gresource").expect("could not register resources");
let args = std::env::args_os();
let argc = args.len();
let argv: Vec<std::ffi::CString> = args
.map(|arg| std::ffi::CString::new(std::ffi::OsStr::as_encoded_bytes(&arg)).unwrap())
.collect();
let argv: Vec<*const std::ffi::c_char> = argv.iter().map(|arg| arg.as_ptr()).collect();
unsafe { std::process::exit(c_main(argc as std::ffi::c_int, argv.as_ptr())) }
2024-10-29 10:37:15 +00:00
}