aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-05 01:08:40 +0800
committerDan Winship <danw@src.gnome.org>2001-01-05 01:08:40 +0800
commit495030c715bc440ab4a57f7e6f49d8b711953906 (patch)
treecb0a371388ebd39d6415c0f9d480fa414d36661c /mail
parentf9f6c398725a2e0969e23753106edfb896ea5930 (diff)
downloadgsoc2013-evolution-495030c715bc440ab4a57f7e6f49d8b711953906.tar.gz
gsoc2013-evolution-495030c715bc440ab4a57f7e6f49d8b711953906.tar.zst
gsoc2013-evolution-495030c715bc440ab4a57f7e6f49d8b711953906.zip
Connect to "message_changed" on the folder if it's on a remote storage.
* folder-browser.c (got_folder): Connect to "message_changed" on the folder if it's on a remote storage. (update_unread_count): Update the folder unread count / highlight in the shell when the unread message count changes svn path=/trunk/; revision=7249
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/folder-browser.c39
-rw-r--r--mail/folder-browser.h1
3 files changed, 46 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 3ff21a0ac4..af6aa2f51f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2001-01-04 Dan Winship <danw@helixcode.com>
+
+ * folder-browser.c (got_folder): Connect to "message_changed" on
+ the folder if it's on a remote storage.
+ (update_unread_count): Update the folder unread count / highlight
+ in the shell when the unread message count changes
+
2001-01-04 Not Zed <NotZed@HelixCode.com>
* mail-ops.c (mail_do_send_mail): Removed old implementation.
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index b05b474686..e61d317704 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -107,7 +107,38 @@ folder_browser_class_init (GtkObjectClass *object_class)
* }
*/
-#define EQUAL(a,b) (strcmp (a,b) == 0)
+static void
+update_unread_count_main(CamelObject *object, gpointer event_data, gpointer user_data)
+{
+ CamelFolder *folder = (CamelFolder *)object;
+ FolderBrowser *fb = user_data;
+ EvolutionStorage *storage;
+ char *name;
+
+ storage = mail_lookup_storage (folder->parent_store);
+
+ if (fb->unread_count == 0)
+ name = g_strdup (camel_folder_get_name (folder));
+ else
+ name = g_strdup_printf ("%s (%d)", camel_folder_get_name (folder), fb->unread_count);
+
+ evolution_storage_update_folder_by_uri (storage, fb->uri, name, fb->unread_count != 0);
+ g_free (name);
+}
+
+static void
+update_unread_count(CamelObject *object, gpointer event_data, gpointer user_data)
+{
+ CamelFolder *folder = (CamelFolder *)object;
+ FolderBrowser *fb = user_data;
+ int unread;
+
+ unread = camel_folder_get_unread_message_count (folder);
+ if (unread == fb->unread_count)
+ return;
+ fb->unread_count = unread;
+ mail_proxy_event (update_unread_count_main, object, event_data, user_data);
+}
static void
got_folder(char *uri, CamelFolder *folder, void *data)
@@ -130,6 +161,12 @@ got_folder(char *uri, CamelFolder *folder, void *data)
camel_object_ref((CamelObject *)folder);
+ if (mail_lookup_storage (folder->parent_store)) {
+ fb->unread_count = -1;
+ camel_object_hook_event ((CamelObject *)folder, "message_changed",
+ update_unread_count, fb);
+ }
+
gtk_widget_set_sensitive (GTK_WIDGET (fb->search->entry),
camel_folder_has_search_capability (folder));
gtk_widget_set_sensitive (GTK_WIDGET (fb->search->option),
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index 41d282b7e5..3c07cbdbe0 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -35,6 +35,7 @@ struct _FolderBrowser {
*/
char *uri;
CamelFolder *folder;
+ int unread_count; /* last known unread message count */
/* async loading stuff */
char *loading_uid;/* what uid am i loading now */