diff options
Diffstat (limited to 'mail/em-folder-utils.c')
-rw-r--r-- | mail/em-folder-utils.c | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 80d4fde143..510bcf782e 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -40,8 +40,6 @@ #include <glib/gi18n.h> #include <camel/camel-session.h> -#include <camel/camel-store.h> -#include <camel/camel-folder.h> #include <camel/camel-vee-store.h> #include <camel/camel-vtrash-folder.h> #include <camel/camel-stream-mem.h> @@ -59,7 +57,6 @@ #include "mail-ops.h" #include "mail-tools.h" #include "mail-config.h" -#include "mail-component.h" #include "mail-vfolder.h" #include "mail-folder-cache.h" @@ -72,6 +69,8 @@ #include "em-folder-selection.h" #include "em-folder-properties.h" +#include "e-mail-shell-backend.h" + #define d(x) extern CamelSession *session; @@ -270,6 +269,7 @@ emfu_copy_folder_selected (const char *uri, void *data) { struct _copy_folder_data *cfd = data; CamelStore *fromstore = NULL, *tostore = NULL; + CamelStore *local_store; char *tobase = NULL; CamelException ex; CamelURL *url; @@ -281,13 +281,15 @@ emfu_copy_folder_selected (const char *uri, void *data) camel_exception_init (&ex); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); + if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) { e_error_run(NULL, cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL); goto fail; } - if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) { + if (cfd->delete && fromstore == local_store && emfu_is_special_local_folder (cfd->fi->full_name)) { GtkWidget *w = e_error_new (NULL, "mail:no-rename-special-folder", cfd->fi->full_name, NULL); em_utils_show_error_silent (w); @@ -399,13 +401,13 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) void em_folder_utils_delete_folder (CamelFolder *folder) { - CamelStore *local; + CamelStore *local_store; GtkWidget *dialog; int flags = 0; - local = mail_component_peek_local_store (NULL); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); - if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) { + if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL); em_utils_show_error_silent (dialog); return; @@ -434,14 +436,14 @@ em_folder_utils_rename_folder (CamelFolder *folder) { char *prompt, *new_name; const char *p; - CamelStore *local; + CamelStore *local_store; gboolean done = FALSE; size_t base_len; - local = mail_component_peek_local_store (NULL); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); /* don't allow user to rename one of the special local folders */ - if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) { + if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { e_error_run(NULL, "mail:no-rename-special-folder", folder->full_name, NULL); return; @@ -692,10 +694,10 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, EMFolderTreeModel *model; GtkWidget *dialog; - model = mail_component_peek_tree_model (mail_component_peek ()); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); if (parent) { @@ -707,3 +709,38 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, g_signal_connect (dialog, "response", G_CALLBACK (emfu_popup_new_folder_response), emft); gtk_widget_show (dialog); } + +const gchar * +em_folder_utils_get_icon_name (guint32 flags) +{ + const gchar *icon_name; + + switch (flags & CAMEL_FOLDER_TYPE_MASK) { + case CAMEL_FOLDER_TYPE_INBOX: + icon_name = "mail-inbox"; + break; + case CAMEL_FOLDER_TYPE_OUTBOX: + icon_name = "mail-outbox"; + break; + case CAMEL_FOLDER_TYPE_TRASH: + icon_name = "user-trash"; + break; + case CAMEL_FOLDER_TYPE_JUNK: + icon_name = "mail-mark-junk"; + break; + case CAMEL_FOLDER_TYPE_SENT: + icon_name = "mail-sent"; + break; + default: + if (flags & CAMEL_FOLDER_SHARED_TO_ME) + icon_name = "stock_shared-to-me"; + else if (flags & CAMEL_FOLDER_SHARED_BY_ME) + icon_name = "stock_shared-by-me"; + else if (flags & CAMEL_FOLDER_VIRTUAL) + icon_name = "folder-saved-search"; + else + icon_name = "folder"; + } + + return icon_name; +} |