## MailFolderCache MailFolderCache — Stores information about open folders |

## Functions

MailFolderCache * | mail_folder_cache_new ()
GMainContext * | mail_folder_cache_ref_main_context ()
void | mail_folder_cache_note_store ()
gboolean | mail_folder_cache_note_store_finish ()
void | mail_folder_cache_note_folder ()
gboolean | mail_folder_cache_has_folder_info ()
CamelFolder * | mail_folder_cache_ref_folder ()
gboolean | mail_folder_cache_get_folder_info_flags ()
void | mail_folder_cache_get_local_folder_uris ()
void | mail_folder_cache_get_remote_folder_uris ()
void | mail_folder_cache_service_removed ()
void | mail_folder_cache_service_enabled ()
void | mail_folder_cache_service_disabled ()

## Properties

GMainContext * | main-context | Read

## Signals

void | folder-available | Run First
void | folder-changed | Run First
void | folder-deleted | Run First
void | folder-renamed | Run First
void | folder-unavailable | Run First
void | folder-unread-updated | Run First

## Types and Values

struct | MailFolderCache

## Object Hierarchy

        GObject
        ╰── MailFolderCache

## Description

## Functions

### 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.

#### Parameters

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.

#### Parameters

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`.

#### Parameters

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);

## Types and Values

### struct MailFolderCache

    struct MailFolderCache;

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

## Property Details

### The `“main-context”` property

      “main-context”             GMainContext *

The main loop context on which to attach event sources.

Flags: Read

## Signal Details

### The `“folder-available”` signal

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

Emitted when a folder becomes available

#### Parameters

store | the CamelStore containing the folder |
folder_name | the name of the folder |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### 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)

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

#### Parameters

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. |

Flags: Run First

### The `“folder-deleted”` signal

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

Emitted when a folder is deleted

#### Parameters

store | the CamelStore containing the folder |
folder_name | the name of the folder |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“folder-renamed”` signal

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

Emitted when a folder is renamed

#### Parameters

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. |

Flags: Run First

### The `“folder-unavailable”` signal

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

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

#### Parameters

store | the CamelStore containing the folder |
folder_name | the name of the folder |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“folder-unread-updated”` signal

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

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

#### Parameters

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. |

Flags: Run First