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:
committed by
Hari Rana
parent
3a93a4004d
commit
3a544b22fc
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user