1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from webkit-gir-files
// DO NOT EDIT
use crate::ffi;
use glib::translate::*;
glib::wrapper! {
/// Information about an application running in automation mode.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ApplicationInfo(Shared<ffi::WebKitApplicationInfo>);
match fn {
ref => |ptr| ffi::webkit_application_info_ref(ptr),
unref => |ptr| ffi::webkit_application_info_unref(ptr),
type_ => || ffi::webkit_application_info_get_type(),
}
}
impl ApplicationInfo {
/// Creates a new #WebKitApplicationInfo
///
/// # Returns
///
/// the newly created #WebKitApplicationInfo.
#[doc(alias = "webkit_application_info_new")]
pub fn new() -> ApplicationInfo {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::webkit_application_info_new()) }
}
/// Get the name of the application.
///
/// If webkit_application_info_set_name() hasn't been
/// called with a valid name, this returns g_get_prgname().
///
/// # Returns
///
/// the application name
#[doc(alias = "webkit_application_info_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::webkit_application_info_get_name(self.to_glib_none().0)) }
}
/// Get the application version previously set with webkit_application_info_set_version().
///
/// # Returns
///
///
/// ## `major`
/// return location for the major version number
///
/// ## `minor`
/// return location for the minor version number
///
/// ## `micro`
/// return location for the micro version number
#[doc(alias = "webkit_application_info_get_version")]
#[doc(alias = "get_version")]
pub fn version(&self) -> (u64, u64, u64) {
unsafe {
let mut major = std::mem::MaybeUninit::uninit();
let mut minor = std::mem::MaybeUninit::uninit();
let mut micro = std::mem::MaybeUninit::uninit();
ffi::webkit_application_info_get_version(
self.to_glib_none().0,
major.as_mut_ptr(),
minor.as_mut_ptr(),
micro.as_mut_ptr(),
);
(
major.assume_init(),
minor.assume_init(),
micro.assume_init(),
)
}
}
/// Set the name of the application.
///
/// If not provided, or [`None`] is passed,
/// g_get_prgname() will be used.
/// ## `name`
/// the application name
#[doc(alias = "webkit_application_info_set_name")]
pub fn set_name(&self, name: &str) {
unsafe {
ffi::webkit_application_info_set_name(self.to_glib_none().0, name.to_glib_none().0);
}
}
/// Set the application version.
///
/// If the application doesn't use the format
/// major.minor.micro you can pass 0 as the micro to use major.minor, or pass
/// 0 as both micro and minor to use only major number. Any other format must
/// be converted to major.minor.micro so that it can be used in version comparisons.
/// ## `major`
/// the major version number
/// ## `minor`
/// the minor version number
/// ## `micro`
/// the micro version number
#[doc(alias = "webkit_application_info_set_version")]
pub fn set_version(&self, major: u64, minor: u64, micro: u64) {
unsafe {
ffi::webkit_application_info_set_version(self.to_glib_none().0, major, minor, micro);
}
}
}
impl Default for ApplicationInfo {
fn default() -> Self {
Self::new()
}
}