aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree-model.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-02-01 15:41:49 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-02-01 15:41:49 +0800
commit347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0 (patch)
treeef0bce083dd39108268abb3469ceec1c12dc410b /mail/em-folder-tree-model.c
parent55b25cdd13d43105fe4cca4e27e1de9e51fd49ef (diff)
downloadgsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.tar.gz
gsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.tar.zst
gsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.zip
use the type hint to sort for inbox, not the name.
2005-02-01 Not Zed <NotZed@Ximian.com> * em-folder-tree-model.c (sort_cb): use the type hint to sort for inbox, not the name. (emft_is_special_local_folder): removed. (em_folder_tree_model_set_folder_info): special-case the local-store case, handle translated names and the name hints. * em-folder-tree.c (render_pixbuf): use the camel folderinfo folder type to determine the icon, don't hardcode based on name. ** See bug #71310 * em-composer-prefs.c (sig_add_script_response): force a save of the signatures as soon as they change. Also save the script name if we were just editing it, not just the signature name. svn path=/trunk/; revision=28653
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r--mail/em-folder-tree-model.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index da31fd4c12..446d2fbde5 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -184,12 +184,13 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
char *aname, *bname;
CamelStore *store;
gboolean is_store;
+ guint32 aflags, bflags;
int rv = -2;
gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store,
COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_DISPLAY_NAME, &aname, -1);
- gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, -1);
+ COL_STRING_DISPLAY_NAME, &aname, COL_UINT_FLAGS, &aflags, -1);
+ gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, COL_UINT_FLAGS, &bflags, -1);
if (is_store) {
/* On This Computer is always first and VFolders is always last */
@@ -209,9 +210,9 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
rv = -1;
} else {
/* Inbox is always first */
- if (aname && (!strcmp (aname, "INBOX") || !strcmp (aname, _("Inbox"))))
+ if ((aflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
rv = -1;
- else if (bname && (!strcmp (bname, "INBOX") || !strcmp (bname, _("Inbox"))))
+ else if ((bflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
rv = 1;
}
@@ -414,16 +415,6 @@ account_removed (EAccountList *accounts, EAccount *account, gpointer user_data)
em_folder_tree_model_remove_store (model, si->store);
}
-/* NB: more-or-less copied from em-folder-tree.c */
-static gboolean
-emft_is_special_local_folder(CamelStore *store, const char *name)
-{
- /* Bit of a hack to translate local mailbox names */
- return store == mail_component_peek_local_store(NULL)
- && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox")
- || !strcmp (name, "Outbox") || !strcmp (name, "Sent"));
-}
-
void
em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter,
struct _EMFolderTreeModelStoreInfo *si,
@@ -437,6 +428,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
struct _CamelFolder *folder;
gboolean emitted = FALSE;
const char *name;
+ guint32 flags;
if (!fully_loaded)
load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -468,10 +460,22 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
camel_object_unref(folder);
}
- if (emft_is_special_local_folder(si->store, fi->full_name))
- name = _(fi->name);
- else
- name = fi->name;
+ /* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */
+ flags = fi->flags;
+ name = fi->name;
+ if (si->store == mail_component_peek_local_store(NULL)) {
+ if (!strcmp(fi->full_name, "Drafts")) {
+ name = _("Drafts");
+ } else if (!strcmp(fi->full_name, "Inbox")) {
+ flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_INBOX;
+ name = _("Inbox");
+ } else if (!strcmp(fi->full_name, "Outbox")) {
+ flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_OUTBOX;
+ name = _("Outbox");
+ } else if (!strcmp(fi->full_name, "Sent")) {
+ name = _("Sent");
+ }
+ }
gtk_tree_store_set ((GtkTreeStore *) model, iter,
COL_STRING_DISPLAY_NAME, name,
@@ -479,7 +483,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
COL_STRING_FULL_NAME, fi->full_name,
COL_STRING_URI, fi->uri,
COL_UINT_UNREAD, unread,
- COL_UINT_FLAGS, fi->flags,
+ COL_UINT_FLAGS, flags,
COL_BOOL_IS_STORE, FALSE,
COL_BOOL_LOAD_SUBDIRS, load,
-1);