Add gtk_grid_view_scroll_to
authorMatthias Clasen <mclasen@redhat.com>
Thu, 25 May 2023 02:38:36 +0000 (22:38 -0400)
committerBenjamin Otte <otte@redhat.com>
Sat, 5 Aug 2023 01:51:53 +0000 (03:51 +0200)
This does the same as gtk_list_view_scroll_to, just
for a grid view.

gtk/gtkgridview.c
gtk/gtkgridview.h

index dd363098447327b87c035055bcd83b427e514360..1a9e2a5f3dc4f29b304558b9b43d2e50ceeeb376 100644 (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);
+}
index 9525c07c7b3b639936189ea26d9b08dbffa66037..6e4b70f940b81b405ddc5cf2088b9ee459a3f4e5 100644 (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