views: add time direction property

The time direction property tells which orientation one
needs to scroll to change the time of the view. In these
directions (up/down v left/right) the new prev/next
buttons will be pointing.

The two buttons will be added in a subsequent commit,
and will gain view-dependent tooltips.

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/542>
This commit is contained in:
Markus Göllnitz
2025-06-08 09:59:00 +00:00
committed by Marge Bot
parent d400048bc6
commit 4a4dce8ee3
6 changed files with 59 additions and 0 deletions
+33
View File
@@ -66,6 +66,19 @@ gcal_view_default_init (GcalViewInterface *iface)
GCAL_TYPE_CONTEXT,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
/**
* GcalView::time-direction:
*
* Orientation determining in which direction time is going for the view
*/
g_object_interface_install_property (iface,
g_param_spec_enum ("time-direction",
NULL,
NULL,
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_VERTICAL,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
/**
* GcalView::create-event:
*
@@ -148,6 +161,26 @@ gcal_view_get_context (GcalView *self)
return context;
}
/**
* gcal_view_get_time_direction:
* @self: a #GcalView
*
* Retrieves the orientation of the direction in which the view visualises time.
*
* Returns: (transfer none): a #GtkOrientation
*/
GtkOrientation
gcal_view_get_time_direction (GcalView *self)
{
GtkOrientation time_direction;
g_return_val_if_fail (GCAL_IS_VIEW (self), GTK_ORIENTATION_VERTICAL);
g_object_get (self, "time-direction", &time_direction, NULL);
return time_direction;
}
/**
* gcal_view_get_date:
* @view: a #GcalView