136 lines
3.5 KiB
Rust
136 lines
3.5 KiB
Rust
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
|
// DO NOT EDIT
|
|
|
|
use glib;
|
|
use glib::object::IsA;
|
|
use glib::translate::*;
|
|
use glib::GString;
|
|
use light_dm_sys;
|
|
use std::ptr;
|
|
use Language;
|
|
use Layout;
|
|
use Session;
|
|
|
|
pub fn get_can_hibernate() -> bool {
|
|
unsafe { from_glib(light_dm_sys::lightdm_get_can_hibernate()) }
|
|
}
|
|
|
|
pub fn get_can_restart() -> bool {
|
|
unsafe { from_glib(light_dm_sys::lightdm_get_can_restart()) }
|
|
}
|
|
|
|
pub fn get_can_shutdown() -> bool {
|
|
unsafe { from_glib(light_dm_sys::lightdm_get_can_shutdown()) }
|
|
}
|
|
|
|
pub fn get_can_suspend() -> bool {
|
|
unsafe { from_glib(light_dm_sys::lightdm_get_can_suspend()) }
|
|
}
|
|
|
|
pub fn get_hostname() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_hostname()) }
|
|
}
|
|
|
|
pub fn get_language() -> Option<Language> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_language()) }
|
|
}
|
|
|
|
pub fn get_languages() -> Vec<Language> {
|
|
unsafe { FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_get_languages()) }
|
|
}
|
|
|
|
pub fn get_layout() -> Option<Layout> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_layout()) }
|
|
}
|
|
|
|
pub fn get_layouts() -> Vec<Layout> {
|
|
unsafe { FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_get_layouts()) }
|
|
}
|
|
|
|
pub fn get_motd() -> Option<GString> {
|
|
unsafe { from_glib_full(light_dm_sys::lightdm_get_motd()) }
|
|
}
|
|
|
|
pub fn get_os_id() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_os_id()) }
|
|
}
|
|
|
|
pub fn get_os_name() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_os_name()) }
|
|
}
|
|
|
|
pub fn get_os_pretty_name() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_os_pretty_name()) }
|
|
}
|
|
|
|
pub fn get_os_version() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_os_version()) }
|
|
}
|
|
|
|
pub fn get_os_version_id() -> Option<GString> {
|
|
unsafe { from_glib_none(light_dm_sys::lightdm_get_os_version_id()) }
|
|
}
|
|
|
|
pub fn get_remote_sessions() -> Vec<Session> {
|
|
unsafe { FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_get_remote_sessions()) }
|
|
}
|
|
|
|
pub fn get_sessions() -> Vec<Session> {
|
|
unsafe { FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_get_sessions()) }
|
|
}
|
|
|
|
pub fn hibernate() -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = light_dm_sys::lightdm_hibernate(&mut error);
|
|
if error.is_null() {
|
|
Ok(())
|
|
} else {
|
|
Err(from_glib_full(error))
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn restart() -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = light_dm_sys::lightdm_restart(&mut error);
|
|
if error.is_null() {
|
|
Ok(())
|
|
} else {
|
|
Err(from_glib_full(error))
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn set_layout<P: IsA<Layout>>(layout: &P) {
|
|
unsafe {
|
|
light_dm_sys::lightdm_set_layout(layout.as_ref().to_glib_none().0);
|
|
}
|
|
}
|
|
|
|
pub fn shutdown() -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = light_dm_sys::lightdm_shutdown(&mut error);
|
|
if error.is_null() {
|
|
Ok(())
|
|
} else {
|
|
Err(from_glib_full(error))
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn suspend() -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = light_dm_sys::lightdm_suspend(&mut error);
|
|
if error.is_null() {
|
|
Ok(())
|
|
} else {
|
|
Err(from_glib_full(error))
|
|
}
|
|
}
|
|
}
|