aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-reader.c38
-rw-r--r--widgets/table/e-tree.c23
-rw-r--r--widgets/table/e-tree.h2
3 files changed, 62 insertions, 1 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 12e3a8ac92..8f51972c25 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2482,6 +2482,9 @@ mail_reader_message_seen_cb (EMailReaderClosure *closure)
formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
+ if (e_tree_is_dragging (E_TREE (message_list)))
+ return FALSE;
+
current_uid = EM_FORMAT (formatter)->uid;
uid_is_current &= (g_strcmp0 (current_uid, message_uid) == 0);
@@ -2517,7 +2520,8 @@ schedule_timeout_mark_seen (EMailReader *reader)
shell_settings = e_shell_get_shell_settings (shell);
message_uid = message_list->cursor_uid;
- if (message_uid == NULL)
+ if (message_uid == NULL ||
+ e_tree_is_dragging (E_TREE (message_list)))
return FALSE;
schedule_timeout =
@@ -2550,6 +2554,24 @@ schedule_timeout_mark_seen (EMailReader *reader)
return schedule_timeout;
}
+static gboolean
+discard_timeout_mark_seen_cb (EMailReader *reader)
+{
+ MessageList *message_list;
+
+ g_return_val_if_fail (reader != NULL, FALSE);
+
+ message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
+ g_return_val_if_fail (message_list != NULL, FALSE);
+
+ if (message_list->seen_id > 0) {
+ g_source_remove (message_list->seen_id);
+ message_list->seen_id = 0;
+ }
+
+ return FALSE;
+}
+
static void
mail_reader_message_loaded_cb (CamelFolder *folder,
GAsyncResult *result,
@@ -3758,10 +3780,24 @@ connect_signals:
message_list, "message-selected",
G_CALLBACK (mail_reader_message_selected_cb), reader);
+ /* re-schedule mark-as-seen,... */
g_signal_connect_swapped (
message_list, "cursor-change",
G_CALLBACK (mail_reader_message_cursor_change_cb), reader);
+ /* but do not mark-as-seen if... */
+ g_signal_connect_swapped (
+ message_list, "tree-drag-begin",
+ G_CALLBACK (discard_timeout_mark_seen_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "tree-drag-end",
+ G_CALLBACK (discard_timeout_mark_seen_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "right-click",
+ G_CALLBACK (discard_timeout_mark_seen_cb), reader);
+
g_signal_connect_swapped (
message_list, "message-list-built",
G_CALLBACK (mail_reader_emit_folder_loaded), reader);
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index e24ce6a6e0..ffcca22457 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -200,6 +200,8 @@ struct _ETreePrivate {
gboolean state_changed;
guint state_change_freeze;
+
+ gboolean is_dragging;
};
static guint et_signals[LAST_SIGNAL] = { 0, };
@@ -638,6 +640,8 @@ e_tree_init (ETree *e_tree)
e_tree->priv->state_changed = FALSE;
e_tree->priv->state_change_freeze = 0;
+
+ e_tree->priv->is_dragging = FALSE;
}
/* Grab_focus handler for the ETree */
@@ -2827,6 +2831,21 @@ e_tree_drag_begin (ETree *tree,
}
/**
+ * e_tree_is_dragging:
+ * @tree: An #ETree widget
+ *
+ * Returns whether is @tree in a drag&drop operation.
+ **/
+gboolean
+e_tree_is_dragging (ETree *tree)
+{
+ g_return_val_if_fail (tree != NULL, FALSE);
+ g_return_val_if_fail (tree->priv != NULL, FALSE);
+
+ return tree->priv->is_dragging;
+}
+
+/**
* e_tree_get_cell_at:
* @tree: An ETree widget
* @x: X coordinate for the pixel
@@ -2928,6 +2947,8 @@ et_drag_begin (GtkWidget *widget,
GdkDragContext *context,
ETree *et)
{
+ et->priv->is_dragging = TRUE;
+
g_signal_emit (et,
et_signals[TREE_DRAG_BEGIN], 0,
et->priv->drag_row,
@@ -2941,6 +2962,8 @@ et_drag_end (GtkWidget *widget,
GdkDragContext *context,
ETree *et)
{
+ et->priv->is_dragging = FALSE;
+
g_signal_emit (et,
et_signals[TREE_DRAG_END], 0,
et->priv->drag_row,
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
index 08e56039b3..ae5639999c 100644
--- a/widgets/table/e-tree.h
+++ b/widgets/table/e-tree.h
@@ -307,6 +307,8 @@ GdkDragContext *e_tree_drag_begin (ETree *tree,
gint button,
GdkEvent *event);
+gboolean e_tree_is_dragging (ETree *tree);
+
/* Adapter functions */
gboolean e_tree_node_is_expanded (ETree *et,
ETreePath path);