aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-23 22:51:51 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-23 22:51:51 +0800
commitc37352e589c1781ba0c23ff841d7c415b6d41106 (patch)
treede782555f374db20b5c8006615f5715b374d9c6d
parent0fbc7299d9f5c3ef7a27775e2a6414a3eb5253b7 (diff)
downloadgsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar.gz
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar.bz2
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar.lz
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar.xz
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.tar.zst
gsoc2013-evolution-c37352e589c1781ba0c23ff841d7c415b6d41106.zip
Composer: Append drag dest targets to the GtkHTML widget.
This is so that GtkHTML doesn't have to register drag destination targets that that it can't handle itself, like "text/calendar" and "text/x-vcard".
-rw-r--r--composer/e-msg-composer.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 21f508d8d1..fb147d2d78 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1625,6 +1625,31 @@ msg_composer_paste_clipboard_cb (EWebView *web_view,
g_signal_stop_emission_by_name (web_view, "paste-clipboard");
}
+static void
+msg_composer_realize_gtkhtml_cb (GtkWidget *widget,
+ EMsgComposer *composer)
+{
+ EAttachmentView *view;
+ GtkTargetList *target_list;
+ GtkTargetEntry *targets;
+ gint n_targets;
+
+ /* XXX GtkHTML doesn't set itself up as a drag destination until
+ * it's realized, and we need to amend to its target list so
+ * it will accept the same drag targets as the attachment bar.
+ * Do this any earlier and GtkHTML will just overwrite us. */
+
+ view = e_msg_composer_get_attachment_view (composer);
+
+ target_list = e_attachment_view_get_target_list (view);
+ targets = gtk_target_table_new_from_list (target_list, &n_targets);
+
+ target_list = gtk_drag_dest_get_target_list (widget);
+ gtk_target_list_add_table (target_list, targets, n_targets);
+
+ gtk_target_table_free (targets, n_targets);
+}
+
struct _drop_data {
EMsgComposer *composer;
@@ -1835,6 +1860,10 @@ msg_composer_constructed (GObject *object)
targets, n_targets, drag_actions);
g_signal_connect (
+ html, "realize",
+ G_CALLBACK (msg_composer_realize_gtkhtml_cb), composer);
+
+ g_signal_connect (
html, "drag-data-received",
G_CALLBACK (msg_composer_drag_data_received), NULL);
@@ -2038,6 +2067,9 @@ msg_composer_drag_data_received (GtkWidget *widget,
e_attachment_paned_drag_data_received (
E_ATTACHMENT_PANED (view),
context, x, y, selection, info, time);
+
+ /* Stop the signal from propagating to GtkHtml. */
+ g_signal_stop_emission_by_name (widget, "drag-data-received");
}
static void