Skip to content

Commit 571bcbc

Browse files
gtk: Implement HasParamSpec for Expression types
1 parent f06ff60 commit 571bcbc

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

gtk4/src/expression.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,5 +419,17 @@ macro_rules! define_expression {
419419
value
420420
}
421421
}
422+
423+
impl glib::HasParamSpec for $rust_type {
424+
type ParamSpec = crate::ParamSpecExpression;
425+
426+
type SetValue = $rust_type;
427+
428+
type BuilderFn = for<'a> fn(&'a str) -> crate::builders::ParamSpecExpressionBuilder<'a>;
429+
430+
fn param_spec_builder() -> Self::BuilderFn {
431+
Self::ParamSpec::builder
432+
}
433+
}
422434
};
423435
}

gtk4/src/param_spec_expression.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@
22

33
use std::marker::PhantomData;
44

5-
use crate::ParamSpecExpression;
5+
use crate::{Expression, ParamSpecExpression};
66

77
use glib::{
88
gobject_ffi, prelude::*, shared::Shared, translate::*, IntoGStr, IntoOptionalGStr, ParamSpec,
99
StaticType, Value,
1010
};
1111

12+
impl glib::HasParamSpec for Expression {
13+
type ParamSpec = ParamSpecExpression;
14+
15+
type SetValue = Expression;
16+
17+
type BuilderFn = for<'a> fn(&'a str) -> ParamSpecExpressionBuilder<'a>;
18+
19+
fn param_spec_builder() -> Self::BuilderFn {
20+
Self::ParamSpec::builder
21+
}
22+
}
23+
1224
impl std::fmt::Debug for ParamSpecExpression {
1325
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1426
f.write_str("ParamSpecExpression")

0 commit comments

Comments
 (0)