diff options
author | Milan Crha <mcrha@redhat.com> | 2009-06-05 17:02:59 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-06-09 18:51:19 +0800 |
commit | df11214362bdf85757dccd301b56dc742848ff86 (patch) | |
tree | 696ace3d30269de22a77b0d33a72637d69bb970c | |
parent | df17adc5aa4ff6af69686d0957e1ab6dfa58732d (diff) | |
download | gsoc2013-evolution-df11214362bdf85757dccd301b56dc742848ff86.tar.gz gsoc2013-evolution-df11214362bdf85757dccd301b56dc742848ff86.tar.zst gsoc2013-evolution-df11214362bdf85757dccd301b56dc742848ff86.zip |
Bug #362907 - Give icons to Drafts/Sent/Templates folders
-rw-r--r-- | mail/em-folder-tree-model.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index ea2ddebd93..b67e0eb532 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -570,11 +570,13 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite GtkTreePath *path; GtkTreeIter sub; gboolean load = FALSE; + gboolean is_drafts = FALSE; + gboolean is_template = FALSE; CamelFolder *folder; gboolean emitted = FALSE; const gchar *name; const gchar *icon_name; - guint32 flags; + guint32 flags, add_flags = 0; EMEventTargetCustomIcon *target; /* make sure we don't already know about it? */ @@ -643,8 +645,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite if (si->store == e_mail_shell_backend_get_local_store (mail_shell_backend)) { if (!strcmp(fi->full_name, "Drafts")) { name = _("Drafts"); + is_drafts = TRUE; } else if (!strcmp(fi->full_name, "Templates")) { name = _("Templates"); + is_templates = TRUE; } else if (!strcmp(fi->full_name, "Inbox")) { flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_INBOX; name = _("Inbox"); @@ -657,8 +661,31 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite } } + if (si->account && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) { + if (!is_drafts && si->account->drafts_folder_uri) { + gchar *curi = em_uri_to_camel (si->account->drafts_folder_uri); + is_drafts = camel_store_folder_uri_equal (si->store, fi->uri, curi); + g_free (curi); + } + + if (si->account->sent_folder_uri) { + gchar *curi = em_uri_to_camel (si->account->sent_folder_uri); + if (camel_store_folder_uri_equal (si->store, fi->uri, curi)) { + add_flags = CAMEL_FOLDER_TYPE_SENT; + } + g_free(curi); + } + } + /* Choose an icon name for the folder. */ - icon_name = em_folder_utils_get_icon_name (flags); + icon_name = em_folder_utils_get_icon_name (flags | add_flags); + + if (g_str_equal (icon_name, "folder")) { + if (is_drafts) + icon_name = "accessories-text-editor"; + else if (is_templates) + icon_name = "text-x-generic-template"; + } gtk_tree_store_set ( tree_store, iter, |