108 lines
2.8 KiB
Rust
108 lines
2.8 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::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")
|
|
}
|
|
}
|