[gnome-text-editor] window: fix actions to reorder pages



commit e96474b64346f9c38e09f9d0ca471981c478b0a0
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 29 10:42:30 2021 -0700

    window: fix actions to reorder pages

 src/editor-window-actions.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/src/editor-window-actions.c b/src/editor-window-actions.c
index 80c57ce..8eaa153 100644
--- a/src/editor-window-actions.c
+++ b/src/editor-window-actions.c
@@ -405,22 +405,16 @@ editor_window_actions_move_left_cb (GtkWidget  *widget,
                                     GVariant   *param)
 {
   EditorWindow *self = (EditorWindow *)widget;
-  GtkNotebook *notebook;
   EditorPage *page;
-  gint page_num;
+  AdwTabPage *tab_page;
 
   g_assert (EDITOR_IS_WINDOW (self));
 
   if (!(page = editor_window_get_visible_page (self)))
     return;
 
-  if (!(notebook = GTK_NOTEBOOK (gtk_widget_get_ancestor (GTK_WIDGET (page), GTK_TYPE_NOTEBOOK))))
-    return;
-
-  if ((page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (page))) < 0)
-    return;
-
-  gtk_notebook_reorder_child (notebook, GTK_WIDGET (page), page_num - 1);
+  tab_page = adw_tab_view_get_page (self->tab_view, GTK_WIDGET (page));
+  adw_tab_view_reorder_backward (self->tab_view, tab_page);
   _editor_page_raise (page);
 }
 
@@ -430,22 +424,16 @@ editor_window_actions_move_right_cb (GtkWidget  *widget,
                                      GVariant   *param)
 {
   EditorWindow *self = (EditorWindow *)widget;
-  GtkNotebook *notebook;
   EditorPage *page;
-  gint page_num;
+  AdwTabPage *tab_page;
 
   g_assert (EDITOR_IS_WINDOW (self));
 
   if (!(page = editor_window_get_visible_page (self)))
     return;
 
-  if (!(notebook = GTK_NOTEBOOK (gtk_widget_get_ancestor (GTK_WIDGET (page), GTK_TYPE_NOTEBOOK))))
-    return;
-
-  if ((page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (page))) < 0)
-    return;
-
-  gtk_notebook_reorder_child (notebook, GTK_WIDGET (page), page_num + 1);
+  tab_page = adw_tab_view_get_page (self->tab_view, GTK_WIDGET (page));
+  adw_tab_view_reorder_forward (self->tab_view, tab_page);
   _editor_page_raise (page);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]