Skip to content

Commit 62f9d66

Browse files
gtk: Don't generate getter/setter for Calendar.[day|month|year]
As they have getters/setters in v4_14, so only generate a fallback getter/setter if that feature is not enabled
1 parent d76619b commit 62f9d66

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed

gtk4/Gir.toml

+3
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,9 @@ status = "generate"
707707
[[object.function]]
708708
name = "get_day_is_marked"
709709
rename = "day_is_marked"
710+
[[object.property]]
711+
pattern = "(day|month|year)"
712+
generate = ["notify"]
710713

711714
[[object]]
712715
name = "Gtk.CallbackAction"

gtk4/src/auto/calendar.rs

-24
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,6 @@ impl Calendar {
175175
}
176176
}
177177

178-
pub fn get_property_day(&self) -> i32 {
179-
ObjectExt::property(self, "day")
180-
}
181-
182-
pub fn set_property_day(&self, day: i32) {
183-
ObjectExt::set_property(self, "day", day)
184-
}
185-
186-
pub fn get_property_month(&self) -> i32 {
187-
ObjectExt::property(self, "month")
188-
}
189-
190-
pub fn set_property_month(&self, month: i32) {
191-
ObjectExt::set_property(self, "month", month)
192-
}
193-
194-
pub fn get_property_year(&self) -> i32 {
195-
ObjectExt::property(self, "year")
196-
}
197-
198-
pub fn set_property_year(&self, year: i32) {
199-
ObjectExt::set_property(self, "year", year)
200-
}
201-
202178
#[doc(alias = "day-selected")]
203179
pub fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
204180
unsafe extern "C" fn day_selected_trampoline<F: Fn(&Calendar) + 'static>(

gtk4/src/calendar.rs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::Calendar;
4+
#[cfg(not(feature = "v4_14"))]
5+
use glib::prelude::*;
6+
7+
impl Calendar {
8+
#[cfg(not(feature = "v4_14"))]
9+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
10+
pub fn day(&self) -> i32 {
11+
ObjectExt::property(self, "day")
12+
}
13+
14+
#[cfg(not(feature = "v4_14"))]
15+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
16+
pub fn set_day(&self, day: i32) {
17+
ObjectExt::set_property(self, "day", day)
18+
}
19+
20+
#[cfg(not(feature = "v4_14"))]
21+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
22+
pub fn month(&self) -> i32 {
23+
ObjectExt::property(self, "month")
24+
}
25+
26+
#[cfg(not(feature = "v4_14"))]
27+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
28+
pub fn set_month(&self, month: i32) {
29+
ObjectExt::set_property(self, "month", month)
30+
}
31+
32+
#[cfg(not(feature = "v4_14"))]
33+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
34+
pub fn year(&self) -> i32 {
35+
ObjectExt::property(self, "year")
36+
}
37+
38+
#[cfg(not(feature = "v4_14"))]
39+
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
40+
pub fn set_year(&self, year: i32) {
41+
ObjectExt::set_property(self, "year", year)
42+
}
43+
}

gtk4/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ mod border;
111111
mod builder;
112112
mod builder_cscope;
113113
mod builder_rust_scope;
114+
mod calendar;
114115
mod callback_action;
115116
mod cell_area;
116117
mod cell_layout;

0 commit comments

Comments
 (0)