diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-10 04:29:49 +0800 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-16 04:16:08 +0800 |
commit | 65705e4f55560889ac6de638aa8f3245c06349c0 (patch) | |
tree | 0c87f3c1efab739717a77f914a33085ca67fa2ab /mail/mail-folder-cache.h | |
parent | b8efcdb8d6fc81c4b942bde4acd83f83b15791de (diff) | |
download | gsoc2013-evolution-65705e4f55560889ac6de638aa8f3245c06349c0.tar.gz gsoc2013-evolution-65705e4f55560889ac6de638aa8f3245c06349c0.tar.zst gsoc2013-evolution-65705e4f55560889ac6de638aa8f3245c06349c0.zip |
Make the mail folder cache a proper GObject
mail-folder-cache previously was a bit of a pseudo object (sort of a singleton)
that operated on some file static data. This commit re-factors things so that
it is a proper class named MailFolderCache. At the moment, this doesn't gain us
much, but in the future, it will allow us to add signals, etc so that we can
de-couple a lot of the interdependencies in here. This is essentially a
pre-requisite to splitting up a lot of the mail backend stuff.
https://bugzilla.gnome.org/show_bug.cgi?id=604627
Diffstat (limited to 'mail/mail-folder-cache.h')
-rw-r--r-- | mail/mail-folder-cache.h | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h index 41f36ac0cf..762152ffdd 100644 --- a/mail/mail-folder-cache.h +++ b/mail/mail-folder-cache.h @@ -14,10 +14,12 @@ * * * Authors: - * Peter Williams <peterw@ximian.com> - * Michael Zucchi <notzed@ximian.com> + * Peter Williams <peterw@ximian.com> + * Michael Zucchi <notzed@ximian.com> + * Jonathon Jongsma <jonathon.jongsma@collabora.co.uk> * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * Copyright (C) 2009 Intel Corporation * */ @@ -26,29 +28,64 @@ #ifndef _MAIL_FOLDER_CACHE_H #define _MAIL_FOLDER_CACHE_H +#include <glib-object.h> #include <camel/camel-store.h> +G_BEGIN_DECLS + +/* Stores information about open folders */ + +#define MAIL_TYPE_FOLDER_CACHE mail_folder_cache_get_type() +#define MAIL_FOLDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_TYPE_FOLDER_CACHE, MailFolderCache)) +#define MAIL_FOLDER_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_TYPE_FOLDER_CACHE, MailFolderCacheClass)) +#define MAIL_IS_FOLDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_TYPE_FOLDER_CACHE)) +#define MAIL_IS_FOLDER_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIL_TYPE_FOLDER_CACHE)) +#define MAIL_FOLDER_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIL_TYPE_FOLDER_CACHE, MailFolderCacheClass)) + +typedef struct _MailFolderCache MailFolderCache; +typedef struct _MailFolderCacheClass MailFolderCacheClass; +typedef struct _MailFolderCachePrivate MailFolderCachePrivate; + +struct _MailFolderCache +{ + GObject parent; + + MailFolderCachePrivate *priv; +}; + +struct _MailFolderCacheClass +{ + GObjectClass parent_class; +}; + +GType mail_folder_cache_get_type (void) G_GNUC_CONST; + +MailFolderCache *mail_folder_cache_new (void); + +MailFolderCache *mail_folder_cache_get_default (void); + +typedef gboolean (*NoteDoneFunc)(CamelStore *store, CamelFolderInfo *info, gpointer data); /* Add a store whose folders should appear in the shell The folders are scanned from the store, and/or added at runtime via the folder_created event. The 'done' function returns if we can free folder info. */ -void -mail_note_store (CamelStore *store, CamelOperation *op, - gboolean (*done) (CamelStore *store, CamelFolderInfo *info, gpointer data), - gpointer data); +void mail_folder_cache_note_store (MailFolderCache *self, + CamelStore *store, CamelOperation *op, + NoteDoneFunc func, gpointer data); /* de-note a store */ -void mail_note_store_remove (CamelStore *store); +void mail_folder_cache_note_store_remove (MailFolderCache *self, CamelStore *store); /* When a folder has been opened, notify it for watching. The folder must have already been created on the store (which has already been noted) before the folder can be opened */ -void mail_note_folder (CamelFolder *folder); +void mail_folder_cache_note_folder (MailFolderCache *self, CamelFolder *folder); /* Returns true if a folder is available (yet), and also sets *folderp (if supplied) to a (referenced) copy of the folder if it has already been opened */ -gint mail_note_get_folder_from_uri (const gchar *uri, CamelFolder **folderp); -gboolean mail_folder_cache_get_folder_info_flags (CamelFolder *folder, gint *flags); +gboolean mail_folder_cache_get_folder_from_uri (MailFolderCache *self, const gchar *uri, CamelFolder **folderp); +gboolean mail_folder_cache_get_folder_info_flags (MailFolderCache *self, CamelFolder *folder, gint *flags); +G_END_DECLS #endif |