[balsa/gtk3] Restore drag-and-drop of a string to To: header
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Restore drag-and-drop of a string to To: header
- Date: Sun, 23 Jun 2013 14:36:45 +0000 (UTC)
commit 1fd677d5d29ce898b021657375b6c5881e20d216
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Jun 23 10:35:58 2013 -0400
Restore drag-and-drop of a string to To: header
* src/sendmsg-window.c (to_add), (create_email_entry): restore
drag-and-drop of a string to the To: header.
ChangeLog | 5 +++++
src/sendmsg-window.c | 27 ++++++++++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2eb7317..b138af2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-06-23 Peter Bloomfield
+ * src/sendmsg-window.c (to_add), (create_email_entry): restore
+ drag-and-drop of a string to the To: header.
+
+2013-06-23 Peter Bloomfield
+
* src/sendmsg-window.c (create_email_entry),
(sw_attachment_list): clean up dead and redundant code.
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 26615c3..2a4be4b 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -225,7 +225,8 @@ static GtkTargetEntry drop_types[] = {
};
static GtkTargetEntry email_field_drop_types[] = {
- {"x-application/x-email", 0, TARGET_EMAIL}
+ { "STRING", 0, TARGET_STRING },
+ { "text/plain", 0, TARGET_STRING }
};
static void sw_undo_cb (GtkAction * action, BalsaSendmsg * bsmsg);
@@ -2589,7 +2590,7 @@ attachments_add(GtkWidget * widget,
gtk_drag_finish(context, drag_result, FALSE, time);
}
-/* to_add - e-mail (To, From, Cc, Bcc) field D&D callback */
+/* to_add - address-view D&D callback; we assume it's a To: address */
static void
to_add(GtkWidget * widget,
GdkDragContext * context,
@@ -2598,11 +2599,23 @@ to_add(GtkWidget * widget,
GtkSelectionData * selection_data,
guint info, guint32 time)
{
-#if 0 /* FIXME */
- append_comma_separated(GTK_EDITABLE(widget),
- (gchar *) selection_data->data);
+ gboolean drag_result = FALSE;
+
+#ifdef DEBUG
+ /* This leaks the name: */
+ g_print("%s atom name %s\n", __func__,
+ gdk_atom_name(gtk_selection_data_get_target(selection_data)));
#endif
- gtk_drag_finish(context, TRUE, FALSE, time);
+ if (info == TARGET_STRING) {
+ const gchar *address;
+
+ address =
+ (const gchar *) gtk_selection_data_get_data(selection_data);
+ libbalsa_address_view_add_from_string(LIBBALSA_ADDRESS_VIEW
+ (widget), "To:", address);
+ drag_result = TRUE;
+ }
+ gtk_drag_finish(context, drag_result, FALSE, time);
}
/*
@@ -2722,7 +2735,7 @@ create_email_entry(BalsaSendmsg * bsmsg,
gtk_drag_dest_set(GTK_WIDGET(*view), GTK_DEST_DEFAULT_ALL,
email_field_drop_types,
ELEMENTS(email_field_drop_types),
- GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
libbalsa_address_view_set_domain(*view, bsmsg->ident->domain);
g_signal_connect_swapped(gtk_tree_view_get_model(GTK_TREE_VIEW(*view)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]