From e861630f113e4dcff45bbc2684310c793838f384 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 21 Dec 2010 21:11:10 +0100 Subject: Bug #567879 - Add View >> Gallery Option In Email Composer --- composer/e-msg-composer.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 227df24277..b79eaa3a71 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1975,6 +1975,34 @@ msg_composer_finalize (GObject *object) G_OBJECT_CLASS (e_msg_composer_parent_class)->finalize (object); } +static void +msg_composer_gallery_drag_data_get (GtkIconView *icon_view, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint target_type, + guint time) +{ + GtkTreePath *path; + GtkCellRenderer *cell; + GtkTreeModel *model; + GtkTreeIter iter; + gchar *str_data; + + if (!gtk_icon_view_get_cursor (icon_view, &path, &cell)) + return; + + model = gtk_icon_view_get_model (icon_view); + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, 1, &str_data, -1); + gtk_tree_path_free (path); + + /* only supports "text/uri-list" */ + gtk_selection_data_set ( + selection_data, selection_data->target, 8, + (guchar *) str_data, strlen (str_data)); + g_free (str_data); +} + static void msg_composer_constructed (GObject *object) { @@ -2072,6 +2100,10 @@ msg_composer_constructed (GObject *object) web_view, "drag-data-received", G_CALLBACK (msg_composer_drag_data_received_cb), composer); + g_signal_connect ( + composer->priv->gallery_icon_view, "drag-data-get", + G_CALLBACK (msg_composer_gallery_drag_data_get), NULL); + /* Configure Headers */ e_composer_header_table_set_account_list ( -- cgit