[balsa/gtk4: 244/294] main-window: Fix asynch drag drop




commit fe81fcf8116f7ab876042a467cb62aaf468b2ee1
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Nov 2 15:09:52 2020 -0500

    main-window: Fix asynch drag drop

 src/main-window.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/src/main-window.c b/src/main-window.c
index d1d331c9f..cc68af4f1 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2738,7 +2738,7 @@ bw_mailbox_changed(LibBalsaMailbox * mailbox, GtkLabel * lab)
 }
 
 /*
- * bw_notebook_tab_drag_drop
+ * bw_notebook_tab_drag_drop_callback
  *
  * Description: This is the async callback for the notebook tabs.
  * It retrieves the source BalsaIndex and transfers the
@@ -2749,9 +2749,9 @@ bw_mailbox_changed(LibBalsaMailbox * mailbox, GtkLabel * lab)
  */
 #define BALSA_WINDOW_MAILBOX_KEY "balsa-window-mailbox-key"
 static void
-bw_notebook_tab_drag_drop(GObject      *source_object,
-                          GAsyncResult *res,
-                          gpointer      user_data)
+bw_notebook_tab_drag_drop_callback(GObject      *source_object,
+                                   GAsyncResult *res,
+                                   gpointer      user_data)
 {
     GdkDrop *drop = GDK_DROP(source_object);
     GtkWidget *box = user_data;
@@ -2782,6 +2782,32 @@ bw_notebook_tab_drag_drop(GObject      *source_object,
     balsa_index_selected_msgnos_free(orig_index, selected);
 }
 
+/*
+ * bw_notebook_tab_drag_drop
+ *
+ * Description: This is the "drop" signal handler for the
+ * BalsaMBList.  It launches the async operation that carries out the
+ * actual drop.
+  */
+static gboolean
+bw_notebook_tab_drag_drop(GtkDropTarget *drop_target,
+                          GValue        *value,
+                          gdouble        x,
+                          gdouble        y,
+                          gpointer       user_data)
+{
+    GdkDrop *drop;
+
+    drop = gtk_drop_target_get_drop(drop_target);
+    if (drop == NULL)
+        return FALSE;
+
+    gdk_drop_read_value_async(drop, BALSA_TYPE_INDEX, 0, NULL, bw_notebook_tab_drag_drop_callback,
+                              user_data);
+
+    return TRUE;
+}
+
 static GtkWidget *
 bw_notebook_label_new(BalsaMailboxNode * mbnode)
 {


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