aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-01-27 05:16:01 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-01-27 05:16:01 +0800
commitb09318f2bbd4898494462aee9b47669b045dfde3 (patch)
treef28a69fca6febcddf56d480d7515e9575ad2004e /mail
parentca1452156e8e50ac1980319c9e30920cd06236a7 (diff)
downloadgsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar.gz
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar.bz2
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar.lz
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar.xz
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.tar.zst
gsoc2013-evolution-b09318f2bbd4898494462aee9b47669b045dfde3.zip
Set priv->drag_row.
2004-01-26 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree.c (tree_drag_begin): Set priv->drag_row. svn path=/trunk/; revision=24447
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/em-folder-tree-model.c21
-rw-r--r--mail/em-folder-tree.c18
3 files changed, 38 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 41096cfe35..b5ca55109a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,10 @@
+2004-01-26 Jeffrey Stedfast <fejj@ximian.com>
+
+ * em-folder-tree.c (tree_drag_begin): Set priv->drag_row.
+
2004-01-26 Aaron Weber <aaron@ximian.com>
- * mail/default/C/Inbox: edited default message
+
+ * mail/default/C/Inbox: edited default message
2004-01-26 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index ae078cbb6f..5811cb09ef 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -87,6 +87,7 @@ static GtkTargetEntry drop_types[] = {
{ "text/uri-list", 0, DND_DROP_TYPE_TEXT_URI_LIST },
};
+static GdkAtom drag_atoms[NUM_DRAG_TYPES];
static GdkAtom drop_atoms[NUM_DROP_TYPES];
@@ -173,6 +174,9 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass)
G_TYPE_POINTER,
G_TYPE_POINTER);
+ for (i = 0; i < NUM_DRAG_TYPES; i++)
+ drag_atoms[i] = gdk_atom_intern (drag_types[i].target, FALSE);
+
for (i = 0; i < NUM_DROP_TYPES; i++)
drop_atoms[i] = gdk_atom_intern (drop_types[i].target, FALSE);
}
@@ -1155,7 +1159,7 @@ em_folder_tree_model_drag_data_received (EMFolderTreeModel *model, GtkTreePath *
/* copy or move (aka rename) a folder */
drop_folder (folder, selection, move, &ex);
*moved = move;
- d(printf ("\t* dropped a x-folder\n"));
+ d(printf ("\t* dropped a x-folder ('%s' into '%s')\n", selection->data, full_name));
break;
case DND_DROP_TYPE_MESSAGE_RFC822:
/* import a message/rfc822 stream */
@@ -1312,7 +1316,7 @@ drag_text_uri_list (CamelFolder *src, GtkSelectionData *selection, CamelExceptio
/* replace "mbox:" with "file:" */
memcpy (url->str, "file", 4);
g_string_append (url, "\r\n");
- gtk_selection_data_set (selection, selection->target, 8, url->str, url->len);
+ gtk_selection_data_set (selection, drag_atoms[DND_DRAG_TYPE_TEXT_URI_LIST], 8, url->str, url->len);
}
camel_folder_free_uids (src, uids);
@@ -1331,8 +1335,10 @@ em_folder_tree_model_drag_data_get (EMFolderTreeModel *model, GtkTreePath *src_p
GtkTreeIter iter;
char *path, *uri;
- if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, src_path))
+ if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, src_path)) {
+ printf ("model_drag_data_get failed to get iter\n");
return FALSE;
+ }
gtk_tree_model_get ((GtkTreeModel *) model, &iter,
COL_POINTER_CAMEL_STORE, &store,
@@ -1340,8 +1346,10 @@ em_folder_tree_model_drag_data_get (EMFolderTreeModel *model, GtkTreePath *src_p
COL_STRING_URI, &uri, -1);
/* make sure user isn't try to drag on a placeholder row */
- if (path == NULL)
+ if (path == NULL) {
+ printf ("model_drag_data_get failed to get path\n");
return FALSE;
+ }
full_name = path[0] == '/' ? path + 1 : path;
@@ -1350,11 +1358,13 @@ em_folder_tree_model_drag_data_get (EMFolderTreeModel *model, GtkTreePath *src_p
switch (info) {
case DND_DRAG_TYPE_FOLDER:
/* dragging to a new location in the folder tree */
- gtk_selection_data_set (selection, selection->target, 8, uri, strlen (uri) + 1);
+ gtk_selection_data_set (selection, drag_atoms[info], 8, uri, strlen (uri) + 1);
+ printf ("model_drag_data_get setting x-folder data\n");
break;
case DND_DRAG_TYPE_TEXT_URI_LIST:
/* dragging to nautilus or something, probably */
if ((folder = camel_store_get_folder (store, full_name, 0, &ex))) {
+ printf ("model_drag_data_get setting text/uri-list data\n");
drag_text_uri_list (folder, selection, &ex);
camel_object_unref (folder);
}
@@ -1364,6 +1374,7 @@ em_folder_tree_model_drag_data_get (EMFolderTreeModel *model, GtkTreePath *src_p
}
if (camel_exception_is_set (&ex)) {
+ printf ("model_drag_data_get failed: %s\n", ex.desc);
camel_exception_clear (&ex);
return FALSE;
}
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 0ffc95b561..62b3deba2a 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -512,8 +512,23 @@ em_folder_tree_new_with_model (EMFolderTreeModel *model)
static void
tree_drag_begin (GtkWidget *widget, GdkDragContext *context, EMFolderTree *emft)
{
- /* FIXME: set an icon? */
+ struct _EMFolderTreePrivate *priv = emft->priv;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+
printf ("::drag-begin called\n");
+
+ selection = gtk_tree_view_get_selection ((GtkTreeView *) widget);
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ path = gtk_tree_model_get_path (model, &iter);
+ priv->drag_row = gtk_tree_row_reference_new (model, path);
+ gtk_tree_path_free (path);
+
+ /* FIXME: set a drag icon? */
}
static void
@@ -590,7 +605,6 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
}
gtk_tree_path_free (path);
- widget = gtk_drag_get_source_widget (context);
gtk_drag_get_data (widget, context, target, time);
return TRUE;