aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-04-14 00:00:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-04-14 00:00:21 +0800
commitdfb793f762502fcc73a91c1e6799ee29cbbf5169 (patch)
tree5eee47af4eb8f3fc2abcba1f92b3a73aa6adda20 /mail
parent8563120ccac076a0baf9cb904c23a87bbb59d960 (diff)
downloadgsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar.gz
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar.bz2
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar.lz
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar.xz
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.tar.zst
gsoc2013-evolution-dfb793f762502fcc73a91c1e6799ee29cbbf5169.zip
track the messagelist hidedeleted value since it looks it up when we set
004-04-13 Not Zed <NotZed@Ximian.com> * em-folder-view.c (emfv_set_folder): track the messagelist hidedeleted value since it looks it up when we set the folder. * em-folder-browser.c (emfb_hide_deleted): use new method below to propagate change. (emfb_activate): same. * em-folder-view.c (em_folder_view_set_hide_deleted): accessor to set the hide_deleted state, emits a view_changed event. * mail-component.c (view_changed_cb): use VISIBLE rather than TOTAL for the displayed total count. Also deleted if we're not in hide deleted mode. And do spethal things with spethal folders, etc. svn path=/trunk/; revision=25438
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-folder-browser.c12
-rw-r--r--mail/em-folder-view.c15
-rw-r--r--mail/em-folder-view.h1
-rw-r--r--mail/mail-component.c44
5 files changed, 70 insertions, 17 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index bc7604cffe..c75edf6dcc 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,20 @@
2004-04-13 Not Zed <NotZed@Ximian.com>
+ * em-folder-view.c (emfv_set_folder): track the messagelist
+ hidedeleted value since it looks it up when we set the folder.
+
+ * em-folder-browser.c (emfb_hide_deleted): use new method below to
+ propagate change.
+ (emfb_activate): same.
+
+ * em-folder-view.c (em_folder_view_set_hide_deleted): accessor to
+ set the hide_deleted state, emits a view_changed event.
+
+ * mail-component.c (view_changed_cb): use VISIBLE rather than
+ TOTAL for the displayed total count. Also deleted if we're not in
+ hide deleted mode. And do spethal things with spethal folders,
+ etc.
+
* mail-ops.c (mail_refresh_folder): run this in the
thread_queued_slow, so it runs in sequence and after folder_sync.
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index fb9b2528e1..e09277a09a 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -738,10 +738,7 @@ emfb_hide_deleted(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E
gconf = mail_config_get_gconf_client ();
gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_deleted", state[0] == '0', NULL);
- if (!(emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))) {
- message_list_set_hidedeleted(emfv->list, state[0] != '0');
- emfv->hide_deleted = state[0] != '0';
- }
+ em_folder_view_set_hide_deleted(emfv, state[0] != '0');
}
static void
@@ -1015,7 +1012,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
if (act) {
GConfClient *gconf;
- gboolean state;
+ gboolean state, newstate;
char *sstate;
gconf = mail_config_get_gconf_client ();
@@ -1057,9 +1054,8 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
state = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL);
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
bonobo_ui_component_add_listener(uic, "HideDeleted", emfb_hide_deleted, emfv);
- if (!(emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)))
- message_list_set_hidedeleted (emfv->list, state);
- else
+ em_folder_view_set_hide_deleted(emfv, state); /* <- not sure if this optimal, but it'll do */
+ if (emfv->folder == NULL)
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", state?"1":"0", NULL);
/* FIXME: If we have no folder, we can't do a few of the lookups we need,
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 255cb9c3a6..f87aee7f8e 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -387,6 +387,7 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
emfv->folder_uri = g_strdup(uri);
if (emfv->folder) {
+ emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */
mail_sync_folder (emfv->folder, NULL, NULL);
camel_object_remove_event(emfv->folder, emfv->priv->folder_changed_id);
camel_object_unref(emfv->folder);
@@ -1741,6 +1742,20 @@ em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar)
"<status><item name=\"main\"/></status>", NULL);
}
+void
+em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status)
+{
+ if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))
+ status = FALSE;
+
+ emfv->hide_deleted = status;
+
+ if (emfv->folder) {
+ message_list_set_hidedeleted(emfv->list, status);
+ g_signal_emit(emfv, signals[EMFV_CHANGED], 0);
+ }
+}
+
/* ********************************************************************** */
struct mst_t {
diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h
index bae624a6fc..23bed7b715 100644
--- a/mail/em-folder-view.h
+++ b/mail/em-folder-view.h
@@ -126,6 +126,7 @@ int em_folder_view_print(EMFolderView *emfv, int preview);
guint32 em_folder_view_disable_mask(EMFolderView *emfv);
void em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar);
+void em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status);
#ifdef __cplusplus
}
diff --git a/mail/mail-component.c b/mail/mail-component.c
index e8b6d3ccf4..f025b79f2a 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -73,8 +73,8 @@
#include <gal/e-table/e-tree.h>
#include <gal/e-table/e-tree-memory.h>
-#include <camel/camel.h>
#include <camel/camel-file-utils.h>
+#include <camel/camel-vtrash-folder.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
@@ -456,14 +456,40 @@ static void
view_changed_cb(EMFolderView *emfv, EInfoLabel *el)
{
if (emfv->folder) {
- char *tmp, *name;
- guint32 total, unread;
-
- camel_object_get(emfv->folder, NULL, CAMEL_FOLDER_NAME, &name, CAMEL_FOLDER_TOTAL, &total, CAMEL_FOLDER_UNREAD, &unread, NULL);
- /* Format of text for component information area */
- tmp = g_strdup_printf(_("%d total, %d unread"), total, unread);
- e_info_label_set_info(el, name, tmp);
- g_free(tmp);
+ char *name;
+ guint32 visible, unread, deleted, junked;
+ GString *tmp = g_string_new("");
+
+ camel_object_get(emfv->folder, NULL,
+ CAMEL_FOLDER_NAME, &name,
+ CAMEL_FOLDER_DELETED, &deleted,
+ CAMEL_FOLDER_VISIBLE, &visible,
+ CAMEL_FOLDER_JUNKED, &junked,
+ CAMEL_FOLDER_UNREAD, &unread, NULL);
+
+ if (CAMEL_IS_VTRASH_FOLDER(emfv->folder)) {
+ if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_TRASH)
+ g_string_append_printf(tmp, _("%d deleted"), deleted);
+ else
+ g_string_append_printf(tmp, _("%d junk"), junked);
+ } else {
+ if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri))
+ g_string_append_printf(tmp, _("%d drafts"), visible);
+ else if (em_utils_folder_is_sent(emfv->folder, emfv->folder_uri))
+ g_string_append_printf(tmp, _("%d sent"), visible);
+ else if (em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri))
+ g_string_append_printf(tmp, _("%d unsent"), visible);
+ else {
+ if (!emfv->hide_deleted)
+ visible += deleted;
+ g_string_append_printf(tmp, _("%d total"), visible);
+ if (unread)
+ g_string_append_printf(tmp, _(", %d unread"), unread);
+ }
+ }
+
+ e_info_label_set_info(el, name, tmp->str);
+ g_string_free(tmp, TRUE);
camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name);
} else {
e_info_label_set_info(el, _("Mail"), "");