diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-12 20:48:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-12 20:51:55 +0800 |
commit | dbb4c2472f54845f131f4df91aa11ec1d852b80a (patch) | |
tree | 6858970f1fa33c78fa23b7879e3af5868f28be75 /mail/em-folder-tree-model.c | |
parent | 2f326f6ca43816ff3bab4f377ae1eaaa4e6bb47d (diff) | |
download | gsoc2013-evolution-dbb4c2472f54845f131f4df91aa11ec1d852b80a.tar.gz gsoc2013-evolution-dbb4c2472f54845f131f4df91aa11ec1d852b80a.tar.zst gsoc2013-evolution-dbb4c2472f54845f131f4df91aa11ec1d852b80a.zip |
Bug 626724 - Folder tree mistakes "mark as unread" as new mail
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r-- | mail/em-folder-tree-model.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 81610275a3..82620f76ab 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -1312,14 +1312,50 @@ em_folder_tree_model_lookup_store_info (EMFolderTreeModel *model, GtkTreeRowReference * em_folder_tree_model_lookup_uri (EMFolderTreeModel *model, - const gchar *uri) + const gchar *folder_uri) { GtkTreeRowReference *reference; g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL); - g_return_val_if_fail (uri != NULL, NULL); + g_return_val_if_fail (folder_uri != NULL, NULL); - reference = g_hash_table_lookup (model->priv->uri_index, uri); + reference = g_hash_table_lookup (model->priv->uri_index, folder_uri); return gtk_tree_row_reference_valid (reference) ? reference : NULL; } + +void +em_folder_tree_model_user_marked_unread (EMFolderTreeModel *model, + const gchar *folder_uri, + guint n_marked) +{ + GtkTreeRowReference *reference; + GtkTreePath *path; + GtkTreeIter iter; + guint unread; + + /* The user marked messages in the given folder as unread. + * Update our unread counts so we don't misinterpret this + * event as new mail arriving. */ + + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); + g_return_if_fail (folder_uri != NULL); + + reference = em_folder_tree_model_lookup_uri (model, folder_uri); + g_return_if_fail (gtk_tree_row_reference_valid (reference)); + + path = gtk_tree_row_reference_get_path (reference); + gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path); + gtk_tree_path_free (path); + + gtk_tree_model_get ( + GTK_TREE_MODEL (model), &iter, + COL_UINT_UNREAD, &unread, -1); + + unread += n_marked; + + gtk_tree_store_set ( + GTK_TREE_STORE (model), &iter, + COL_UINT_UNREAD_LAST_SEL, unread, + COL_UINT_UNREAD, unread, -1); +} |