aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-07 00:40:02 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-07 00:58:55 +0800
commitbf5647aa4774c73491392d3e37da2e00691331f9 (patch)
tree155bb17d0e09793a63bca413f77daf8a34034da2 /mail
parent48309e3765ba8fae248a1ec6f9f8a1ab395a92a8 (diff)
downloadgsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar.gz
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar.bz2
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar.lz
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar.xz
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.tar.zst
gsoc2013-evolution-bf5647aa4774c73491392d3e37da2e00691331f9.zip
MailFolderCache: Drop folder URI in "folder-changed" signal.
We already include a CamelStore and folder name string in the signal arguments, so it's trivial to reconstruct the URI if it's needed.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-backend.c7
-rw-r--r--mail/mail-folder-cache.c50
2 files changed, 24 insertions, 33 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 43d5b7471c..86ffc92ef0 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -35,6 +35,7 @@
#include "shell/e-shell.h"
+#include "mail/e-mail-folder-utils.h"
#include "mail/e-mail-local.h"
#include "mail/e-mail-migrate.h"
#include "mail/e-mail-session.h"
@@ -350,7 +351,6 @@ mail_backend_folder_renamed_cb (MailFolderCache *folder_cache,
static void
mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
CamelStore *store,
- const gchar *folder_uri,
const gchar *folder_fullname,
gint new_messages,
const gchar *msg_uid,
@@ -364,9 +364,12 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
EMFolderTreeModel *model;
EAccount *account;
const gchar *uid;
+ gchar *folder_uri;
gint folder_type;
gint flags = 0;
+ folder_uri = e_mail_folder_uri_build (store, folder_fullname);
+
if (mail_folder_cache_get_folder_from_uri (
folder_cache, folder_uri, &folder))
if (folder && !mail_folder_cache_get_folder_info_flags (
@@ -403,6 +406,8 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
e_event_emit (
(EEvent *) event, "folder.changed",
(EEventTarget *) target);
+
+ g_free (folder_uri);
}
static void
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index f9159b6801..7edefd3782 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -92,7 +92,6 @@ struct _folder_info {
struct _store_info *store_info; /* 'parent' link */
gchar *full_name; /* full name of folder/folderinfo */
- gchar *uri; /* uri of folder */
guint32 flags;
gboolean has_children;
@@ -109,9 +108,7 @@ struct _folder_update {
guint new; /* new mail arrived? */
gchar *full_name;
- gchar *uri;
gchar *oldfull;
- gchar *olduri;
gint unread;
CamelStore *store;
@@ -136,11 +133,9 @@ static void
free_update (struct _folder_update *up)
{
g_free (up->full_name);
- g_free (up->uri);
if (up->store)
g_object_unref (up->store);
g_free (up->oldfull);
- g_free (up->olduri);
g_free (up->msg_uid);
g_free (up->msg_sender);
g_free (up->msg_subject);
@@ -175,10 +170,10 @@ flush_updates_idle_cb (MailFolderCache *self)
up->store, up->full_name, up->unread);
/* indicate that the folder has changed (new mail received, etc) */
- if (up->uri) {
+ if (up->store != NULL && up->full_name != NULL) {
g_signal_emit (
self, signals[FOLDER_CHANGED], 0, up->store,
- up->uri, up->full_name, up->new, up->msg_uid,
+ up->full_name, up->new, up->msg_uid,
up->msg_sender, up->msg_subject);
}
@@ -299,7 +294,6 @@ update_1folder (MailFolderCache *self,
up->unread = unread;
up->new = new;
up->store = g_object_ref (mfi->store_info->store);
- up->uri = g_strdup (mfi->uri);
up->msg_uid = g_strdup (msg_uid);
up->msg_sender = g_strdup (msg_sender);
up->msg_subject = g_strdup (msg_subject);
@@ -424,7 +418,6 @@ unset_folder_info (MailFolderCache *self,
up->unsub = unsub;
up->store = g_object_ref (mfi->store_info->store);
up->full_name = g_strdup (mfi->full_name);
- up->uri = g_strdup (mfi->uri);
g_queue_push_tail (&self->priv->updates, up);
flush_updates (self);
@@ -435,7 +428,6 @@ static void
free_folder_info (struct _folder_info *mfi)
{
g_free (mfi->full_name);
- g_free (mfi->uri);
g_free (mfi);
}
@@ -449,10 +441,8 @@ setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si
if (mfi) {
update_1folder (self, mfi, 0, NULL, NULL, NULL, fi);
} else {
- d(printf("Adding new folder: %s (%s)\n", fi->full_name, fi->uri));
mfi = g_malloc0 (sizeof (*mfi));
mfi->full_name = g_strdup (fi->full_name);
- mfi->uri = g_strdup (fi->uri);
mfi->store_info = si;
mfi->flags = fi->flags;
mfi->has_children = fi->child != NULL;
@@ -461,7 +451,6 @@ setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si
up = g_malloc0 (sizeof (*up));
up->full_name = g_strdup (mfi->full_name);
- up->uri = g_strdup (fi->uri);
up->unread = fi->unread;
up->store = g_object_ref (si->store);
@@ -476,8 +465,6 @@ setup_folder (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si
static void
create_folders (MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si)
{
- d(printf("Setup new folder: %s\n %s\n", fi->uri, fi->full_name));
-
while (fi) {
setup_folder (self, fi, si);
@@ -604,12 +591,10 @@ rename_folders (MailFolderCache *self,
d(printf("Found old folder '%s' renaming to '%s'\n", mfi->full_name, fi->full_name));
up->oldfull = mfi->full_name;
- up->olduri = mfi->uri;
/* Its a rename op */
g_hash_table_remove (si->folders, mfi->full_name);
mfi->full_name = g_strdup (fi->full_name);
- mfi->uri = g_strdup (fi->uri);
mfi->flags = fi->flags;
mfi->has_children = fi->child != NULL;
@@ -619,7 +604,6 @@ rename_folders (MailFolderCache *self,
/* Its a new op */
mfi = g_malloc0 (sizeof (*mfi));
mfi->full_name = g_strdup (fi->full_name);
- mfi->uri = g_strdup (fi->uri);
mfi->store_info = si;
mfi->flags = fi->flags;
mfi->has_children = fi->child != NULL;
@@ -628,7 +612,6 @@ rename_folders (MailFolderCache *self,
}
up->full_name = g_strdup (mfi->full_name);
- up->uri = g_strdup (mfi->uri);
up->unread = fi->unread==-1?0:fi->unread;
up->store = g_object_ref (si->store);
@@ -1034,26 +1017,29 @@ mail_folder_cache_class_init (MailFolderCacheClass *class)
/**
* MailFolderCache::folder-changed
* @store: the #CamelStore containing the folder
- * @folder_uri: the uri of the folder
* @folder_fullname: the full name of the folder
* @new_messages: the number of new messages for the folder
* @msg_uid: uid of the new message, or NULL
* @msg_sender: sender of the new message, or NULL
* @msg_subject: subject of the new message, or NULL
*
- * Emitted when a folder has changed. If @new_messages is not exactly 1,
- * @msgt_uid, @msg_sender, and @msg_subject will be NULL.
+ * Emitted when a folder has changed. If @new_messages is not
+ * exactly 1, @msg_uid, @msg_sender, and @msg_subject will be NULL.
**/
- signals[FOLDER_CHANGED] =
- g_signal_new ("folder-changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- 0, /* struct offset */
- NULL, NULL, /* accumulator */
- e_marshal_VOID__OBJECT_STRING_STRING_INT_STRING_STRING_STRING,
- G_TYPE_NONE, 7,
- CAMEL_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ signals[FOLDER_CHANGED] = g_signal_new (
+ "folder-changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, /* struct offset */
+ NULL, NULL, /* accumulator */
+ e_marshal_VOID__OBJECT_STRING_INT_STRING_STRING_STRING,
+ G_TYPE_NONE, 6,
+ CAMEL_TYPE_STORE,
+ G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
}
static void