[gnome-builder] tabs: workaround dropping tab back onto source notebook.



commit aa4fa77bcbbb390fb1841ccafe257e97a64185e7
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 9 02:12:56 2014 -0700

    tabs: workaround dropping tab back onto source notebook.

 src/tabs/gb-multi-notebook.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/tabs/gb-multi-notebook.c b/src/tabs/gb-multi-notebook.c
index e5041e3..28a0721 100644
--- a/src/tabs/gb-multi-notebook.c
+++ b/src/tabs/gb-multi-notebook.c
@@ -979,6 +979,18 @@ on_create_window (GtkNotebook     *notebook,
   RETURN (ret);
 }
 
+static gboolean
+remove_unused_notebooks_cb (gpointer data)
+{
+  GbMultiNotebook *mnb = data;
+
+  g_return_val_if_fail (GB_IS_MULTI_NOTEBOOK (mnb), G_SOURCE_REMOVE);
+
+  remove_unused_notebooks (mnb);
+
+  return G_SOURCE_REMOVE;
+}
+
 static void
 on_remove (GtkContainer    *container,
            GtkWidget       *widget,
@@ -987,7 +999,15 @@ on_remove (GtkContainer    *container,
   g_return_if_fail (GB_IS_MULTI_NOTEBOOK (mnb));
   g_return_if_fail (GB_IS_NOTEBOOK (container));
 
-  remove_unused_notebooks (mnb);
+  /*
+   * WORKAROUND:
+   *
+   * We delay the cleanup here of unused notebooks since we could be
+   * in the process of dropping back onto ourselves. Probably just need
+   * to avoid the drag'n'drop code altogether when that happens by
+   * cancelling the drag upon drop.
+   */
+  g_timeout_add (0, remove_unused_notebooks_cb, g_object_ref (mnb));
 }
 
 static void


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