Skip to content

Commit

Permalink
chore: update bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton committed Aug 31, 2023
1 parent 63202f7 commit cd09ed3
Show file tree
Hide file tree
Showing 112 changed files with 2,812 additions and 5,106 deletions.
188 changes: 74 additions & 114 deletions Cargo.lock

Large diffs are not rendered by default.

1,381 changes: 467 additions & 914 deletions He-1.gir

Large diffs are not rendered by default.

25 changes: 9 additions & 16 deletions fusebox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,46 @@ keywords = ["gtk4-rs", "tauos", "GUI"]
name = "fusebox"

[features]
dox = [
"glib/dox",
"gio/dox",
"gdk-pixbuf/dox",
"pango/dox",
"gdk/dox",
"gtk/dox",
"ffi/dox",
]
gtk_v4_2 = []
gtk_v4_4 = ["gtk_v4_2"]
gtk_v4_6 = ["gtk_v4_4"]
gtk_v4_8 = ["gtk_v4_6"]
gtk_v4_10 = ["gtk_v4_8"]

[package.metadata.docs.rs]
features = ["dox"]

[dependencies]
bitflags = '1.0'
bitflags = '2.4.0'
libc = '0.2'
once_cell = "1.8"
futures-channel = "0.3"

[dependencies.glib]
git = "https://github.com/gtk-rs/gtk-rs-core"
version = "0.18.0"
version = "0.19"

[dependencies.gio]
git = "https://github.com/gtk-rs/gtk-rs-core"
version = "0.18.0"
version = "0.19"

[dependencies.gdk-pixbuf]
git = "https://github.com/gtk-rs/gtk-rs-core"
version = "0.18.0"
version = "0.19"

[dependencies.pango]
git = "https://github.com/gtk-rs/gtk-rs-core"
version = "0.18.0"
version = "0.19"

[dependencies.gdk]
package = "gdk4"
git = "https://github.com/gtk-rs/gtk4-rs"
version = "0.7.0"
version = "0.8"

[dependencies.gtk]
package = "gtk4"
git = "https://github.com/gtk-rs/gtk4-rs"
version = "0.7.0"
version = "0.8"

[dependencies.ffi]
package = "fusebox-sys"
Expand Down
26 changes: 5 additions & 21 deletions fusebox/src/auto/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use glib::{translate::*, value::FromValue, value::ToValue, StaticType, Type};
use std::fmt;
use glib::{prelude::*, translate::*};

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
Expand All @@ -22,22 +21,6 @@ pub enum FuseCategory {
__Unknown(i32),
}

impl fmt::Display for FuseCategory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"FuseCategory::{}",
match *self {
Self::Network => "Network",
Self::Personal => "Personal",
Self::System => "System",
Self::Custom => "Custom",
_ => "Unknown",
}
)
}
}

#[doc(hidden)]
impl IntoGlib for FuseCategory {
type GlibType = ffi::FuseboxFuseCategory;
Expand Down Expand Up @@ -72,7 +55,8 @@ impl FromGlib<ffi::FuseboxFuseCategory> for FuseCategory {

impl StaticType for FuseCategory {
#[inline]
fn static_type() -> Type {
#[doc(alias = "fusebox_fuse_category_get_type")]
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::fusebox_fuse_category_get_type()) }
}
}
Expand All @@ -83,15 +67,15 @@ impl glib::HasParamSpec for FuseCategory {
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

fn param_spec_builder() -> Self::BuilderFn {
|name, default_value| Self::ParamSpec::builder_with_default(name, default_value)
Self::ParamSpec::builder_with_default
}
}

impl glib::value::ValueType for FuseCategory {
type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FuseCategory {
unsafe impl<'a> glib::value::FromValue<'a> for FuseCategory {
type Checker = glib::value::GenericValueTypeChecker<Self>;

#[inline]
Expand Down
93 changes: 31 additions & 62 deletions fusebox/src/auto/fuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use glib::{
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, fmt, mem::transmute};
use std::boxed::Box as Box_;

glib::wrapper! {
#[doc(alias = "FuseboxFuse")]
Expand All @@ -24,83 +24,38 @@ impl Fuse {
pub const NONE: Option<&'static Fuse> = None;
}

pub trait FuseExt: 'static {
#[doc(alias = "fusebox_fuse_get_widget")]
#[doc(alias = "get_widget")]
fn widget(&self) -> gtk::Widget;

#[doc(alias = "fusebox_fuse_shown")]
fn shown(&self);

#[doc(alias = "fusebox_fuse_hidden")]
fn hidden(&self);

//#[doc(alias = "fusebox_fuse_search")]
//fn search(&self, search: &str, _callback_: AsyncReadyCallback);

#[doc(alias = "fusebox_fuse_search_callback")]
fn search_callback(&self, location: &str);

#[doc(alias = "fusebox_fuse_get_category")]
#[doc(alias = "get_category")]
fn category(&self) -> FuseCategory;

#[doc(alias = "fusebox_fuse_get_index")]
#[doc(alias = "get_index")]
fn index(&self) -> i32;

#[doc(alias = "fusebox_fuse_get_code_name")]
#[doc(alias = "get_code_name")]
fn code_name(&self) -> glib::GString;

#[doc(alias = "fusebox_fuse_get_display_name")]
#[doc(alias = "get_display_name")]
fn display_name(&self) -> glib::GString;

#[doc(alias = "fusebox_fuse_get_description")]
#[doc(alias = "get_description")]
fn description(&self) -> glib::GString;

#[doc(alias = "fusebox_fuse_get_icon")]
#[doc(alias = "get_icon")]
fn icon(&self) -> glib::GString;

//#[doc(alias = "fusebox_fuse_get_supported_settings")]
//#[doc(alias = "get_supported_settings")]
//fn supported_settings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 };

#[doc(alias = "fusebox_fuse_get_can_show")]
#[doc(alias = "get_can_show")]
fn can_show(&self) -> bool;

#[doc(alias = "fusebox_fuse_set_can_show")]
fn set_can_show(&self, value: bool);

#[doc(alias = "can-show")]
fn connect_can_show_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Fuse>> Sealed for T {}
}

impl<O: IsA<Fuse>> FuseExt for O {
pub trait FuseExt: IsA<Fuse> + sealed::Sealed + 'static {
#[doc(alias = "fusebox_fuse_get_widget")]
#[doc(alias = "get_widget")]
fn widget(&self) -> gtk::Widget {
unsafe { from_glib_full(ffi::fusebox_fuse_get_widget(self.as_ref().to_glib_none().0)) }
}

#[doc(alias = "fusebox_fuse_shown")]
fn shown(&self) {
unsafe {
ffi::fusebox_fuse_shown(self.as_ref().to_glib_none().0);
}
}

#[doc(alias = "fusebox_fuse_hidden")]
fn hidden(&self) {
unsafe {
ffi::fusebox_fuse_hidden(self.as_ref().to_glib_none().0);
}
}

//#[doc(alias = "fusebox_fuse_search")]
//fn search(&self, search: &str, _callback_: AsyncReadyCallback) {
// unsafe { TODO: call ffi:fusebox_fuse_search() }
//}

#[doc(alias = "fusebox_fuse_search_callback")]
fn search_callback(&self, location: &str) {
unsafe {
ffi::fusebox_fuse_search_callback(
Expand All @@ -110,6 +65,8 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_get_category")]
#[doc(alias = "get_category")]
fn category(&self) -> FuseCategory {
unsafe {
from_glib(ffi::fusebox_fuse_get_category(
Expand All @@ -118,10 +75,14 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_get_index")]
#[doc(alias = "get_index")]
fn index(&self) -> i32 {
unsafe { ffi::fusebox_fuse_get_index(self.as_ref().to_glib_none().0) }
}

#[doc(alias = "fusebox_fuse_get_code_name")]
#[doc(alias = "get_code_name")]
fn code_name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::fusebox_fuse_get_code_name(
Expand All @@ -130,6 +91,8 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_get_display_name")]
#[doc(alias = "get_display_name")]
fn display_name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::fusebox_fuse_get_display_name(
Expand All @@ -138,6 +101,8 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_get_description")]
#[doc(alias = "get_description")]
fn description(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::fusebox_fuse_get_description(
Expand All @@ -146,14 +111,20 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_get_icon")]
#[doc(alias = "get_icon")]
fn icon(&self) -> glib::GString {
unsafe { from_glib_none(ffi::fusebox_fuse_get_icon(self.as_ref().to_glib_none().0)) }
}

//#[doc(alias = "fusebox_fuse_get_supported_settings")]
//#[doc(alias = "get_supported_settings")]
//fn supported_settings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
// unsafe { TODO: call ffi:fusebox_fuse_get_supported_settings() }
//}

#[doc(alias = "fusebox_fuse_get_can_show")]
#[doc(alias = "get_can_show")]
fn can_show(&self) -> bool {
unsafe {
from_glib(ffi::fusebox_fuse_get_can_show(
Expand All @@ -162,12 +133,14 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

#[doc(alias = "fusebox_fuse_set_can_show")]
fn set_can_show(&self, value: bool) {
unsafe {
ffi::fusebox_fuse_set_can_show(self.as_ref().to_glib_none().0, value.into_glib());
}
}

#[doc(alias = "can-show")]
fn connect_can_show_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_can_show_trampoline<P: IsA<Fuse>, F: Fn(&P) + 'static>(
this: *mut ffi::FuseboxFuse,
Expand All @@ -182,7 +155,7 @@ impl<O: IsA<Fuse>> FuseExt for O {
connect_raw(
self.as_ptr() as *mut _,
b"notify::can-show\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
notify_can_show_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
Expand All @@ -191,8 +164,4 @@ impl<O: IsA<Fuse>> FuseExt for O {
}
}

impl fmt::Display for Fuse {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("Fuse")
}
}
impl<O: IsA<Fuse>> FuseExt for O {}
29 changes: 11 additions & 18 deletions fusebox/src/auto/fuses_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use glib::{
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, fmt, mem::transmute};
use std::boxed::Box as Box_;

glib::wrapper! {
#[doc(alias = "FuseboxFusesManager")]
Expand All @@ -32,19 +32,13 @@ impl FusesManager {
}
}

pub trait FusesManagerExt: 'static {
#[doc(alias = "fusebox_fuses_manager_has_fuses")]
fn has_fuses(&self) -> bool;

#[doc(alias = "fusebox_fuses_manager_get_fuses")]
#[doc(alias = "get_fuses")]
fn fuses(&self) -> Vec<Fuse>;

#[doc(alias = "fuse-added")]
fn connect_fuse_added<F: Fn(&Self, &Fuse) + 'static>(&self, f: F) -> SignalHandlerId;
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::FusesManager>> Sealed for T {}
}

impl<O: IsA<FusesManager>> FusesManagerExt for O {
pub trait FusesManagerExt: IsA<FusesManager> + sealed::Sealed + 'static {
#[doc(alias = "fusebox_fuses_manager_has_fuses")]
fn has_fuses(&self) -> bool {
unsafe {
from_glib(ffi::fusebox_fuses_manager_has_fuses(
Expand All @@ -53,6 +47,8 @@ impl<O: IsA<FusesManager>> FusesManagerExt for O {
}
}

#[doc(alias = "fusebox_fuses_manager_get_fuses")]
#[doc(alias = "get_fuses")]
fn fuses(&self) -> Vec<Fuse> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::fusebox_fuses_manager_get_fuses(
Expand All @@ -61,6 +57,7 @@ impl<O: IsA<FusesManager>> FusesManagerExt for O {
}
}

#[doc(alias = "fuse-added")]
fn connect_fuse_added<F: Fn(&Self, &Fuse) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn fuse_added_trampoline<
P: IsA<FusesManager>,
Expand All @@ -81,7 +78,7 @@ impl<O: IsA<FusesManager>> FusesManagerExt for O {
connect_raw(
self.as_ptr() as *mut _,
b"fuse-added\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
fuse_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
Expand All @@ -90,8 +87,4 @@ impl<O: IsA<FusesManager>> FusesManagerExt for O {
}
}

impl fmt::Display for FusesManager {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("FusesManager")
}
}
impl<O: IsA<FusesManager>> FusesManagerExt for O {}
Loading

0 comments on commit cd09ed3

Please sign in to comment.