[gtk+] notebook: Tell everyone we reordered stuff



commit 61f5562f9f6fed7cd03118820c1eb0902dc52eeb
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 29 23:17:00 2016 +0100

    notebook: Tell everyone we reordered stuff
    
    Fixes keybindings for reordering actually emitting signals and properly
    updating CSS/the screen.

 gtk/gtknotebook.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 0a7777a..4ac4ec0 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1601,8 +1601,8 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
 {
   GtkNotebookPrivate *priv = notebook->priv;
   GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
-  GList *last, *child;
-  gint page_num;
+  GList *last, *child, *element;
+  gint page_num, old_page_num, i;
 
   if (!gtk_widget_is_focus (GTK_WIDGET (notebook)) || !priv->show_tabs)
     return FALSE;
@@ -1638,11 +1638,18 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
   if (!child || child->data == priv->cur_page)
     return FALSE;
 
+  old_page_num = g_list_position (priv->children, priv->focus_tab);
   if (effective_direction == GTK_DIR_RIGHT)
     page_num = reorder_tab (notebook, child->next, priv->focus_tab);
   else
     page_num = reorder_tab (notebook, child, priv->focus_tab);
-
+  
+  gtk_notebook_child_reordered (notebook, priv->focus_tab->data);
+  for (element = priv->children, i = 0; element; element = element->next, i++)
+    {
+      if (MIN (old_page_num, page_num) <= i && i <= MAX (old_page_num, page_num))
+        gtk_widget_child_notify (((GtkNotebookPage *) element->data)->child, "position");
+    }
   g_signal_emit (notebook,
                  notebook_signals[PAGE_REORDERED],
                  0,


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