Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to gio 0.19 #5

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ syn = "2.0"
deluxe = "0.5"

[dev-dependencies]
gio = "0.18"
gio = "0.19"
serial_test = "2.0"
10 changes: 5 additions & 5 deletions src/generators/bitflag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ fn bitflag_token_stream(
}
}

impl gio::glib::StaticVariantType for #ident {
impl gio::glib::prelude::StaticVariantType for #ident {
SeaDve marked this conversation as resolved.
Show resolved Hide resolved
fn static_variant_type() -> std::borrow::Cow<'static, gio::glib::VariantTy> {
std::borrow::Cow::Borrowed(gio::glib::VariantTy::STRING_ARRAY)
}
}

impl gio::glib::FromVariant for #ident {
impl gio::glib::prelude::FromVariant for #ident {
fn from_variant(variant: &gio::glib::Variant) -> Option<Self> {
let mut this = Self::empty();

Expand All @@ -96,19 +96,19 @@ fn bitflag_token_stream(
}
}

impl gio::glib::ToVariant for #ident {
impl gio::glib::prelude::ToVariant for #ident {
fn to_variant(&self) -> gio::glib::Variant {
let mut string_array = Vec::new();

#(#to_variant_arms)*

gio::glib::ToVariant::to_variant(&string_array)
gio::glib::prelude::ToVariant::to_variant(&string_array)
}
}

impl std::convert::From<#ident> for gio::glib::Variant {
fn from(this: #ident) -> gio::glib::Variant {
gio::glib::ToVariant::to_variant(&this)
gio::glib::prelude::ToVariant::to_variant(&this)
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ impl Context {
}

/// Creates an enum with given name and (variant name, variant value) tuple. It implements
/// [`FromVariant`](gio::glib::FromVariant), [`ToVariant`](gio::glib::ToVariant),
/// and [`StaticVariantType`](gio::glib::StaticVariantType).
/// [`FromVariant`](gio::glib::prelude::FromVariant), [`ToVariant`](gio::glib::prelude::ToVariant),
/// and [`StaticVariantType`](gio::glib::prelude::StaticVariantType).
///
/// The input names are converted to pascal case
fn new_variant_enum(
Expand Down Expand Up @@ -386,7 +386,7 @@ fn new_variant_enum(
.zip(variant_idents.iter())
.map(|(variant_name, variant_ident)| {
quote! {
Self::#variant_ident => gio::glib::ToVariant::to_variant(#variant_name)
Self::#variant_ident => gio::glib::prelude::ToVariant::to_variant(#variant_name)
}
});

Expand All @@ -400,13 +400,13 @@ fn new_variant_enum(
#(#variant_arms),*
}

impl gio::glib::StaticVariantType for #ident {
impl gio::glib::prelude::StaticVariantType for #ident {
fn static_variant_type() -> std::borrow::Cow<'static, gio::glib::VariantTy> {
std::borrow::Cow::Borrowed(gio::glib::VariantTy::STRING)
}
}

impl gio::glib::FromVariant for #ident {
impl gio::glib::prelude::FromVariant for #ident {
fn from_variant(variant: &gio::glib::Variant) -> Option<Self> {
match variant.get::<String>()?.as_str() {
#(#from_variant_arms),*,
Expand All @@ -415,7 +415,7 @@ fn new_variant_enum(
}
}

impl gio::glib::ToVariant for #ident {
impl gio::glib::prelude::ToVariant for #ident {
fn to_variant(&self) -> gio::glib::Variant {
match self {
#(#to_variant_arms),*
Expand All @@ -425,7 +425,7 @@ fn new_variant_enum(

impl std::convert::From<#ident> for gio::glib::Variant {
fn from(this: #ident) -> gio::glib::Variant {
gio::glib::ToVariant::to_variant(&this)
gio::glib::prelude::ToVariant::to_variant(&this)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use gio::{
glib::{self, FromVariant, StaticVariantType, ToVariant, VariantTy},
glib::{self, VariantTy},
prelude::*,
};
use gsettings_macro::gen_settings;
Expand Down
Loading