Skip to content
Draft
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
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ if gtk_dep.version().version_compare('>=4.19.1')
add_project_arguments(['--define=GTK_4_19_1'], language: 'vala')
endif

if gtk_dep.version().version_compare('>=4.20.0')
add_project_arguments(['--define=GTK_4_20_0'], language: 'vala')
endif

if meson.get_compiler('vala').version().version_compare('>=0.56.19')
add_project_arguments(['--define=VALAC_05619'], language: 'vala')
endif
Expand Down
34 changes: 25 additions & 9 deletions src/Dialogs/Composer/Schedule.vala
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ public class Tuba.Dialogs.Schedule : Adw.NavigationPage, Composer.PreferredSizea
minutes_spin_button.value = (double) iso8601_datetime.get_minute ();
seconds_spin_button.value = (double) iso8601_datetime.get_second ();

calendar.year = iso8601_datetime.get_year ();
calendar.month = iso8601_datetime.get_month () - 1;
calendar.day = iso8601_datetime.get_day_of_month ();
#if GTK_4_20_0
calendar.date = iso8601_datetime;
#else
calendar.year = iso8601_datetime.get_year ();
calendar.month = iso8601_datetime.get_month () - 1;
calendar.day = iso8601_datetime.get_day_of_month ();
#endif
}

if (button_label != null) schedule_button.label = button_label;
Expand All @@ -69,18 +73,30 @@ public class Tuba.Dialogs.Schedule : Adw.NavigationPage, Composer.PreferredSizea
GLib.DateTime now = new GLib.DateTime.now_utc ();
if (timezone_combo_row.selected != Gtk.INVALID_LIST_POSITION && ((Gtk.StringObject) timezone_combo_row.selected_item).string == "UTC") {
result_dt = new GLib.DateTime.utc (
calendar.year,
calendar.month + 1,
calendar.day,
#if GTK_4_20_0
calendar.date.get_year (),
calendar.date.get_month (),
calendar.date.get_day_of_month (),
#else
calendar.year,
calendar.month + 1,
calendar.day,
#endif
(int) hours_spin_button.value,
(int) minutes_spin_button.value,
seconds_spin_button.value
);
} else {
result_dt = new GLib.DateTime.local (
calendar.year,
calendar.month + 1,
calendar.day,
#if GTK_4_20_0
calendar.date.get_year (),
calendar.date.get_month (),
calendar.date.get_day_of_month (),
#else
calendar.year,
calendar.month + 1,
calendar.day,
#endif
(int) hours_spin_button.value,
(int) minutes_spin_button.value,
seconds_spin_button.value
Expand Down
48 changes: 39 additions & 9 deletions src/Views/Search.vala
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,19 @@ public class Tuba.Views.Search : Views.TabbedBase {

if (year > 0 && month > 0 && day > 0) {
before_expander_row.expanded = true;
before_calendar.year = year;
before_calendar.month = month;
before_calendar.day = day;

#if GTK_4_20_0
before_calendar.date = new GLib.DateTime.utc (
year,
month,
day,
0, 0 ,0
);
#else
before_calendar.year = year;
before_calendar.month = month;
before_calendar.day = day;
#endif
}
}
} else if (down_word.has_prefix ("during:")) {
Expand All @@ -438,9 +448,19 @@ public class Tuba.Views.Search : Views.TabbedBase {

if (year > 0 && month > 0 && day > 0) {
during_expander_row.expanded = true;
during_calendar.year = year;
during_calendar.month = month;
during_calendar.day = day;

#if GTK_4_20_0
during_calendar.date = new GLib.DateTime.utc (
year,
month,
day,
0, 0 ,0
);
#else
during_calendar.year = year;
during_calendar.month = month;
during_calendar.day = day;
#endif
}
}
} else if (down_word.has_prefix ("after:")) {
Expand All @@ -453,9 +473,19 @@ public class Tuba.Views.Search : Views.TabbedBase {

if (year > 0 && month > 0 && day > 0) {
after_expander_row.expanded = true;
after_calendar.year = year;
after_calendar.month = month;
after_calendar.day = day;

#if GTK_4_20_0
after_calendar.date = new GLib.DateTime.utc (
year,
month,
day,
0, 0 ,0
);
#else
after_calendar.year = year;
after_calendar.month = month;
after_calendar.day = day;
#endif
}
}
} else {
Expand Down
Loading