MailFolderCache

MailFolderCache — Stores information about open folders

Synopsis

struct              MailFolderCache;
MailFolderCache *   mail_folder_cache_new               (void);
GMainContext *      mail_folder_cache_ref_main_context  (MailFolderCache *cache);
void                mail_folder_cache_note_store        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            mail_folder_cache_note_store_finish (MailFolderCache *cache,
                                                         GAsyncResult *result,
                                                         CamelFolderInfo **out_info,
                                                         GError **error);
void                mail_folder_cache_note_folder       (MailFolderCache *cache,
                                                         CamelFolder *folder);
gboolean            mail_folder_cache_has_folder_info   (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name);
CamelFolder *       mail_folder_cache_ref_folder        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name);
gboolean            mail_folder_cache_get_folder_info_flags
                                                        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name,
                                                         CamelFolderInfoFlags *flags);
void                mail_folder_cache_get_local_folder_uris
                                                        (MailFolderCache *cache,
                                                         GQueue *out_queue);
void                mail_folder_cache_get_remote_folder_uris
                                                        (MailFolderCache *cache,
                                                         GQueue *out_queue);
void                mail_folder_cache_service_removed   (MailFolderCache *cache,
                                                         CamelService *service);
void                mail_folder_cache_service_enabled   (MailFolderCache *cache,
                                                         CamelService *service);
void                mail_folder_cache_service_disabled  (MailFolderCache *cache,
                                                         CamelService *service);

Object Hierarchy

  GObject
   +----MailFolderCache

Properties

  "main-context"             GMainContext*         : Read

Signals

  "folder-available"                               : Run First
  "folder-changed"                                 : Run First
  "folder-deleted"                                 : Run First
  "folder-renamed"                                 : Run First
  "folder-unavailable"                             : Run First
  "folder-unread-updated"                          : Run First

Description

Details

struct MailFolderCache

struct MailFolderCache;

Contains only private data that should be read and manipulated using the functions below.


mail_folder_cache_new ()

MailFolderCache *   mail_folder_cache_new               (void);

mail_folder_cache_ref_main_context ()

GMainContext *      mail_folder_cache_ref_main_context  (MailFolderCache *cache);

Returns the GMainContext on which event sources for cache are to be attached.

The returned GMainContext is referenced for thread-safety and should be unreferenced with g_main_context_unref() when finished with it.

Returns :

a GMainContext

mail_folder_cache_note_store ()

void                mail_folder_cache_note_store        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_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.


mail_folder_cache_note_store_finish ()

gboolean            mail_folder_cache_note_store_finish (MailFolderCache *cache,
                                                         GAsyncResult *result,
                                                         CamelFolderInfo **out_info,
                                                         GError **error);

mail_folder_cache_note_folder ()

void                mail_folder_cache_note_folder       (MailFolderCache *cache,
                                                         CamelFolder *folder);

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


mail_folder_cache_has_folder_info ()

gboolean            mail_folder_cache_has_folder_info   (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name);

Returns whether cache has information about the folder described by store and folder_name. This does not necessarily mean it has the CamelFolder instance, but it at least has some meta-data about it.

You can use this function as a folder existence test.

cache :

a MailFolderCache

store :

a CamelStore

folder_name :

a folder name

Returns :

TRUE if cache has folder info, FALSE otherwise

mail_folder_cache_ref_folder ()

CamelFolder *       mail_folder_cache_ref_folder        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name);

Returns the CamelFolder for store and folder_name if available, or else NULL if a CamelFolder instance is not yet cached. This function does not block.

The returned CamelFolder is referenced for thread-safety and must be unreferenced with g_object_unref() when finished with it.

cache :

a MailFolderCache

store :

a CamelStore

folder_name :

a folder name

Returns :

a CamelFolder, or NULL

mail_folder_cache_get_folder_info_flags ()

gboolean            mail_folder_cache_get_folder_info_flags
                                                        (MailFolderCache *cache,
                                                         CamelStore *store,
                                                         const gchar *folder_name,
                                                         CamelFolderInfoFlags *flags);

Obtains CamelFolderInfoFlags for store and folder_name if available, and returns TRUE to indicate flags was set. If no folder information is available for store and folder_name, the function returns FALSE.

cache :

a MailFolderCache

store :

a CamelStore

folder_name :

a folder name

flags :

return location for CamelFolderInfoFlags

Returns :

whether flags was set

mail_folder_cache_get_local_folder_uris ()

void                mail_folder_cache_get_local_folder_uris
                                                        (MailFolderCache *cache,
                                                         GQueue *out_queue);

mail_folder_cache_get_remote_folder_uris ()

void                mail_folder_cache_get_remote_folder_uris
                                                        (MailFolderCache *cache,
                                                         GQueue *out_queue);

mail_folder_cache_service_removed ()

void                mail_folder_cache_service_removed   (MailFolderCache *cache,
                                                         CamelService *service);

mail_folder_cache_service_enabled ()

void                mail_folder_cache_service_enabled   (MailFolderCache *cache,
                                                         CamelService *service);

mail_folder_cache_service_disabled ()

void                mail_folder_cache_service_disabled  (MailFolderCache *cache,
                                                         CamelService *service);

Property Details

The "main-context" property

  "main-context"             GMainContext*         : Read

The main loop context on which to attach event sources.

Signal Details

The "folder-available" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *folder_name,
                                                        gchar           *arg2,
                                                        gpointer         user_data)        : Run First

Emitted when a folder becomes available

store :

the CamelStore containing the folder

folder_name :

the name of the folder

user_data :

user data set when the signal handler was connected.

The "folder-changed" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *folder_name,
                                                        gchar           *new_messages,
                                                        gint             msg_uid,
                                                        gchar           *msg_sender,
                                                        gchar           *msg_subject,
                                                        gchar           *arg6,
                                                        gpointer         user_data)         : Run First

Emitted when a folder has changed. If new_messages is not exactly 1, msg_uid, msg_sender, and msg_subject will be NULL.

store :

the CamelStore containing the folder

folder_name :

the 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

user_data :

user data set when the signal handler was connected.

The "folder-deleted" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *folder_name,
                                                        gchar           *arg2,
                                                        gpointer         user_data)        : Run First

Emitted when a folder is deleted

store :

the CamelStore containing the folder

folder_name :

the name of the folder

user_data :

user data set when the signal handler was connected.

The "folder-renamed" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *old_folder_name,
                                                        gchar           *new_folder_name,
                                                        gchar           *arg3,
                                                        gpointer         user_data)            : Run First

Emitted when a folder is renamed

store :

the CamelStore containing the folder

old_folder_name :

the old name of the folder

new_folder_name :

the new name of the folder

user_data :

user data set when the signal handler was connected.

The "folder-unavailable" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *folder_name,
                                                        gchar           *arg2,
                                                        gpointer         user_data)        : Run First

Emitted when a folder becomes unavailable. This represents a transient condition. See MailFolderCache::folder-deleted to be notified when a folder is permanently removed.

store :

the CamelStore containing the folder

folder_name :

the name of the folder

user_data :

user data set when the signal handler was connected.

The "folder-unread-updated" signal

void                user_function                      (MailFolderCache *store,
                                                        CamelStore      *folder_name,
                                                        gchar           *unread,
                                                        gint             arg3,
                                                        gpointer         user_data)        : Run First

Emitted when a we receive an update to the unread count for a folder

store :

the CamelStore containing the folder

folder_name :

the name of the folder

unread :

the number of unread mails in the folder

user_data :

user data set when the signal handler was connected.