week-view: Add tooltip to the all day events expander

This adds a tooltip to the all day events expander button,
indicating whether the expander will expand or collapse
upon activation.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1449

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/637>
This commit is contained in:
Lukáš Tyrychtr
2025-10-17 13:59:26 -04:00
committed by Hari Rana
parent 3a93a4004d
commit 3a544b22fc
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@ template $GcalWeekView: Box {
ToggleButton {
visible: bind header.can-expand;
active: bind header.expanded bidirectional;
tooltip-text: bind $get_header_state_tooltip(header.expanded) as <string>;
hexpand: true;
halign: center;
valign: end;
+11
View File
@@ -233,6 +233,16 @@ restore_zoom_level (GcalWeekView *self)
/* Callbacks */
static gchar*
get_header_state_tooltip (GcalWeekView *self,
gboolean expanded)
{
if (expanded)
return g_strdup (_("Hide Additional Events"));
else
return g_strdup (_("Show Additional Events"));
}
static void
on_event_activated (GcalWeekView *self,
GtkWidget *widget)
@@ -652,6 +662,7 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, scrolled_window);
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, week_grid);
gtk_widget_class_bind_template_callback (widget_class, get_header_state_tooltip);
gtk_widget_class_bind_template_callback (widget_class, on_event_activated);
gtk_widget_class_bind_template_callback (widget_class, on_motion_controller_enter_cb);
gtk_widget_class_bind_template_callback (widget_class, on_motion_controller_motion_cb);