Fix calendar months being indexed by 0 (fixes #544)
This commit is contained in:
parent
44a8331417
commit
bf532e63cc
2 changed files with 17 additions and 2 deletions
|
@ -5,6 +5,9 @@ All notable changes to eww will be listed here, starting at changes since versio
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### BREAKING CHANGES
|
||||
- Change `calendar`-widget to index months starting at 1 rather than indexed from 0
|
||||
|
||||
### Features
|
||||
- Add support for output names in X11 to select `:monitor`.
|
||||
|
||||
|
|
|
@ -904,9 +904,21 @@ fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result<gtk::Calendar> {
|
|||
let gtk_widget = gtk::Calendar::new();
|
||||
def_widget!(bargs, _g, gtk_widget, {
|
||||
// @prop day - the selected day
|
||||
prop(day: as_f64) { gtk_widget.set_day(day as i32) },
|
||||
prop(day: as_f64) {
|
||||
if day < 1f64 || day > 31f64 {
|
||||
log::warn!("Calendar day is not a number between 1 and 31");
|
||||
} else {
|
||||
gtk_widget.set_day(day as i32)
|
||||
}
|
||||
},
|
||||
// @prop month - the selected month
|
||||
prop(month: as_f64) { gtk_widget.set_month(month as i32) },
|
||||
prop(month: as_f64) {
|
||||
if month < 1f64 || month > 12f64 {
|
||||
log::warn!("Calendar month is not a number between 1 and 12");
|
||||
} else {
|
||||
gtk_widget.set_month(month as i32 - 1)
|
||||
}
|
||||
},
|
||||
// @prop year - the selected year
|
||||
prop(year: as_f64) { gtk_widget.set_year(year as i32) },
|
||||
// @prop show-details - show details
|
||||
|
|
Loading…
Add table
Reference in a new issue