basic lightdm bindings made
This commit is contained in:
67
src/auto/constants.rs
Normal file
67
src/auto/constants.rs
Normal file
@@ -0,0 +1,67 @@
|
||||
// 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 light_dm_sys;
|
||||
use std::ffi::CStr;
|
||||
|
||||
pub static GREETER_SIGNAL_AUTHENTICATION_COMPLETE: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static GREETER_SIGNAL_IDLE: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_IDLE)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static GREETER_SIGNAL_RESET: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_RESET)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static GREETER_SIGNAL_SHOW_MESSAGE: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static GREETER_SIGNAL_SHOW_PROMPT: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static SIGNAL_USER_CHANGED: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_SIGNAL_USER_CHANGED)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static USER_LIST_SIGNAL_USER_ADDED: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_USER_LIST_SIGNAL_USER_ADDED)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static USER_LIST_SIGNAL_USER_CHANGED: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_USER_LIST_SIGNAL_USER_CHANGED)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
||||
pub static USER_LIST_SIGNAL_USER_REMOVED: once_cell::sync::Lazy<&'static str> =
|
||||
once_cell::sync::Lazy::new(|| unsafe {
|
||||
CStr::from_ptr(light_dm_sys::LIGHTDM_USER_LIST_SIGNAL_USER_REMOVED)
|
||||
.to_str()
|
||||
.unwrap()
|
||||
});
|
264
src/auto/enums.rs
Normal file
264
src/auto/enums.rs
Normal file
@@ -0,0 +1,264 @@
|
||||
// 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::error::ErrorDomain;
|
||||
use glib::translate::*;
|
||||
use glib::value::FromValue;
|
||||
use glib::value::FromValueOptional;
|
||||
use glib::value::SetValue;
|
||||
use glib::value::Value;
|
||||
use glib::Quark;
|
||||
use glib::StaticType;
|
||||
use glib::Type;
|
||||
use gobject_sys;
|
||||
use light_dm_sys;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
#[non_exhaustive]
|
||||
pub enum GreeterError {
|
||||
CommunicationError,
|
||||
ConnectionFailed,
|
||||
SessionFailed,
|
||||
NoAutologin,
|
||||
InvalidUser,
|
||||
#[doc(hidden)]
|
||||
__Unknown(i32),
|
||||
}
|
||||
|
||||
impl fmt::Display for GreeterError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"GreeterError::{}",
|
||||
match *self {
|
||||
GreeterError::CommunicationError => "CommunicationError",
|
||||
GreeterError::ConnectionFailed => "ConnectionFailed",
|
||||
GreeterError::SessionFailed => "SessionFailed",
|
||||
GreeterError::NoAutologin => "NoAutologin",
|
||||
GreeterError::InvalidUser => "InvalidUser",
|
||||
_ => "Unknown",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl ToGlib for GreeterError {
|
||||
type GlibType = light_dm_sys::LightDMGreeterError;
|
||||
|
||||
fn to_glib(&self) -> light_dm_sys::LightDMGreeterError {
|
||||
match *self {
|
||||
GreeterError::CommunicationError => {
|
||||
light_dm_sys::LIGHTDM_GREETER_ERROR_COMMUNICATION_ERROR
|
||||
}
|
||||
GreeterError::ConnectionFailed => light_dm_sys::LIGHTDM_GREETER_ERROR_CONNECTION_FAILED,
|
||||
GreeterError::SessionFailed => light_dm_sys::LIGHTDM_GREETER_ERROR_SESSION_FAILED,
|
||||
GreeterError::NoAutologin => light_dm_sys::LIGHTDM_GREETER_ERROR_NO_AUTOLOGIN,
|
||||
GreeterError::InvalidUser => light_dm_sys::LIGHTDM_GREETER_ERROR_INVALID_USER,
|
||||
GreeterError::__Unknown(value) => value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl FromGlib<light_dm_sys::LightDMGreeterError> for GreeterError {
|
||||
fn from_glib(value: light_dm_sys::LightDMGreeterError) -> Self {
|
||||
match value {
|
||||
0 => GreeterError::CommunicationError,
|
||||
1 => GreeterError::ConnectionFailed,
|
||||
2 => GreeterError::SessionFailed,
|
||||
3 => GreeterError::NoAutologin,
|
||||
4 => GreeterError::InvalidUser,
|
||||
value => GreeterError::__Unknown(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ErrorDomain for GreeterError {
|
||||
fn domain() -> Quark {
|
||||
unsafe { from_glib(light_dm_sys::lightdm_greeter_error_quark()) }
|
||||
}
|
||||
|
||||
fn code(self) -> i32 {
|
||||
self.to_glib()
|
||||
}
|
||||
|
||||
fn from(code: i32) -> Option<Self> {
|
||||
match code {
|
||||
0 => Some(GreeterError::CommunicationError),
|
||||
1 => Some(GreeterError::ConnectionFailed),
|
||||
2 => Some(GreeterError::SessionFailed),
|
||||
3 => Some(GreeterError::NoAutologin),
|
||||
4 => Some(GreeterError::InvalidUser),
|
||||
value => Some(GreeterError::__Unknown(value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StaticType for GreeterError {
|
||||
fn static_type() -> Type {
|
||||
unsafe { from_glib(light_dm_sys::lightdm_greeter_error_get_type()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValueOptional<'a> for GreeterError {
|
||||
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
|
||||
Some(FromValue::from_value(value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValue<'a> for GreeterError {
|
||||
unsafe fn from_value(value: &Value) -> Self {
|
||||
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
impl SetValue for GreeterError {
|
||||
unsafe fn set_value(value: &mut Value, this: &Self) {
|
||||
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
#[non_exhaustive]
|
||||
pub enum MessageType {
|
||||
Info,
|
||||
Error,
|
||||
#[doc(hidden)]
|
||||
__Unknown(i32),
|
||||
}
|
||||
|
||||
impl fmt::Display for MessageType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"MessageType::{}",
|
||||
match *self {
|
||||
MessageType::Info => "Info",
|
||||
MessageType::Error => "Error",
|
||||
_ => "Unknown",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl ToGlib for MessageType {
|
||||
type GlibType = light_dm_sys::LightDMMessageType;
|
||||
|
||||
fn to_glib(&self) -> light_dm_sys::LightDMMessageType {
|
||||
match *self {
|
||||
MessageType::Info => light_dm_sys::LIGHTDM_MESSAGE_TYPE_INFO,
|
||||
MessageType::Error => light_dm_sys::LIGHTDM_MESSAGE_TYPE_ERROR,
|
||||
MessageType::__Unknown(value) => value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl FromGlib<light_dm_sys::LightDMMessageType> for MessageType {
|
||||
fn from_glib(value: light_dm_sys::LightDMMessageType) -> Self {
|
||||
match value {
|
||||
0 => MessageType::Info,
|
||||
1 => MessageType::Error,
|
||||
value => MessageType::__Unknown(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StaticType for MessageType {
|
||||
fn static_type() -> Type {
|
||||
unsafe { from_glib(light_dm_sys::lightdm_message_type_get_type()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValueOptional<'a> for MessageType {
|
||||
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
|
||||
Some(FromValue::from_value(value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValue<'a> for MessageType {
|
||||
unsafe fn from_value(value: &Value) -> Self {
|
||||
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
impl SetValue for MessageType {
|
||||
unsafe fn set_value(value: &mut Value, this: &Self) {
|
||||
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||
#[non_exhaustive]
|
||||
pub enum PromptType {
|
||||
Question,
|
||||
Secret,
|
||||
#[doc(hidden)]
|
||||
__Unknown(i32),
|
||||
}
|
||||
|
||||
impl fmt::Display for PromptType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"PromptType::{}",
|
||||
match *self {
|
||||
PromptType::Question => "Question",
|
||||
PromptType::Secret => "Secret",
|
||||
_ => "Unknown",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl ToGlib for PromptType {
|
||||
type GlibType = light_dm_sys::LightDMPromptType;
|
||||
|
||||
fn to_glib(&self) -> light_dm_sys::LightDMPromptType {
|
||||
match *self {
|
||||
PromptType::Question => light_dm_sys::LIGHTDM_PROMPT_TYPE_QUESTION,
|
||||
PromptType::Secret => light_dm_sys::LIGHTDM_PROMPT_TYPE_SECRET,
|
||||
PromptType::__Unknown(value) => value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl FromGlib<light_dm_sys::LightDMPromptType> for PromptType {
|
||||
fn from_glib(value: light_dm_sys::LightDMPromptType) -> Self {
|
||||
match value {
|
||||
0 => PromptType::Question,
|
||||
1 => PromptType::Secret,
|
||||
value => PromptType::__Unknown(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StaticType for PromptType {
|
||||
fn static_type() -> Type {
|
||||
unsafe { from_glib(light_dm_sys::lightdm_prompt_type_get_type()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValueOptional<'a> for PromptType {
|
||||
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
|
||||
Some(FromValue::from_value(value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromValue<'a> for PromptType {
|
||||
unsafe fn from_value(value: &Value) -> Self {
|
||||
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
impl SetValue for PromptType {
|
||||
unsafe fn set_value(value: &mut Value, this: &Self) {
|
||||
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
|
||||
}
|
||||
}
|
135
src/auto/functions.rs
Normal file
135
src/auto/functions.rs
Normal file
@@ -0,0 +1,135 @@
|
||||
// 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))
|
||||
}
|
||||
}
|
||||
}
|
1281
src/auto/greeter.rs
Normal file
1281
src/auto/greeter.rs
Normal file
File diff suppressed because it is too large
Load Diff
157
src/auto/language.rs
Normal file
157
src/auto/language.rs
Normal file
@@ -0,0 +1,157 @@
|
||||
// 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::object::Cast;
|
||||
use glib::object::IsA;
|
||||
use glib::signal::connect_raw;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::translate::*;
|
||||
use glib::GString;
|
||||
use glib::StaticType;
|
||||
use glib::ToValue;
|
||||
use glib_sys;
|
||||
use light_dm_sys;
|
||||
use std::boxed::Box as Box_;
|
||||
use std::fmt;
|
||||
use std::mem::transmute;
|
||||
|
||||
glib_wrapper! {
|
||||
pub struct Language(Object<light_dm_sys::LightDMLanguage, light_dm_sys::LightDMLanguageClass, LanguageClass>);
|
||||
|
||||
match fn {
|
||||
get_type => || light_dm_sys::lightdm_language_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct LanguageBuilder {
|
||||
code: Option<String>,
|
||||
}
|
||||
|
||||
impl LanguageBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn build(self) -> Language {
|
||||
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
|
||||
if let Some(ref code) = self.code {
|
||||
properties.push(("code", code));
|
||||
}
|
||||
glib::Object::new(Language::static_type(), &properties)
|
||||
.expect("object new")
|
||||
.downcast()
|
||||
.expect("downcast")
|
||||
}
|
||||
|
||||
pub fn code(mut self, code: &str) -> Self {
|
||||
self.code = Some(code.to_string());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub const NONE_LANGUAGE: Option<&Language> = None;
|
||||
|
||||
pub trait LanguageExt: 'static {
|
||||
fn get_code(&self) -> Option<GString>;
|
||||
|
||||
fn get_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_territory(&self) -> Option<GString>;
|
||||
|
||||
fn matches(&self, code: &str) -> bool;
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_territory_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
impl<O: IsA<Language>> LanguageExt for O {
|
||||
fn get_code(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_language_get_code(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_language_get_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_territory(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_language_get_territory(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn matches(&self, code: &str) -> bool {
|
||||
unsafe {
|
||||
from_glib(light_dm_sys::lightdm_language_matches(
|
||||
self.as_ref().to_glib_none().0,
|
||||
code.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_name_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMLanguage,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<Language>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&Language::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::name\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_name_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_territory_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_territory_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMLanguage,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<Language>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&Language::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::territory\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_territory_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Language {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Language")
|
||||
}
|
||||
}
|
107
src/auto/layout.rs
Normal file
107
src/auto/layout.rs
Normal file
@@ -0,0 +1,107 @@
|
||||
// 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::object::Cast;
|
||||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use glib::GString;
|
||||
use glib::StaticType;
|
||||
use glib::ToValue;
|
||||
use light_dm_sys;
|
||||
use std::fmt;
|
||||
|
||||
glib_wrapper! {
|
||||
pub struct Layout(Object<light_dm_sys::LightDMLayout, light_dm_sys::LightDMLayoutClass, LayoutClass>);
|
||||
|
||||
match fn {
|
||||
get_type => || light_dm_sys::lightdm_layout_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct LayoutBuilder {
|
||||
description: Option<String>,
|
||||
name: Option<String>,
|
||||
short_description: Option<String>,
|
||||
}
|
||||
|
||||
impl LayoutBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn build(self) -> Layout {
|
||||
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
|
||||
if let Some(ref description) = self.description {
|
||||
properties.push(("description", description));
|
||||
}
|
||||
if let Some(ref name) = self.name {
|
||||
properties.push(("name", name));
|
||||
}
|
||||
if let Some(ref short_description) = self.short_description {
|
||||
properties.push(("short-description", short_description));
|
||||
}
|
||||
glib::Object::new(Layout::static_type(), &properties)
|
||||
.expect("object new")
|
||||
.downcast()
|
||||
.expect("downcast")
|
||||
}
|
||||
|
||||
pub fn description(mut self, description: &str) -> Self {
|
||||
self.description = Some(description.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn name(mut self, name: &str) -> Self {
|
||||
self.name = Some(name.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn short_description(mut self, short_description: &str) -> Self {
|
||||
self.short_description = Some(short_description.to_string());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub const NONE_LAYOUT: Option<&Layout> = None;
|
||||
|
||||
pub trait LayoutExt: 'static {
|
||||
fn get_description(&self) -> Option<GString>;
|
||||
|
||||
fn get_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_short_description(&self) -> Option<GString>;
|
||||
}
|
||||
|
||||
impl<O: IsA<Layout>> LayoutExt for O {
|
||||
fn get_description(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_layout_get_description(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_layout_get_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_short_description(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_layout_get_short_description(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Layout {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Layout")
|
||||
}
|
||||
}
|
58
src/auto/mod.rs
Normal file
58
src/auto/mod.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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
|
||||
|
||||
mod greeter;
|
||||
pub use self::greeter::GreeterExt;
|
||||
pub use self::greeter::{Greeter, GreeterClass, NONE_GREETER};
|
||||
|
||||
mod language;
|
||||
pub use self::language::LanguageBuilder;
|
||||
pub use self::language::LanguageExt;
|
||||
pub use self::language::{Language, LanguageClass, NONE_LANGUAGE};
|
||||
|
||||
mod layout;
|
||||
pub use self::layout::LayoutBuilder;
|
||||
pub use self::layout::LayoutExt;
|
||||
pub use self::layout::{Layout, LayoutClass, NONE_LAYOUT};
|
||||
|
||||
mod session;
|
||||
pub use self::session::SessionExt;
|
||||
pub use self::session::{Session, SessionClass, NONE_SESSION};
|
||||
|
||||
mod user;
|
||||
pub use self::user::UserExt;
|
||||
pub use self::user::{User, UserClass, NONE_USER};
|
||||
|
||||
mod user_list;
|
||||
pub use self::user_list::UserListExt;
|
||||
pub use self::user_list::{UserList, UserListClass, NONE_USER_LIST};
|
||||
|
||||
mod enums;
|
||||
pub use self::enums::GreeterError;
|
||||
pub use self::enums::MessageType;
|
||||
pub use self::enums::PromptType;
|
||||
|
||||
pub mod functions;
|
||||
|
||||
mod constants;
|
||||
pub use self::constants::GREETER_SIGNAL_AUTHENTICATION_COMPLETE;
|
||||
pub use self::constants::GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED;
|
||||
pub use self::constants::GREETER_SIGNAL_IDLE;
|
||||
pub use self::constants::GREETER_SIGNAL_RESET;
|
||||
pub use self::constants::GREETER_SIGNAL_SHOW_MESSAGE;
|
||||
pub use self::constants::GREETER_SIGNAL_SHOW_PROMPT;
|
||||
pub use self::constants::SIGNAL_USER_CHANGED;
|
||||
pub use self::constants::USER_LIST_SIGNAL_USER_ADDED;
|
||||
pub use self::constants::USER_LIST_SIGNAL_USER_CHANGED;
|
||||
pub use self::constants::USER_LIST_SIGNAL_USER_REMOVED;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod traits {
|
||||
pub use super::GreeterExt;
|
||||
pub use super::LanguageExt;
|
||||
pub use super::LayoutExt;
|
||||
pub use super::SessionExt;
|
||||
pub use super::UserExt;
|
||||
pub use super::UserListExt;
|
||||
}
|
153
src/auto/session.rs
Normal file
153
src/auto/session.rs
Normal file
@@ -0,0 +1,153 @@
|
||||
// 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::object::Cast;
|
||||
use glib::object::IsA;
|
||||
use glib::signal::connect_raw;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::translate::*;
|
||||
use glib::GString;
|
||||
use glib_sys;
|
||||
use light_dm_sys;
|
||||
use std::boxed::Box as Box_;
|
||||
use std::fmt;
|
||||
use std::mem::transmute;
|
||||
|
||||
glib_wrapper! {
|
||||
pub struct Session(Object<light_dm_sys::LightDMSession, light_dm_sys::LightDMSessionClass, SessionClass>);
|
||||
|
||||
match fn {
|
||||
get_type => || light_dm_sys::lightdm_session_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
pub const NONE_SESSION: Option<&Session> = None;
|
||||
|
||||
pub trait SessionExt: 'static {
|
||||
fn get_comment(&self) -> Option<GString>;
|
||||
|
||||
fn get_key(&self) -> Option<GString>;
|
||||
|
||||
fn get_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_session_type(&self) -> Option<GString>;
|
||||
|
||||
fn connect_property_comment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
impl<O: IsA<Session>> SessionExt for O {
|
||||
fn get_comment(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_session_get_comment(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_key(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_session_get_key(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_session_get_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_session_type(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_session_get_session_type(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_comment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_comment_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMSession,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<Session>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&Session::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::comment\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_comment_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_key_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMSession,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<Session>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&Session::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::key\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_key_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_name_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMSession,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<Session>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&Session::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::name\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_name_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Session {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Session")
|
||||
}
|
||||
}
|
574
src/auto/user.rs
Normal file
574
src/auto/user.rs
Normal file
@@ -0,0 +1,574 @@
|
||||
// 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::object::Cast;
|
||||
use glib::object::IsA;
|
||||
use glib::signal::connect_raw;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::translate::*;
|
||||
use glib::GString;
|
||||
use glib_sys;
|
||||
use light_dm_sys;
|
||||
use std::boxed::Box as Box_;
|
||||
use std::fmt;
|
||||
use std::mem::transmute;
|
||||
|
||||
glib_wrapper! {
|
||||
pub struct User(Object<light_dm_sys::LightDMUser, light_dm_sys::LightDMUserClass, UserClass>);
|
||||
|
||||
match fn {
|
||||
get_type => || light_dm_sys::lightdm_user_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
pub const NONE_USER: Option<&User> = None;
|
||||
|
||||
pub trait UserExt: 'static {
|
||||
fn get_background(&self) -> Option<GString>;
|
||||
|
||||
fn get_display_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_has_messages(&self) -> bool;
|
||||
|
||||
fn get_home_directory(&self) -> Option<GString>;
|
||||
|
||||
fn get_image(&self) -> Option<GString>;
|
||||
|
||||
fn get_is_locked(&self) -> bool;
|
||||
|
||||
fn get_language(&self) -> Option<GString>;
|
||||
|
||||
fn get_layout(&self) -> Option<GString>;
|
||||
|
||||
fn get_layouts(&self) -> Vec<GString>;
|
||||
|
||||
fn get_logged_in(&self) -> bool;
|
||||
|
||||
fn get_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_real_name(&self) -> Option<GString>;
|
||||
|
||||
fn get_session(&self) -> Option<GString>;
|
||||
|
||||
fn get_uid(&self) -> u32;
|
||||
|
||||
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_display_name_notify<F: Fn(&Self) + 'static>(&self, f: F)
|
||||
-> SignalHandlerId;
|
||||
|
||||
fn connect_property_has_messages_notify<F: Fn(&Self) + 'static>(&self, f: F)
|
||||
-> SignalHandlerId;
|
||||
|
||||
fn connect_property_home_directory_notify<F: Fn(&Self) + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_is_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_layouts_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_logged_in_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_real_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_session_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_uid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
impl<O: IsA<User>> UserExt for O {
|
||||
fn get_background(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_background(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_display_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_display_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_has_messages(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(light_dm_sys::lightdm_user_get_has_messages(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_home_directory(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_home_directory(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_image(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_image(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_is_locked(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(light_dm_sys::lightdm_user_get_is_locked(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_language(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_language(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_layout(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_layout(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_layouts(&self) -> Vec<GString> {
|
||||
unsafe {
|
||||
FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_user_get_layouts(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_logged_in(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(light_dm_sys::lightdm_user_get_logged_in(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_real_name(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_real_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_session(&self) -> Option<GString> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_get_session(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_uid(&self) -> u32 {
|
||||
unsafe { light_dm_sys::lightdm_user_get_uid(self.as_ref().to_glib_none().0) }
|
||||
}
|
||||
|
||||
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn changed_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"changed\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
changed_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_background_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::background\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_background_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_display_name_notify<F: Fn(&Self) + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_display_name_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::display-name\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_display_name_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_has_messages_notify<F: Fn(&Self) + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_has_messages_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::has-messages\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_has_messages_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_home_directory_notify<F: Fn(&Self) + 'static>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_home_directory_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::home-directory\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_home_directory_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_image_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::image\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_image_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_is_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_is_locked_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::is-locked\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_is_locked_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_language_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::language\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_language_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_layout_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::layout\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_layout_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_layouts_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_layouts_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::layouts\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_layouts_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_logged_in_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_logged_in_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::logged-in\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_logged_in_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_name_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::name\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_name_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_real_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_real_name_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::real-name\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_real_name_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_session_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_session_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::session\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_session_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_uid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_uid_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUser,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<User>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&User::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::uid\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_uid_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for User {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "User")
|
||||
}
|
||||
}
|
227
src/auto/user_list.rs
Normal file
227
src/auto/user_list.rs
Normal file
@@ -0,0 +1,227 @@
|
||||
// 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::object::Cast;
|
||||
use glib::object::IsA;
|
||||
use glib::signal::connect_raw;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::translate::*;
|
||||
use glib::StaticType;
|
||||
use glib::Value;
|
||||
use glib_sys;
|
||||
use gobject_sys;
|
||||
use light_dm_sys;
|
||||
use std::boxed::Box as Box_;
|
||||
use std::fmt;
|
||||
use std::mem::transmute;
|
||||
use User;
|
||||
|
||||
glib_wrapper! {
|
||||
pub struct UserList(Object<light_dm_sys::LightDMUserList, light_dm_sys::LightDMUserListClass, UserListClass>);
|
||||
|
||||
match fn {
|
||||
get_type => || light_dm_sys::lightdm_user_list_get_type(),
|
||||
}
|
||||
}
|
||||
|
||||
impl UserList {
|
||||
pub fn get_instance() -> Option<UserList> {
|
||||
unsafe { from_glib_none(light_dm_sys::lightdm_user_list_get_instance()) }
|
||||
}
|
||||
}
|
||||
|
||||
pub const NONE_USER_LIST: Option<&UserList> = None;
|
||||
|
||||
pub trait UserListExt: 'static {
|
||||
fn get_length(&self) -> i32;
|
||||
|
||||
fn get_user_by_name(&self, username: &str) -> Option<User>;
|
||||
|
||||
fn get_users(&self) -> Vec<User>;
|
||||
|
||||
fn get_property_num_users(&self) -> i32;
|
||||
|
||||
fn connect_user_added<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_user_changed<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_user_removed<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
|
||||
fn connect_property_num_users_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
impl<O: IsA<UserList>> UserListExt for O {
|
||||
fn get_length(&self) -> i32 {
|
||||
unsafe { light_dm_sys::lightdm_user_list_get_length(self.as_ref().to_glib_none().0) }
|
||||
}
|
||||
|
||||
fn get_user_by_name(&self, username: &str) -> Option<User> {
|
||||
unsafe {
|
||||
from_glib_none(light_dm_sys::lightdm_user_list_get_user_by_name(
|
||||
self.as_ref().to_glib_none().0,
|
||||
username.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_users(&self) -> Vec<User> {
|
||||
unsafe {
|
||||
FromGlibPtrContainer::from_glib_none(light_dm_sys::lightdm_user_list_get_users(
|
||||
self.as_ref().to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_property_num_users(&self) -> i32 {
|
||||
unsafe {
|
||||
let mut value = Value::from_type(<i32 as StaticType>::static_type());
|
||||
gobject_sys::g_object_get_property(
|
||||
self.to_glib_none().0 as *mut gobject_sys::GObject,
|
||||
b"num-users\0".as_ptr() as *const _,
|
||||
value.to_glib_none_mut().0,
|
||||
);
|
||||
value
|
||||
.get()
|
||||
.expect("Return Value for property `num-users` getter")
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_user_added<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn user_added_trampoline<P, F: Fn(&P, &User) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUserList,
|
||||
user: *mut light_dm_sys::LightDMUser,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<UserList>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
&UserList::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
&from_glib_borrow(user),
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"user-added\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
user_added_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_user_changed<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn user_changed_trampoline<P, F: Fn(&P, &User) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUserList,
|
||||
user: *mut light_dm_sys::LightDMUser,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<UserList>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
&UserList::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
&from_glib_borrow(user),
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"user-changed\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
user_changed_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_user_removed<F: Fn(&Self, &User) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn user_removed_trampoline<P, F: Fn(&P, &User) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUserList,
|
||||
user: *mut light_dm_sys::LightDMUser,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<UserList>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(
|
||||
&UserList::from_glib_borrow(this).unsafe_cast_ref(),
|
||||
&from_glib_borrow(user),
|
||||
)
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"user-removed\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
user_removed_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_length_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUserList,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<UserList>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&UserList::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::length\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_length_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn connect_property_num_users_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn notify_num_users_trampoline<P, F: Fn(&P) + 'static>(
|
||||
this: *mut light_dm_sys::LightDMUserList,
|
||||
_param_spec: glib_sys::gpointer,
|
||||
f: glib_sys::gpointer,
|
||||
) where
|
||||
P: IsA<UserList>,
|
||||
{
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&UserList::from_glib_borrow(this).unsafe_cast_ref())
|
||||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::num-users\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
notify_num_users_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for UserList {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "UserList")
|
||||
}
|
||||
}
|
2
src/auto/versions.txt
Normal file
2
src/auto/versions.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Generated by gir (https://github.com/gtk-rs/gir @ 2abca11)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ b89185a)
|
13
src/lib.rs
Normal file
13
src/lib.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
#[macro_use]
|
||||
extern crate glib;
|
||||
extern crate gio;
|
||||
extern crate gio_sys;
|
||||
extern crate glib_sys;
|
||||
extern crate gobject_sys;
|
||||
extern crate light_dm_sys;
|
||||
|
||||
extern crate libc;
|
||||
|
||||
pub use auto::*;
|
||||
|
||||
mod auto;
|
Reference in New Issue
Block a user