aboutsummaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-11-02 14:35:47 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-11-02 14:35:47 -0700
commitf89aec94e268dad1305789bbc9d17864f19c833b (patch)
tree3cb300e4d9a71df22b4e28411ce73970bb109842 /gtk-gui.c
parent55352a051cfa7ac519e397cd3d18851e5050517b (diff)
downloadsubsurface-f89aec94e268dad1305789bbc9d17864f19c833b.tar.gz
Fix drag and drop error
Linus noted an odd "CRITICAL" warning when ripping off a page of the notebook and then dropping it within the same notebook. Turns out we need to simply accept a drop on ourselves and gtk does the rest correctly. I also fixed the fact that we incorrectly declared the callback as 'void'. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 339b13f4c..c78d7e667 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -694,23 +694,21 @@ static GtkNotebook *create_new_notebook_window(GtkNotebook *source,
return GTK_NOTEBOOK(notebook);
}
-static void drag_cb(GtkWidget *widget, GdkDragContext *context,
+static gboolean drag_cb(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time,
gpointer user_data)
{
GtkWidget *source;
notebook_data_t *nbdp;
+ gtk_drag_finish(context, TRUE, TRUE, time);
source = gtk_drag_get_source_widget(context);
if (nbd[0].name && ! strcmp(nbd[0].name,gtk_widget_get_name(source)))
nbdp = nbd;
else if (nbd[1].name && ! strcmp(nbd[1].name,gtk_widget_get_name(source)))
nbdp = nbd + 1;
- else
- /* HU? */
- return;
-
- gtk_drag_finish(context, TRUE, TRUE, time);
+ else /* just on ourselves */
+ return TRUE;
/* we no longer need the widget - but getting rid of this is hard;
* remove the signal handler, remove the notebook from the box
@@ -722,6 +720,8 @@ static void drag_cb(GtkWidget *widget, GdkDragContext *context,
nbdp->widget = NULL;
free(nbdp->name);
nbdp->name = NULL;
+
+ return TRUE;
}
#ifdef WIN32