-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add glib::gobject:{TypePlugin,TypeModule,InterfaceInfo,TypeInfo,EnumV…
…alue,FlagsValue,TypeValueTable,TypeFlags} Signed-off-by: fbrouille <[email protected]>
- Loading branch information
Showing
12 changed files
with
376 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// 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 crate::{ | ||
prelude::*, translate::*, EnumValue, FlagsValue, InterfaceInfo, TypeFlags, TypeInfo, TypePlugin, | ||
}; | ||
use std::fmt; | ||
|
||
crate::wrapper! { | ||
#[doc(alias = "GTypeModule")] | ||
pub struct TypeModule(Object<gobject_ffi::GTypeModule, gobject_ffi::GTypeModuleClass>) @implements TypePlugin; | ||
|
||
match fn { | ||
type_ => || gobject_ffi::g_type_module_get_type(), | ||
} | ||
} | ||
|
||
impl TypeModule { | ||
pub const NONE: Option<&'static TypeModule> = None; | ||
} | ||
|
||
mod sealed { | ||
pub trait Sealed {} | ||
impl<T: super::IsA<super::TypeModule>> Sealed for T {} | ||
} | ||
|
||
pub trait TypeModuleExt: IsA<TypeModule> + sealed::Sealed + 'static { | ||
#[doc(alias = "g_type_module_add_interface")] | ||
fn add_interface( | ||
&self, | ||
instance_type: crate::types::Type, | ||
interface_type: crate::types::Type, | ||
interface_info: &InterfaceInfo, | ||
) { | ||
unsafe { | ||
gobject_ffi::g_type_module_add_interface( | ||
self.as_ref().to_glib_none().0, | ||
instance_type.into_glib(), | ||
interface_type.into_glib(), | ||
interface_info.to_glib_none().0, | ||
); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_register_enum")] | ||
fn register_enum(&self, name: &str, const_static_values: &EnumValue) -> crate::types::Type { | ||
unsafe { | ||
from_glib(gobject_ffi::g_type_module_register_enum( | ||
self.as_ref().to_glib_none().0, | ||
name.to_glib_none().0, | ||
const_static_values.to_glib_none().0, | ||
)) | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_register_flags")] | ||
fn register_flags(&self, name: &str, const_static_values: &FlagsValue) -> crate::types::Type { | ||
unsafe { | ||
from_glib(gobject_ffi::g_type_module_register_flags( | ||
self.as_ref().to_glib_none().0, | ||
name.to_glib_none().0, | ||
const_static_values.to_glib_none().0, | ||
)) | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_register_type")] | ||
fn register_type( | ||
&self, | ||
parent_type: crate::types::Type, | ||
type_name: &str, | ||
type_info: &TypeInfo, | ||
flags: TypeFlags, | ||
) -> crate::types::Type { | ||
unsafe { | ||
from_glib(gobject_ffi::g_type_module_register_type( | ||
self.as_ref().to_glib_none().0, | ||
parent_type.into_glib(), | ||
type_name.to_glib_none().0, | ||
type_info.to_glib_none().0, | ||
flags.into_glib(), | ||
)) | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_set_name")] | ||
fn set_name(&self, name: &str) { | ||
unsafe { | ||
gobject_ffi::g_type_module_set_name( | ||
self.as_ref().to_glib_none().0, | ||
name.to_glib_none().0, | ||
); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_unuse")] | ||
fn unuse(&self) { | ||
unsafe { | ||
gobject_ffi::g_type_module_unuse(self.as_ref().to_glib_none().0); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_module_use")] | ||
#[doc(alias = "use")] | ||
fn use_(&self) -> bool { | ||
unsafe { | ||
from_glib(gobject_ffi::g_type_module_use( | ||
self.as_ref().to_glib_none().0, | ||
)) | ||
} | ||
} | ||
} | ||
|
||
impl<O: IsA<TypeModule>> TypeModuleExt for O {} | ||
|
||
impl fmt::Display for TypeModule { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
f.write_str("TypeModule") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// 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 crate::{prelude::*, translate::*, InterfaceInfo, TypeInfo, TypeValueTable}; | ||
use std::fmt; | ||
|
||
crate::wrapper! { | ||
#[doc(alias = "GTypePlugin")] | ||
pub struct TypePlugin(Interface<gobject_ffi::GTypePlugin, gobject_ffi::GTypePluginClass>); | ||
|
||
match fn { | ||
type_ => || gobject_ffi::g_type_plugin_get_type(), | ||
} | ||
} | ||
|
||
impl TypePlugin { | ||
pub const NONE: Option<&'static TypePlugin> = None; | ||
} | ||
|
||
mod sealed { | ||
pub trait Sealed {} | ||
impl<T: super::IsA<super::TypePlugin>> Sealed for T {} | ||
} | ||
|
||
pub trait TypePluginExt: IsA<TypePlugin> + sealed::Sealed + 'static { | ||
#[doc(alias = "g_type_plugin_complete_interface_info")] | ||
fn complete_interface_info( | ||
&self, | ||
instance_type: crate::types::Type, | ||
interface_type: crate::types::Type, | ||
info: &mut InterfaceInfo, | ||
) { | ||
unsafe { | ||
gobject_ffi::g_type_plugin_complete_interface_info( | ||
self.as_ref().to_glib_none().0, | ||
instance_type.into_glib(), | ||
interface_type.into_glib(), | ||
info.to_glib_none_mut().0, | ||
); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_plugin_complete_type_info")] | ||
fn complete_type_info( | ||
&self, | ||
g_type: crate::types::Type, | ||
info: &mut TypeInfo, | ||
value_table: &mut TypeValueTable, | ||
) { | ||
unsafe { | ||
gobject_ffi::g_type_plugin_complete_type_info( | ||
self.as_ref().to_glib_none().0, | ||
g_type.into_glib(), | ||
info.to_glib_none_mut().0, | ||
value_table.to_glib_none_mut().0, | ||
); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_plugin_unuse")] | ||
fn unuse(&self) { | ||
unsafe { | ||
gobject_ffi::g_type_plugin_unuse(self.as_ref().to_glib_none().0); | ||
} | ||
} | ||
|
||
#[doc(alias = "g_type_plugin_use")] | ||
#[doc(alias = "use")] | ||
fn use_(&self) { | ||
unsafe { | ||
gobject_ffi::g_type_plugin_use(self.as_ref().to_glib_none().0); | ||
} | ||
} | ||
} | ||
|
||
impl<O: IsA<TypePlugin>> TypePluginExt for O {} | ||
|
||
impl fmt::Display for TypePlugin { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
f.write_str("TypePlugin") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
wrapper! { | ||
#[derive(Debug)] | ||
#[doc(alias = "GInterfaceInfo")] | ||
pub struct InterfaceInfo(BoxedInline<gobject_ffi::GInterfaceInfo>); | ||
|
||
match fn { | ||
copy => |ptr| { | ||
let copy = ffi::g_malloc(std::mem::size_of::<gobject_ffi::GInterfaceInfo>()) as *mut gobject_ffi::GInterfaceInfo; | ||
std::ptr::copy_nonoverlapping(ptr, copy, 1); | ||
copy | ||
}, | ||
free => |ptr| ffi::g_free(ptr as *mut _), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
wrapper! { | ||
#[derive(Debug)] | ||
#[doc(alias = "GTypeInfo")] | ||
pub struct TypeInfo(BoxedInline<gobject_ffi::GTypeInfo>); | ||
|
||
match fn { | ||
copy => |ptr| { | ||
let copy = ffi::g_malloc(std::mem::size_of::<gobject_ffi::GTypeInfo>()) as *mut gobject_ffi::GTypeInfo; | ||
std::ptr::copy_nonoverlapping(ptr, copy, 1); | ||
copy | ||
}, | ||
free => |ptr| ffi::g_free(ptr as *mut _), | ||
} | ||
} |
Oops, something went wrong.