aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon@quotidian.org>2009-12-11 07:35:29 +0800
committerJonathon Jongsma <jonathon@quotidian.org>2009-12-16 04:16:08 +0800
commit6e73a7a8f31c3b890ad900960a24b930cfeb13ed (patch)
tree42047e57aed3514f897dee80512e511a78946d16
parent9c4f98e915d3f2848b9acc5e089bf3fc56ae2b0f (diff)
downloadgsoc2013-evolution-6e73a7a8f31c3b890ad900960a24b930cfeb13ed.tar.gz
gsoc2013-evolution-6e73a7a8f31c3b890ad900960a24b930cfeb13ed.tar.zst
gsoc2013-evolution-6e73a7a8f31c3b890ad900960a24b930cfeb13ed.zip
Add signals to MailFolderCache for common events
This will allow us to decouple ourselves from some of the current dependencies, such as the folder treemodel, the shell, etc. This just defines the signals, the next step is to refactor things and actually make other classes use them. We need one additional signal yet related to indicating the new unread emails, but that one will require a little more thought I think. https://bugzilla.gnome.org/show_bug.cgi?id=604627
-rw-r--r--e-util/e-marshal.list3
-rw-r--r--mail/mail-folder-cache.c83
2 files changed, 86 insertions, 0 deletions
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index 813234b4d6..4346d4359e 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -38,6 +38,9 @@ NONE:POINTER,INT,INT,INT,INT
NONE:POINTER,INT,OBJECT
NONE:POINTER,POINTER
NONE:POINTER,POINTER,INT
+NONE:POINTER,STRING
+NONE:POINTER,STRING,STRING
+NONE:POINTER,STRING,INT
NONE:STRING,DOUBLE
NONE:STRING,INT,INT
NONE:STRING,POINTER,POINTER
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 39ef7d2074..9d9a9b4ec2 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -49,6 +49,7 @@
#include <libedataserver/e-data-server-util.h>
#include "shell/e-shell.h"
+#include "e-util/e-marshal.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
@@ -94,6 +95,17 @@ struct _MailFolderCachePrivate
gint count_trash;
};
+enum
+{
+ FOLDER_AVAILABLE,
+ FOLDER_UNAVAILABLE,
+ FOLDER_DELETED,
+ FOLDER_RENAMED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
struct _folder_info {
struct _store_info *store_info; /* 'parent' link */
@@ -1197,6 +1209,77 @@ mail_folder_cache_class_init (MailFolderCacheClass *klass)
object_class->dispose = mail_folder_cache_dispose;
object_class->finalize = mail_folder_cache_finalize;
+
+ /**
+ * MailFolderCache::folder-available
+ * @store: the #CamelStore containing the folder
+ * @uri: the uri of the folder
+ *
+ * Emitted when a folder becomes available
+ **/
+ signals[FOLDER_AVAILABLE] =
+ g_signal_new ("folder-available",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, /* struct offset */
+ NULL, NULL, /* accumulator */
+ e_marshal_VOID__POINTER_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER, G_TYPE_STRING);
+
+ /**
+ * MailFolderCache::folder-unavailable
+ * @store: the #CamelStore containing the folder
+ * @uri: the uri of the folder
+ *
+ * Emitted when a folder becomes unavailable. This represents a
+ * transient condition. See MailFolderCache::folder-deleted to be
+ * notified when a folder is permanently removed.
+ **/
+ signals[FOLDER_UNAVAILABLE] =
+ g_signal_new ("folder-unavailable",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, /* struct offset */
+ NULL, NULL, /* accumulator */
+ e_marshal_VOID__POINTER_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER, G_TYPE_STRING);
+
+ /**
+ * MailFolderCache::folder-deleted
+ * @store: the #CamelStore containing the folder
+ * @uri: the uri of the folder
+ *
+ * Emitted when a folder is deleted
+ **/
+ signals[FOLDER_DELETED] =
+ g_signal_new ("folder-deleted",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, /* struct offset */
+ NULL, NULL, /* accumulator */
+ e_marshal_VOID__POINTER_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER, G_TYPE_STRING);
+
+ /**
+ * MailFolderCache::folder-renamed
+ * @store: the #CamelStore containing the folder
+ * @old_uri: the old uri of the folder
+ * @new_uri: the new uri of the folder
+ *
+ * Emitted when a folder is renamed
+ **/
+ signals[FOLDER_RENAMED] =
+ g_signal_new ("folder-renamed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, /* struct offset */
+ NULL, NULL, /* accumulator */
+ e_marshal_VOID__POINTER_STRING_STRING,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
}
static void