[gtk+] Add a drag-end callback
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a drag-end callback
- Date: Fri, 11 Dec 2015 15:50:52 +0000 (UTC)
commit a8a33b71e4fb3077c5b7cdd65f248515a1c525ea
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Dec 11 10:50:25 2015 -0500
Add a drag-end callback
This will be helpful in figuring out life-cycle issues
with icon widgets.
tests/testdnd2.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index eb4c174..0447dc0 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -199,6 +199,18 @@ spinner_drag_begin (GtkWidget *widget,
"active", TRUE,
NULL);
gtk_drag_set_icon_widget (context, spinner, 0, 0);
+ g_object_set_data (G_OBJECT (context), "spinner", spinner);
+}
+
+static void
+spinner_drag_end (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer data)
+{
+ GtkWidget *spinner;
+
+ spinner = g_object_get_data (G_OBJECT (context), "spinner");
+ gtk_widget_destroy (spinner);
}
void
@@ -225,6 +237,7 @@ make_spinner (void)
gtk_drag_source_add_text_targets (ebox);
g_signal_connect (ebox, "drag-begin", G_CALLBACK (spinner_drag_begin), spinner);
+ g_signal_connect (ebox, "drag-end", G_CALLBACK (spinner_drag_end), spinner);
g_signal_connect (ebox, "drag-data-get", G_CALLBACK (spinner_drag_data_get), spinner);
gtk_container_add (GTK_CONTAINER (ebox), spinner);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]