aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-03 10:34:48 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-03 10:34:48 +0000
commit5b6baa6b410e8012ad9ab1a1944dcf7164ea0b8f (patch)
tree9dd557f051ef21d7266831f84d44287d3e6be3a9
parenta2dd397daaa12ba7eaf5ad44dba1d6e38d5fd529 (diff)
improved the DnD.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@310 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.ja8
-rw-r--r--src/compose.c27
-rw-r--r--src/folderview.c8
-rw-r--r--src/summaryview.c25
-rw-r--r--src/summaryview.h2
6 files changed, 64 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 946dbcbb..b0ff9211 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2005-06-03
+ * src/compose.c
+ src/summaryview.[ch]
+ src/folderview.c: improved the DnD. Don't copy files on
+ summary-to-folder drag, and set mime type to message/rfc822 on
+ summary-to-compose drag.
+
+2005-06-03
+
* src/prefs_common.c: prefs_junk_create(): modified the description.
2005-06-03
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 01f09c27..e36a559d 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,13 @@
2005-06-03
+ * src/compose.c
+ src/summaryview.[ch]
+ src/folderview.c: DnD を改良。サマリ->フォルダのドラッグでファイル
+ をコピーしないようにし、サマリ->メッセージ作成のドラッグで MIME
+ タイプを message/rfc822 に指定。
+
+2005-06-03
+
* src/prefs_common.c: prefs_junk_create(): 説明を修正。
2005-06-03
diff --git a/src/compose.c b/src/compose.c
index c1040f6d..30c1177b 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -620,9 +620,18 @@ static GtkItemFactoryEntry compose_entries[] =
{N_("/_Help/_About"), NULL, about_show, 0, NULL}
};
-static GtkTargetEntry compose_mime_types[] =
+enum
+{
+ DRAG_TYPE_RFC822,
+ DRAG_TYPE_URI_LIST,
+
+ N_DRAG_TYPES
+};
+
+static GtkTargetEntry compose_drag_types[] =
{
- {"text/uri-list", 0, 0}
+ {"message/rfc822", GTK_TARGET_SAME_APP, DRAG_TYPE_RFC822},
+ {"text/uri-list", 0, DRAG_TYPE_URI_LIST}
};
@@ -3950,8 +3959,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
/* drag and drop */
gtk_drag_dest_set(attach_treeview,
- GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
+ GTK_DEST_DEFAULT_ALL, compose_drag_types,
+ N_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect(G_OBJECT(attach_treeview), "drag-data-received",
G_CALLBACK(compose_attach_drag_received_cb),
compose);
@@ -4003,8 +4012,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
ruler);
/* drag and drop */
- gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
+ gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_drag_types,
+ N_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect(G_OBJECT(text), "drag-data-received",
G_CALLBACK(compose_insert_drag_received_cb),
compose);
@@ -6067,12 +6076,16 @@ static void compose_attach_drag_received_cb (GtkWidget *widget,
Compose *compose = (Compose *)user_data;
GList *list, *cur;
gchar *path, *filename;
+ gchar *content_type = NULL;
+
+ if (info == DRAG_TYPE_RFC822)
+ content_type = "message/rfc822";
list = uri_list_extract_filenames((const gchar *)data->data);
for (cur = list; cur != NULL; cur = cur->next) {
path = (gchar *)cur->data;
filename = conv_filename_to_utf8(path);
- compose_attach_append(compose, path, filename, NULL);
+ compose_attach_append(compose, path, filename, content_type);
g_free(filename);
g_free(path);
}
diff --git a/src/folderview.c b/src/folderview.c
index ad01fede..d9487b25 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -216,6 +216,11 @@ static void folderview_drag_received_cb (GtkWidget *widget,
guint time,
FolderView *folderview);
+GtkTargetEntry folderview_drag_types[] =
+{
+ {"text/plain", GTK_TARGET_SAME_APP, 0}
+};
+
static GtkItemFactoryEntry folderview_mail_popup_entries[] =
{
{N_("/Create _new folder..."), NULL, folderview_new_folder_cb, 0, NULL},
@@ -450,7 +455,8 @@ FolderView *folderview_create(void)
G_CALLBACK(folderview_popup_close), folderview);
/* drop callback */
- gtk_drag_dest_set(treeview, GTK_DEST_DEFAULT_ALL, summary_drag_types, 1,
+ gtk_drag_dest_set(treeview, GTK_DEST_DEFAULT_ALL,
+ folderview_drag_types, 1,
GDK_ACTION_MOVE | GDK_ACTION_COPY);
g_signal_connect(G_OBJECT(treeview), "drag-motion",
G_CALLBACK(folderview_drag_motion_cb),
diff --git a/src/summaryview.c b/src/summaryview.c
index 4cee6e8c..46157cb6 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -344,9 +344,20 @@ static FolderSortKey col_to_sort_key[] = {
SORT_BY_NUMBER,
};
-GtkTargetEntry summary_drag_types[1] =
+enum
{
- {"text/uri-list", 0, 0}
+ DRAG_TYPE_TEXT,
+ DRAG_TYPE_RFC822,
+ DRAG_TYPE_URI_LIST,
+
+ N_DRAG_TYPES
+};
+
+GtkTargetEntry summary_drag_types[] =
+{
+ {"text/plain", GTK_TARGET_SAME_APP, DRAG_TYPE_TEXT},
+ {"message/rfc822", GTK_TARGET_SAME_APP, DRAG_TYPE_RFC822},
+ {"text/uri-list", 0, DRAG_TYPE_URI_LIST}
};
static GtkItemFactoryEntry summary_popup_entries[] =
@@ -4126,7 +4137,8 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
gtk_tree_view_enable_model_drag_source
(GTK_TREE_VIEW(treeview),
- 0, summary_drag_types, 1, GDK_ACTION_MOVE | GDK_ACTION_COPY);
+ 0, summary_drag_types, N_DRAG_TYPES,
+ GDK_ACTION_MOVE | GDK_ACTION_COPY);
g_signal_connect_after(G_OBJECT(treeview), "drag-begin",
G_CALLBACK(summary_drag_begin), summaryview);
@@ -4596,6 +4608,12 @@ static void summary_drag_data_get(GtkWidget *widget,
MsgInfo *msginfo;
GtkTreeIter iter;
+ if (info == DRAG_TYPE_TEXT) {
+ gtk_selection_data_set(selection_data, selection_data->target,
+ 8, "drag-from-summary", 17);
+ return;
+ }
+
if (!summaryview->drag_list) {
rows = summary_get_selected_rows(summaryview);
@@ -4670,7 +4688,6 @@ static void summary_drag_data_get(GtkWidget *widget,
summaryview->drag_list,
strlen(summaryview->drag_list));
}
-
}
diff --git a/src/summaryview.h b/src/summaryview.h
index 55fcdb87..312a354f 100644
--- a/src/summaryview.h
+++ b/src/summaryview.h
@@ -71,8 +71,6 @@ typedef enum
SUMMARY_SELECTED_MULTIPLE
} SummarySelection;
-extern GtkTargetEntry summary_drag_types[1];
-
struct _SummaryColumnState
{
SummaryColumnType type;