Add gtk_grid_view_scroll_to

This does the same as gtk_list_view_scroll_to, just
for a grid view.
This commit is contained in:
Matthias Clasen 2023-05-24 22:38:36 -04:00 committed by Benjamin Otte
parent c278c78378
commit 6077ea4f48
2 changed files with 33 additions and 0 deletions

View File

@ -1564,3 +1564,29 @@ gtk_grid_view_get_tab_behavior (GtkGridView *self)
return gtk_list_base_get_tab_behavior (GTK_LIST_BASE (self));
}
/**
* gtk_grid_view_scroll_to:
* @self: The gridview to scroll in
* @pos: position of the item
* @flags: actions to perform
* @scroll: (nullable) (transfer full): details of how to perform
* the scroll operation or %NULL to scroll into view
*
* Scrolls to the item at the given position and performs the actions
* specified in @flags.
*
* This function works no matter if the gridview is shown or focused.
* If it isn't, then the changes will take effect once that happens.
*
* Since: 4.12
*/
void
gtk_grid_view_scroll_to (GtkGridView *self,
guint pos,
GtkListScrollFlags flags,
GtkScrollInfo *scroll)
{
g_return_if_fail (GTK_IS_GRID_VIEW (self));
gtk_list_base_scroll_to (GTK_LIST_BASE (self), pos, flags, scroll);
}

View File

@ -85,6 +85,13 @@ void gtk_grid_view_set_single_click_activate (GtkGridView
GDK_AVAILABLE_IN_ALL
gboolean gtk_grid_view_get_single_click_activate (GtkGridView *self);
GDK_AVAILABLE_IN_4_12
void gtk_grid_view_scroll_to (GtkGridView *self,
guint pos,
GtkListScrollFlags flags,
GtkScrollInfo *scroll);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGridView, g_object_unref)
G_END_DECLS