summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-01-30 09:26:04 -0500
committerMatthias Clasen <mclasen@redhat.com>2015-01-30 10:13:28 -0500
commit3fc21b4f3f2d7764b00939961fb38af9b552b6ab (patch)
treeeddce978d1ccb13d703be50b6a35419f7fc5b2a9 /gtk/gtknotebook.c
parent63104944a3d783197082cb57683301a67f1de063 (diff)
downloadgtk+-3fc21b4f3f2d7764b00939961fb38af9b552b6ab.tar.gz
notebook: Protect removal-from-within
When a tab is dropped, we have to remove it from the notebook to insert it elsewhere. This is expected part of the tab dnd operation, and we need to differentiate it from 'spontaneous' removals which cause us to cancel the drag operation.
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index aba3daa123..3953eececf 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -162,6 +162,7 @@ struct _GtkNotebookPrivate
guint click_child : 3;
guint during_detach : 1;
guint during_reorder : 1;
+ guint remove_in_detach : 1;
guint focus_out : 1; /* Flag used by ::move-focus-out implementation */
guint has_scrolled : 1;
guint in_child : 3;
@@ -3958,7 +3959,9 @@ do_detach_tab (GtkNotebook *from,
"detachable", &detachable,
NULL);
+ from->priv->remove_in_detach = TRUE;
gtk_container_remove (GTK_CONTAINER (from), child);
+ from->priv->remove_in_detach = FALSE;
gtk_widget_get_allocation (GTK_WIDGET (to), &to_allocation);
to_priv->mouse_x = x + to_allocation.x;
@@ -5048,7 +5051,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
priv->cur_page = NULL;
if (next_list && !destroying)
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE (next_list));
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (priv->operation == DRAG_OPERATION_REORDER && !priv->remove_in_detach)
gtk_notebook_stop_reorder (notebook);
}
@@ -5056,7 +5059,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
{
priv->detached_tab = NULL;
- if (priv->operation == DRAG_OPERATION_DETACH)
+ if (priv->operation == DRAG_OPERATION_DETACH && !priv->remove_in_detach)
{
GdkDragContext *context;