inspector: Use scroll_to() in the object tree search
authorBenjamin Otte <otte@redhat.com>
Tue, 7 Mar 2023 23:53:51 +0000 (00:53 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 5 Aug 2023 01:51:55 +0000 (03:51 +0200)
gtk/inspector/object-tree.c

index 0c0c9e28ab849c6c5e4f2f6c0db8e190062adc3e..b86f9bcbe5b4330576655da874841707c3090943 100644 (file)
@@ -910,7 +910,11 @@ search (GtkInspectorObjectTree *wt,
         {
           if (match_object (child, text))
             {
-              gtk_single_selection_set_selected (priv->selection, row);
+              gtk_column_view_scroll_to (GTK_COLUMN_VIEW (wt->priv->list),
+                                         row,
+                                         NULL,
+                                         GTK_LIST_SCROLL_SELECT | GTK_LIST_SCROLL_FOCUS,
+                                         NULL);
               g_object_unref (child);
               g_object_unref (row_item);
               return TRUE;
@@ -1302,8 +1306,12 @@ gtk_inspector_object_tree_select_object (GtkInspectorObjectTree *wt,
   if (row_item == NULL)
     return;
 
-  gtk_single_selection_set_selected (wt->priv->selection,
-                                     gtk_tree_list_row_get_position (row_item));
+  gtk_column_view_scroll_to (GTK_COLUMN_VIEW (wt->priv->list),
+                             gtk_tree_list_row_get_position (row_item),
+                             NULL,
+                             GTK_LIST_SCROLL_SELECT | GTK_LIST_SCROLL_FOCUS,
+                             NULL);
+
   g_signal_emit (wt, signals[OBJECT_SELECTED], 0, object); // FIXME
   g_object_unref (row_item);
 }