Skip to content

Commit

Permalink
gtk: Don't generate getter/setter for Calendar.[day|month|year]
Browse files Browse the repository at this point in the history
As they have getters/setters in v4_14, so only generate a fallback
getter/setter
if that feature is not enabled
  • Loading branch information
bilelmoussaoui committed Mar 6, 2024
1 parent d76619b commit 62f9d66
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 24 deletions.
3 changes: 3 additions & 0 deletions gtk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ status = "generate"
[[object.function]]
name = "get_day_is_marked"
rename = "day_is_marked"
[[object.property]]
pattern = "(day|month|year)"
generate = ["notify"]

[[object]]
name = "Gtk.CallbackAction"
Expand Down
24 changes: 0 additions & 24 deletions gtk4/src/auto/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,30 +175,6 @@ impl Calendar {
}
}

pub fn get_property_day(&self) -> i32 {
ObjectExt::property(self, "day")
}

pub fn set_property_day(&self, day: i32) {
ObjectExt::set_property(self, "day", day)
}

pub fn get_property_month(&self) -> i32 {
ObjectExt::property(self, "month")
}

pub fn set_property_month(&self, month: i32) {
ObjectExt::set_property(self, "month", month)
}

pub fn get_property_year(&self) -> i32 {
ObjectExt::property(self, "year")
}

pub fn set_property_year(&self, year: i32) {
ObjectExt::set_property(self, "year", year)
}

#[doc(alias = "day-selected")]
pub fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn day_selected_trampoline<F: Fn(&Calendar) + 'static>(
Expand Down
43 changes: 43 additions & 0 deletions gtk4/src/calendar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::Calendar;
#[cfg(not(feature = "v4_14"))]
use glib::prelude::*;

impl Calendar {
#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn day(&self) -> i32 {
ObjectExt::property(self, "day")
}

#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn set_day(&self, day: i32) {
ObjectExt::set_property(self, "day", day)
}

#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn month(&self) -> i32 {
ObjectExt::property(self, "month")
}

#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn set_month(&self, month: i32) {
ObjectExt::set_property(self, "month", month)
}

#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn year(&self) -> i32 {
ObjectExt::property(self, "year")
}

#[cfg(not(feature = "v4_14"))]
#[cfg_attr(docsrs, doc(cfg(not(feature = "v4_14"))))]
pub fn set_year(&self, year: i32) {
ObjectExt::set_property(self, "year", year)
}
}
1 change: 1 addition & 0 deletions gtk4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ mod border;
mod builder;
mod builder_cscope;
mod builder_rust_scope;
mod calendar;
mod callback_action;
mod cell_area;
mod cell_layout;
Expand Down

0 comments on commit 62f9d66

Please sign in to comment.