talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 8bf258fbc5f1b161d7b5434baff2cbe493da8f46
parent 587f99eceae540a9a3bd48008cfc8d8d1608bb76
Author: Holger Berndt <hb@claws-mail.org>
Date:   Tue,  1 Dec 2009 17:33:59 +0000

2009-12-01 [holger]	3.7.3cvs25

	* src/summaryview.c
	* src/summaryview.h
		Introduce new drag type "claws-mail/msg-path-list" for
		drag'n'drop of a message selection from the summaryview
		into other applications. The drag data gets set to the
		folder-item-id followed by message ids, separated by newlines.
		This enables other applications to back-link to Claws Mail
		via a "claws-mail --select" call after they received a drop.

Diffstat:
MChangeLog | 11+++++++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/summaryview.c | 44+++++++++++++++++++++++++++++++++++++++-----
Msrc/summaryview.h | 5+++--
5 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,14 @@ +2009-12-01 [holger] 3.7.3cvs25 + + * src/summaryview.c + * src/summaryview.h + Introduce new drag type "claws-mail/msg-path-list" for + drag'n'drop of a message selection from the summaryview + into other applications. The drag data gets set to the + folder-item-id followed by message ids, separated by newlines. + This enables other applications to back-link to Claws Mail + via a "claws-mail --select" call after they received a drop. + 2009-11-30 [mir] 3.7.3cvs24 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS @@ -3898,3 +3898,4 @@ ( cvs diff -u -r 1.24.2.28 -r 1.24.2.29 Makefile.am; cvs diff -u -r 1.24.2.19 -r 1.24.2.20 src/common/Makefile.am; cvs diff -u -r 1.36.2.179 -r 1.36.2.180 src/common/utils.c; cvs diff -u -r 1.20.2.72 -r 1.20.2.73 src/common/utils.h; ) > 3.7.3cvs22.patchset ( cvs diff -u -r 1.1.2.87 -r 1.1.2.88 src/gtk/quicksearch.c; ) > 3.7.3cvs23.patchset ( cvs diff -u -r 1.382.2.525 -r 1.382.2.526 src/compose.c; ) > 3.7.3cvs24.patchset +( cvs diff -u -r 1.395.2.415 -r 1.395.2.416 src/summaryview.c; cvs diff -u -r 1.68.2.52 -r 1.68.2.53 src/summaryview.h; ) > 3.7.3cvs25.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=3 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=24 +EXTRA_VERSION=25 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/summaryview.c b/src/summaryview.c @@ -399,10 +399,11 @@ static void summary_set_colorlabel_color (GtkCMCTree *ctree, guint labelcolor); static void summary_thread_build(SummaryView *summaryview); -GtkTargetEntry summary_drag_types[2] = +GtkTargetEntry summary_drag_types[3] = { {"text/uri-list", 0, TARGET_MAIL_URI_LIST}, - {"claws-mail/internal", GTK_TARGET_SAME_APP, TARGET_DUMMY} + {"claws-mail/internal", GTK_TARGET_SAME_APP, TARGET_DUMMY}, + {"claws-mail/msg-path-list", 0, TARGET_MAIL_CM_PATH_LIST}, }; #define DO_ACTION(name, act) { \ @@ -759,7 +760,7 @@ SummaryView *summary_create(MainWindow *mainwin) summary_update_folder_hook, (gpointer) summaryview); - summaryview->target_list = gtk_target_list_new(summary_drag_types, 2); + summaryview->target_list = gtk_target_list_new(summary_drag_types, 3); summaryview->quicksearch = quicksearch; @@ -6408,7 +6409,7 @@ static GtkWidget *summary_ctree_create(SummaryView *summaryview) summaryview); gtk_drag_dest_set(ctree, GTK_DEST_DEFAULT_ALL & ~GTK_DEST_DEFAULT_HIGHLIGHT, - summary_drag_types, 2, + summary_drag_types, 3, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_DEFAULT); g_signal_connect(G_OBJECT(ctree), "drag_data_received", @@ -7109,7 +7110,40 @@ static void summary_drag_data_get(GtkWidget *widget, selection_data->target, 8, "Dummy-Summaryview", strlen("Dummy-Summaryview")+1); - } + } else if (info == TARGET_MAIL_CM_PATH_LIST) { + /* content: folder_item_identifier\nmsgid1\nmsgid2\nmsgid3 */ + + GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree); + GList *cur; + MsgInfo *msginfo; + gchar *path_list = NULL; + + /* identifier */ + if(GTK_CMCLIST(ctree)->selection != NULL) { + msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->selection->data)); + if(msginfo && msginfo->folder) + path_list = folder_item_get_identifier(msginfo->folder); + } + + for (cur = GTK_CMCLIST(ctree)->selection; + cur != NULL && cur->data != NULL; cur = cur->next) { + gchar *tmp; + + msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(cur->data)); + if(!msginfo) + continue; + tmp = path_list; + path_list = g_strconcat(path_list, "\n", (msginfo->msgid ? msginfo->msgid : "unknown"), NULL); + g_free(tmp); + } + + if (path_list != NULL) { + gtk_selection_data_set(selection_data, + selection_data->target, 8, + path_list, strlen(path_list)); + g_free(path_list); + } + } } static gboolean summary_drag_motion_cb(GtkWidget *widget, diff --git a/src/summaryview.h b/src/summaryview.h @@ -61,7 +61,8 @@ typedef enum typedef enum { TARGET_MAIL_URI_LIST, - TARGET_DUMMY + TARGET_DUMMY, + TARGET_MAIL_CM_PATH_LIST, } TargetInfo; #include "mainwindow.h" @@ -74,7 +75,7 @@ typedef enum #include "prefs_filtering.h" #include "quicksearch.h" -extern GtkTargetEntry summary_drag_types[2]; +extern GtkTargetEntry summary_drag_types[3]; struct _SummaryColumnState {