From c096dca1ea011f90aff74b9da99128d93a7fc111 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 28 Jun 2004 08:36:29 +0000 Subject: override CAMEL_FOLDER_NAME arg so we can translate "." into "Inbox". 2004-06-28 Not Zed * providers/local/camel-maildir-folder.c (maildir_folder_getv): override CAMEL_FOLDER_NAME arg so we can translate "." into "Inbox". svn path=/trunk/; revision=26538 --- camel/providers/local/camel-maildir-folder.c | 31 ++++++++++++++++++++++++++++ camel/providers/local/camel-maildir-store.c | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'camel/providers/local') diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index 3caa91d771..17bc081f94 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -56,6 +56,35 @@ static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * static void maildir_finalize(CamelObject * object); +static int +maildir_folder_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args) +{ + CamelFolder *folder = (CamelFolder *)object; + int i; + guint32 tag; + + for (i=0;iargc;i++) { + CamelArgGet *arg = &args->argv[i]; + + tag = arg->tag; + + switch (tag & CAMEL_ARG_TAG) { + case CAMEL_FOLDER_ARG_NAME: + if (!strcmp(folder->full_name, ".")) + *arg->ca_str = _("Inbox"); + else + *arg->ca_str = folder->name; + break; + default: + continue; + } + + arg->tag = (tag & CAMEL_ARG_TYPE) | CAMEL_ARG_IGNORE; + } + + return ((CamelObjectClass *)parent_class)->getv(object, ex, args); +} + static void camel_maildir_folder_class_init(CamelObjectClass * camel_maildir_folder_class) { CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_maildir_folder_class); @@ -66,6 +95,8 @@ static void camel_maildir_folder_class_init(CamelObjectClass * camel_maildir_fol /* virtual method definition */ /* virtual method overload */ + ((CamelObjectClass *)camel_folder_class)->getv = maildir_folder_getv; + camel_folder_class->append_message = maildir_append_message; camel_folder_class->get_message = maildir_get_message; diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index 853c02ccac..40cdc07e75 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -50,6 +50,7 @@ static CamelLocalStoreClass *parent_class = NULL; static CamelFolder *get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelException * ex); static CamelFolder *get_inbox (CamelStore *store, CamelException *ex); static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex); +static void maildir_rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex); static CamelFolderInfo * get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex); @@ -64,6 +65,7 @@ static void camel_maildir_store_class_init(CamelObjectClass * camel_maildir_stor camel_store_class->get_folder = get_folder; camel_store_class->get_inbox = get_inbox; camel_store_class->delete_folder = delete_folder; + camel_store_class->rename_folder = maildir_rename_folder; camel_store_class->get_folder_info = get_folder_info; camel_store_class->free_folder_info = camel_store_free_folder_info_full; @@ -225,8 +227,6 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce static void maildir_rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex) { - CamelFolder *folder; - if (strcmp(old, ".") == 0) { camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("Cannot rename folder: %s: Invalid operation"), _("Inbox")); -- cgit