aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-04-14 22:59:36 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-04-14 22:59:36 +0800
commit8a6e09d1cfc5ae369b99dc5af13f9d8519fd3f5d (patch)
tree1546f241e42bd6864b8f48e402cb9d2fbfc16029 /mail/mail-ops.c
parentd6ca198aee8a30d691dfe38d2d86fcf7ee5ab327 (diff)
downloadgsoc2013-evolution-8a6e09d1cfc5ae369b99dc5af13f9d8519fd3f5d.tar.gz
gsoc2013-evolution-8a6e09d1cfc5ae369b99dc5af13f9d8519fd3f5d.tar.zst
gsoc2013-evolution-8a6e09d1cfc5ae369b99dc5af13f9d8519fd3f5d.zip
** Fix for bug #270406
2008-04-14 Milan Crha <mcrha@redhat.com> ** Fix for bug #270406 * em-folder-properties.c: (struct _prop_data), (emfp_free), (add_numbered_row), (emfp_get_folder_item), (emfp_dialog_got_folder_quota), (emfp_dialog_got_folder): Retrieve quota information for a folder and show it in a dialog. * mail-ops.h: (mail_get_folder_quota): * mail-ops.c: (struct _get_quota_msg), (get_quota_desc), (get_quota_exec), (get_quota_done), (get_quota_free), (MailMsgInfo get_quota_info), (mail_get_folder_quota): New operation to get folder's quota information. svn path=/trunk/; revision=35366
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 36f45efe6e..d13740570d 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1253,6 +1253,75 @@ mail_get_folder (const char *uri, guint32 flags,
return id;
}
+/* ** GET FOLDER'S QUOTA ********************************************************* */
+
+struct _get_quota_msg {
+ MailMsg base;
+
+ CamelFolder *folder;
+ CamelFolderQuotaInfo *quota;
+ void (*done) (CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data);
+ void *data;
+};
+
+static gchar *
+get_quota_desc (struct _get_quota_msg *m)
+{
+ return g_strdup_printf(_("Retrieving quota information for folder %s"), camel_folder_get_name (m->folder));
+}
+
+static void
+get_quota_exec (struct _get_quota_msg *m)
+{
+ m->quota = camel_folder_get_quota_info (m->folder);
+}
+
+static void
+get_quota_done (struct _get_quota_msg *m)
+{
+ if (m->done)
+ m->done (m->folder, m->quota, m->data);
+}
+
+static void
+get_quota_free (struct _get_quota_msg *m)
+{
+ if (m->folder)
+ camel_object_unref (m->folder);
+ if (m->quota)
+ camel_folder_quota_info_free (m->quota);
+}
+
+static MailMsgInfo get_quota_info = {
+ sizeof (struct _get_quota_msg),
+ (MailMsgDescFunc) get_quota_desc,
+ (MailMsgExecFunc) get_quota_exec,
+ (MailMsgDoneFunc) get_quota_done,
+ (MailMsgFreeFunc) get_quota_free
+};
+
+int
+mail_get_folder_quota (CamelFolder *folder,
+ void (*done)(CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data),
+ void *data, MailMsgDispatchFunc dispatch)
+{
+ struct _get_quota_msg *m;
+ int id;
+
+ g_return_val_if_fail (folder != NULL, -1);
+
+ m = mail_msg_new (&get_quota_info);
+ m->folder = folder;
+ m->data = data;
+ m->done = done;
+
+ camel_object_ref (m->folder);
+
+ id = m->base.seq;
+ dispatch (m);
+ return id;
+}
+
/* ** GET STORE ******************************************************* */
struct _get_store_msg {