diff options
25 files changed, 273 insertions, 300 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index e2ca212627..c10a0eb61b 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -273,7 +273,6 @@ mail_backend_quit_requested_cb (EShell *shell, { CamelFolder *folder; GtkWindow *window; - guint32 unsent; gint response; window = e_shell_get_active_window (shell); @@ -288,11 +287,7 @@ mail_backend_quit_requested_cb (EShell *shell, if (folder == NULL) return; - if (camel_object_get ( - folder, NULL, CAMEL_FOLDER_VISIBLE, &unsent, 0) != 0) - return; - - if (unsent == 0) + if (folder->summary->visible_count == 0) return; response = e_alert_run_dialog_for_args ( diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index d3f0aa42ba..10110734ae 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -66,6 +66,7 @@ e_mail_reader_confirm_delete (EMailReader *reader) EShellBackend *shell_backend; EShellSettings *shell_settings; CamelFolder *folder; + CamelStore *parent_store; GtkWidget *check_button; GtkWidget *content_area; GtkWidget *dialog; @@ -88,7 +89,9 @@ e_mail_reader_confirm_delete (EMailReader *reader) prompt_delete_in_vfolder = e_shell_settings_get_boolean ( shell_settings, "mail-prompt-delete-in-vfolder"); - if (!CAMEL_IS_VEE_STORE (folder->parent_store)) + parent_store = camel_folder_get_parent_store (folder); + + if (!CAMEL_IS_VEE_STORE (parent_store)) return TRUE; if (!prompt_delete_in_vfolder) @@ -96,7 +99,7 @@ e_mail_reader_confirm_delete (EMailReader *reader) dialog = e_alert_dialog_new_for_args ( window, "mail:ask-delete-vfolder-msg", - folder->full_name, NULL); + camel_folder_get_full_name (folder), NULL); /* XXX e-error should provide a widget layout and API suitable * for packing additional widgets to the right of the alert diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index abc4450bb1..fb863b1452 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1905,12 +1905,15 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) GtkWidget *message_list; EWebView *web_view; CamelFolder *folder; + CamelStore *parent_store; const gchar *cursor_uid; const gchar *format_uid; priv = E_MAIL_READER_GET_PRIVATE (reader); folder = e_mail_reader_get_folder (reader); + parent_store = camel_folder_get_parent_store (folder); + html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); @@ -1942,7 +1945,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) e_web_view_load_string (web_view, string); g_free (string); - store_async = folder->parent_store->flags & CAMEL_STORE_ASYNC; + store_async = parent_store->flags & CAMEL_STORE_ASYNC; if (store_async) disp_func = mail_msg_unordered_push; @@ -1976,11 +1979,13 @@ mail_reader_message_selected_cb (EMailReader *reader, MessageList *message_list; gboolean store_async; CamelFolder *folder; + CamelStore *parent_store; priv = E_MAIL_READER_GET_PRIVATE (reader); folder = e_mail_reader_get_folder (reader); - store_async = folder->parent_store->flags & CAMEL_STORE_ASYNC; + parent_store = camel_folder_get_parent_store (folder); + store_async = parent_store->flags & CAMEL_STORE_ASYNC; /* Cancel previous message retrieval if the store is not async. */ if (!store_async && priv->retrieving_message_operation_id > 0) @@ -2726,7 +2731,7 @@ e_mail_reader_check_state (EMailReader *reader) uids = e_mail_reader_get_selected_uids (reader); if (folder != NULL) { - store = CAMEL_STORE (folder->parent_store); + store = camel_folder_get_parent_store (folder); store_supports_vjunk = (store->flags & CAMEL_STORE_VJUNK); } diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 653e64b703..bf9a09e4f3 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1726,7 +1726,12 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account, gchar *post; if (folder) { - store_url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, CAMEL_URL_HIDE_ALL); + CamelStore *parent_store; + + parent_store = camel_folder_get_parent_store (folder); + store_url = camel_url_to_string ( + CAMEL_SERVICE (parent_store)->url, + CAMEL_URL_HIDE_ALL); if (store_url[strlen (store_url) - 1] == '/') store_url[strlen (store_url)-1] = '\0'; } diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 57753b8055..529472b47a 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -31,6 +31,8 @@ #include <gconf/gconf-client.h> +#include <e-util/e-binding.h> + #include "em-folder-properties.h" #include "em-config.h" @@ -42,11 +44,6 @@ struct _prop_data { gpointer object; - CamelArgV *argv; - GtkWidget **widgets; - - GSList *properties; - gchar *name; gint total; gint unread; EMConfig *config; @@ -65,56 +62,14 @@ emfp_dialog_response (GtkWidget *dialog, gint response, struct _prop_data *prop_ } static void -emfp_commit(EConfig *ec, GSList *items, gpointer data) -{ - struct _prop_data *prop_data = data; - CamelArgV *argv = prop_data->argv; - gint i; - - for (i = 0; i < argv->argc; i++) { - CamelArg *arg = &argv->argv[i]; - - switch (arg->tag & CAMEL_ARG_TYPE) { - case CAMEL_ARG_BOO: - arg->ca_int = gtk_toggle_button_get_active ((GtkToggleButton *) prop_data->widgets[i]); - break; - case CAMEL_ARG_STR: - g_free (arg->ca_str); - arg->ca_str = (gchar *) gtk_entry_get_text ((GtkEntry *) prop_data->widgets[i]); - break; - case CAMEL_ARG_INT: - arg->ca_int = gtk_spin_button_get_value_as_int ((GtkSpinButton *) prop_data->widgets[i]); - break; - case CAMEL_ARG_DBL: - arg->ca_double = gtk_spin_button_get_value ((GtkSpinButton *) prop_data->widgets[i]); - break; - default: - g_warning ("This shouldn't be reached\n"); - break; - } - } - - camel_object_setv (prop_data->object, NULL, argv); -} - -static void emfp_free(EConfig *ec, GSList *items, gpointer data) { struct _prop_data *prop_data = data; - gint i; g_slist_free(items); - for (i = 0; i < prop_data->argv->argc; i++) { - if ((prop_data->argv->argv[i].tag & CAMEL_ARG_TYPE) == CAMEL_ARG_STR) - g_free (prop_data->argv->argv[i].ca_str); - } - - camel_object_free (prop_data->object, CAMEL_FOLDER_PROPERTIES, prop_data->properties); - camel_object_free (prop_data->object, CAMEL_FOLDER_NAME, prop_data->name); - + camel_object_state_write (prop_data->object); g_object_unref (prop_data->object); - g_free (prop_data->argv); camel_folder_quota_info_free (prop_data->quota); @@ -151,15 +106,17 @@ add_numbered_row (GtkTable *table, gint row, const gchar *description, const gch static GtkWidget * emfp_get_folder_item(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { - GtkWidget *w, *table, *label; + GObjectClass *class; + GParamSpec **properties; + GtkWidget *widget, *table; struct _prop_data *prop_data = data; - gint row = 0, i; - GSList *l; + guint ii, n_properties; + gint row = 0; if (old) return old; - table = gtk_table_new (g_slist_length (prop_data->properties) + 2, 2, FALSE); + table = gtk_table_new (2, 2, FALSE); gtk_table_set_row_spacings ((GtkTable *) table, 6); gtk_table_set_col_spacings ((GtkTable *) table, 12); gtk_widget_show (table); @@ -200,74 +157,39 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidge } } - /* setup the ui with the values retrieved */ - l = prop_data->properties; - i = 0; - while (l) { - CamelProperty *prop = l->data; - - switch (prop->tag & CAMEL_ARG_TYPE) { - case CAMEL_ARG_BOO: - w = gtk_check_button_new_with_label (prop->description); - gtk_toggle_button_set_active ((GtkToggleButton *) w, prop_data->argv->argv[i].ca_int != 0); - gtk_widget_show (w); - gtk_table_attach ((GtkTable *) table, w, 0, 2, row, row + 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - prop_data->widgets[i] = w; - break; - case CAMEL_ARG_STR: - label = gtk_label_new (prop->description); - gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); - gtk_widget_show (label); - gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - - w = gtk_entry_new (); - gtk_widget_show (w); - if (prop_data->argv->argv[i].ca_str) { - gtk_entry_set_text ((GtkEntry *) w, prop_data->argv->argv[i].ca_str); - camel_object_free (prop_data->object, prop_data->argv->argv[i].tag, prop_data->argv->argv[i].ca_str); - prop_data->argv->argv[i].ca_str = NULL; - } - gtk_table_attach ((GtkTable *) table, w, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - prop_data->widgets[i] = w; - break; - case CAMEL_ARG_INT: - label = gtk_label_new (prop->description); - gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); - gtk_widget_show (label); - gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - - w = gtk_spin_button_new_with_range (G_MININT, G_MAXINT, 1.0); - gtk_spin_button_set_value ((GtkSpinButton *) w, (double) prop_data->argv->argv[i].ca_int); - gtk_spin_button_set_numeric ((GtkSpinButton *) w, TRUE); - gtk_spin_button_set_digits ((GtkSpinButton *) w, 0); - gtk_widget_show (w); - gtk_table_attach ((GtkTable *) table, w, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - prop_data->widgets[i] = w; - break; - case CAMEL_ARG_DBL: - label = gtk_label_new (prop->description); - gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); - gtk_widget_show (label); - gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - - w = gtk_spin_button_new_with_range (G_MININT, G_MAXINT, 1.0); - gtk_spin_button_set_value ((GtkSpinButton *) w, prop_data->argv->argv[i].ca_double); - gtk_spin_button_set_numeric ((GtkSpinButton *) w, TRUE); - gtk_spin_button_set_digits ((GtkSpinButton *) w, 2); - gtk_widget_show (w); - gtk_table_attach ((GtkTable *) table, w, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - prop_data->widgets[i] = w; - break; - default: - g_warning ("This shouldn't be reached\n"); - break; + class = G_OBJECT_GET_CLASS (prop_data->object); + properties = g_object_class_list_properties (class, &n_properties); + + for (ii = 0; ii < n_properties; ii++) { + const gchar *blurb; + + if ((properties[ii]->flags & CAMEL_PARAM_PERSISTENT) == 0) + continue; + + blurb = g_param_spec_get_blurb (properties[ii]); + + switch (properties[ii]->value_type) { + case G_TYPE_BOOLEAN: + widget = gtk_check_button_new_with_label (blurb); + e_mutual_binding_new ( + prop_data->object, + properties[ii]->name, + widget, "active"); + gtk_widget_show (widget); + gtk_table_attach ( + GTK_TABLE (table), widget, + 0, 2, row, row + 1, + GTK_FILL | GTK_EXPAND, 0, 0, 0); + row++; + break; + default: + g_warn_if_reached (); + break; } - - row++; - l = l->next; - i++; } + g_free (properties); + return table; } @@ -291,39 +213,38 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, GtkWidget *content_area; struct _prop_data *prop_data; GSList *l; - gint32 count, i,deleted; + gint32 i,deleted; EMConfig *ec; EMConfigTargetFolder *target; EShellWindow *shell_window; EShellView *shell_view; - CamelArgGetV *arggetv; - CamelArgV *argv; CamelStore *local_store; + CamelStore *parent_store; gboolean hide_deleted; GConfClient *gconf; - CamelStore *store; + const gchar *name; if (folder == NULL) return; - store = folder->parent_store; - shell_view = E_SHELL_VIEW (data); shell_window = e_shell_view_get_shell_window (shell_view); local_store = e_mail_local_get_store (); + parent_store = camel_folder_get_parent_store (folder); prop_data = g_malloc0 (sizeof (*prop_data)); - prop_data->object = folder; - g_object_ref (folder); + prop_data->object = g_object_ref (folder); prop_data->quota = camel_folder_quota_info_clone (quota); /* Get number of VISIBLE and DELETED messages, instead of TOTAL messages. VISIBLE+DELETED gives the correct count that matches the label below the Send & Receive button */ - camel_object_get (folder, NULL, CAMEL_FOLDER_PROPERTIES, &prop_data->properties, CAMEL_FOLDER_NAME, &prop_data->name, - CAMEL_FOLDER_VISIBLE, &prop_data->total, CAMEL_FOLDER_UNREAD, &prop_data->unread, CAMEL_FOLDER_DELETED, &deleted, NULL); + name = camel_folder_get_name (folder); + prop_data->total = folder->summary->visible_count; + prop_data->unread = folder->summary->unread_count; + deleted = folder->summary->deleted_count; gconf = mail_config_get_gconf_client (); hide_deleted = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL); @@ -331,7 +252,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, /* Do the calculation only for those accounts that support VTRASHes */ - if (store->flags & CAMEL_STORE_VTRASH) { + if (parent_store->flags & CAMEL_STORE_VTRASH) { if (CAMEL_IS_VTRASH_FOLDER(folder)) prop_data->total += deleted; else if (!hide_deleted && deleted > 0) @@ -341,17 +262,16 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, /* * If the ffolder is junk folder, get total number of mails. */ - if (store->flags & CAMEL_STORE_VJUNK) { - camel_object_get (folder, NULL, CAMEL_FOLDER_TOTAL, &prop_data->total, NULL); - } - - if (store == local_store - && (!strcmp(prop_data->name, "Drafts") - || !strcmp(prop_data->name, "Templates") - || !strcmp(prop_data->name, "Inbox") - || !strcmp(prop_data->name, "Outbox") - || !strcmp(prop_data->name, "Sent"))) { - emfp_items[EMFP_FOLDER_SECTION].label = _(prop_data->name); + if (parent_store->flags & CAMEL_STORE_VJUNK) + prop_data->total = camel_folder_summary_count (folder->summary); + + if (parent_store == local_store + && (!strcmp (name, "Drafts") + || !strcmp (name, "Templates") + || !strcmp (name, "Inbox") + || !strcmp (name, "Outbox") + || !strcmp (name, "Sent"))) { + emfp_items[EMFP_FOLDER_SECTION].label = gettext (name); if (!emfp_items_translated) { for (i = 0; i < G_N_ELEMENTS (emfp_items); i++) { if (emfp_items[i].label) @@ -359,43 +279,15 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, } emfp_items_translated = TRUE; } - } else if (!strcmp(prop_data->name, "INBOX")) + } else if (!strcmp (name, "INBOX")) emfp_items[EMFP_FOLDER_SECTION].label = _("Inbox"); else - emfp_items[EMFP_FOLDER_SECTION].label = prop_data->name; - - count = g_slist_length (prop_data->properties); - - prop_data->widgets = g_malloc0 (sizeof (prop_data->widgets[0]) * count); - - /* build an arggetv/argv to retrieve/store the results */ - argv = g_malloc0 (sizeof (*argv) + (count - CAMEL_ARGV_MAX) * sizeof (argv->argv[0])); - argv->argc = count; - arggetv = g_malloc0 (sizeof (*arggetv) + (count - CAMEL_ARGV_MAX) * sizeof (arggetv->argv[0])); - arggetv->argc = count; - - i = 0; - l = prop_data->properties; - while (l) { - CamelProperty *prop = l->data; - - argv->argv[i].tag = prop->tag; - arggetv->argv[i].tag = prop->tag; - arggetv->argv[i].ca_ptr = &argv->argv[i].ca_ptr; - - l = l->next; - i++; - } - - camel_object_getv (prop_data->object, NULL, arggetv); - g_free (arggetv); - prop_data->argv = argv; + emfp_items[EMFP_FOLDER_SECTION].label = (gchar *) name; dialog = gtk_dialog_new_with_buttons ( _("Folder Properties"), GTK_WINDOW (shell_window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); gtk_window_set_default_size ((GtkWindow *) dialog, 192, 160); gtk_widget_ensure_style (dialog); @@ -416,7 +308,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, l = NULL; for (i = 0; i < G_N_ELEMENTS (emfp_items); i++) l = g_slist_prepend(l, &emfp_items[i]); - e_config_add_items((EConfig *)ec, l, emfp_commit, NULL, emfp_free, prop_data); + e_config_add_items((EConfig *)ec, l, NULL, NULL, emfp_free, prop_data); target = em_config_target_new_folder(ec, folder, folder_uri); e_config_set_target((EConfig *)ec, (EConfigTarget *)target); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 40e692cbf4..bab7e7cae9 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1545,18 +1545,26 @@ struct _DragDataReceivedAsync { static void folder_tree_drop_folder(struct _DragDataReceivedAsync *m) { - CamelFolder *src; + CamelFolder *folder; + CamelStore *parent_store; + const gchar *full_name; const guchar *data; data = gtk_selection_data_get_data (m->selection); d(printf(" * Drop folder '%s' onto '%s'\n", data, m->full_name)); - if (!(src = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.ex))) + if (!(folder = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.ex))) return; - em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move); - g_object_unref (src); + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + em_folder_utils_copy_folders ( + parent_store, full_name, m->store, + m->full_name ? m->full_name : "", m->move); + + g_object_unref (folder); } static gchar * diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index ea26d9ed9a..6e3cb3f05a 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -403,8 +403,10 @@ emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpo GtkWidget *w; w = e_alert_dialog_new_for_args ( - e_shell_get_active_window (NULL), "mail:no-delete-folder", - folder->full_name, camel_exception_get_description (ex), NULL); + e_shell_get_active_window (NULL), + "mail:no-delete-folder", + camel_folder_get_full_name (folder), + camel_exception_get_description (ex), NULL); em_utils_show_error_silent (w); camel_exception_clear (ex); } @@ -431,23 +433,30 @@ void em_folder_utils_delete_folder (CamelFolder *folder) { CamelStore *local_store; + CamelStore *parent_store; GtkWindow *parent = e_shell_get_active_window (NULL); GtkWidget *dialog; + const gchar *full_name; gint flags = 0; + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + local_store = e_mail_local_get_store (); - if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { + if (parent_store == local_store && emfu_is_special_local_folder (full_name)) { dialog = e_alert_dialog_new_for_args ( parent, "mail:no-delete-special-folder", - folder->full_name, NULL); + full_name, NULL); em_utils_show_error_silent (dialog); return; } if (mail_folder_cache_get_folder_info_flags (mail_folder_cache_get_default (), folder, &flags) && (flags & CAMEL_FOLDER_SYSTEM)) { - e_alert_run_dialog_for_args (parent,"mail:no-delete-special-folder", folder->name, NULL); + e_alert_run_dialog_for_args ( + parent,"mail:no-delete-special-folder", + camel_folder_get_name (folder), NULL); return; } @@ -455,13 +464,13 @@ em_folder_utils_delete_folder (CamelFolder *folder) if (mail_folder_cache_get_folder_info_flags (mail_folder_cache_get_default (), folder, &flags) && (flags & CAMEL_FOLDER_CHILDREN)) { dialog = e_alert_dialog_new_for_args (parent, - (folder->parent_store && CAMEL_IS_VEE_STORE(folder->parent_store))?"mail:ask-delete-vfolder":"mail:ask-delete-folder", - folder->full_name, NULL); + (parent_store && CAMEL_IS_VEE_STORE(parent_store))?"mail:ask-delete-vfolder":"mail:ask-delete-folder", + full_name, NULL); } else { dialog = e_alert_dialog_new_for_args (parent, - (folder->parent_store && CAMEL_IS_VEE_STORE(folder->parent_store))?"mail:ask-delete-vfolder-nochild":"mail:ask-delete-folder-nochild", - folder->full_name, NULL); + (parent_store && CAMEL_IS_VEE_STORE(parent_store))?"mail:ask-delete-vfolder-nochild":"mail:ask-delete-folder-nochild", + full_name, NULL); } g_object_set_data_full ((GObject *) dialog, "folder", folder, g_object_unref); diff --git a/mail/em-utils.c b/mail/em-utils.c index 91ca5dd6c3..c2982b66a5 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -849,7 +849,9 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr /* TODO: Handle conflicts? */ if (file == NULL) { /* Drop filename for messages from a mailbox */ - file = g_strdup_printf(_("Messages from %s"), folder->name); + file = g_strdup_printf ( + _("Messages from %s"), + camel_folder_get_name (folder)); } e_filename_make_safe(file); @@ -1013,6 +1015,7 @@ gboolean em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri) { CamelFolder *local_templates_folder; + CamelStore *parent_store; EAccountList *accounts; EAccount *account; EIterator *iter; @@ -1028,6 +1031,8 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri) if (folder == NULL || uri == NULL) return FALSE; + parent_store = camel_folder_get_parent_store (folder); + accounts = e_get_account_list (); iter = e_list_get_iterator ((EList *)accounts); while (e_iterator_is_valid (iter)) { @@ -1035,7 +1040,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri) if (account->templates_folder_uri) { templates_uri = em_uri_to_camel (account->templates_folder_uri); - if (camel_store_folder_uri_equal (folder->parent_store, templates_uri, uri)) { + if (camel_store_folder_uri_equal (parent_store, templates_uri, uri)) { g_free (templates_uri); is = TRUE; break; @@ -1064,6 +1069,7 @@ gboolean em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) { CamelFolder *local_drafts_folder; + CamelStore *parent_store; EAccountList *accounts; EAccount *account; EIterator *iter; @@ -1079,6 +1085,8 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) if (folder == NULL || uri == NULL) return FALSE; + parent_store = camel_folder_get_parent_store (folder); + accounts = e_get_account_list (); iter = e_list_get_iterator((EList *)accounts); while (e_iterator_is_valid(iter)) { @@ -1086,7 +1094,7 @@ em_utils_folder_is_drafts(CamelFolder *folder, const gchar *uri) if (account->drafts_folder_uri) { drafts_uri = em_uri_to_camel (account->drafts_folder_uri); - if (camel_store_folder_uri_equal (folder->parent_store, drafts_uri, uri)) { + if (camel_store_folder_uri_equal (parent_store, drafts_uri, uri)) { g_free (drafts_uri); is = TRUE; break; @@ -1115,6 +1123,7 @@ gboolean em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) { CamelFolder *local_sent_folder; + CamelStore *parent_store; EAccountList *accounts; EAccount *account; EIterator *iter; @@ -1129,6 +1138,8 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) if (folder == NULL || uri == NULL) return FALSE; + parent_store = camel_folder_get_parent_store (folder); + accounts = e_get_account_list (); iter = e_list_get_iterator((EList *)accounts); while (e_iterator_is_valid(iter)) { @@ -1136,7 +1147,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const gchar *uri) if (account->sent_folder_uri) { sent_uri = em_uri_to_camel (account->sent_folder_uri); - if (camel_store_folder_uri_equal (folder->parent_store, sent_uri, uri)) { + if (camel_store_folder_uri_equal (parent_store, sent_uri, uri)) { g_free (sent_uri); is = TRUE; break; @@ -1179,7 +1190,7 @@ em_utils_folder_is_outbox(CamelFolder *folder, const gchar *uri) return FALSE; return camel_store_folder_uri_equal ( - local_outbox_folder->parent_store, + camel_folder_get_parent_store (local_outbox_folder), local_outbox_folder_uri, uri); } @@ -1300,14 +1311,17 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint void em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder) { - gchar *name; + const gchar *description; - camel_object_get(folder, NULL, CAMEL_OBJECT_DESCRIPTION, &name, 0); + description = camel_folder_get_description (folder); - if (!em_utils_prompt_user ((GtkWindow *) parent, "/apps/evolution/mail/prompts/expunge", "mail:ask-expunge", name, NULL)) + if (!em_utils_prompt_user ( + GTK_WINDOW (parent), + "/apps/evolution/mail/prompts/expunge", + "mail:ask-expunge", description, NULL)) return; - mail_expunge_folder(folder, NULL, NULL); + mail_expunge_folder (folder, NULL, NULL); } /** @@ -2139,10 +2153,12 @@ static EAccount * guess_account_from_folder (CamelFolder *folder) { CamelService *service; + CamelStore *parent_store; EAccount *account; gchar *source_url; - service = CAMEL_SERVICE (folder->parent_store); + parent_store = camel_folder_get_parent_store (folder); + service = CAMEL_SERVICE (parent_store); source_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL); account = mail_config_get_account_by_source_url (source_url); diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 72a975f2cc..35abd8365f 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -145,7 +145,9 @@ import_mbox_exec (struct _import_mbox_msg *m) if (m->cancel) oldcancel = camel_operation_register(m->cancel); - camel_operation_start(NULL, _("Importing '%s'"), folder->full_name); + camel_operation_start ( + NULL, _("Importing '%s'"), + camel_folder_get_full_name (folder)); camel_folder_freeze(folder); while (camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) { CamelMimeMessage *msg; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 1bc2d61257..2f589529db 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -313,7 +313,7 @@ update_1folder(MailFolderCache *self, struct _folder_info *mfi, gint new, const if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0) unread -= deleted; - camel_object_get (folder, NULL, CAMEL_FOLDER_JUNKED, &junked, NULL); + junked = folder->summary->junk_count; if (junked > 0) unread -= junked; @@ -406,17 +406,19 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) CamelFolder *local_drafts; CamelFolder *local_outbox; CamelFolder *local_sent; - CamelStore *store = folder->parent_store; + CamelStore *parent_store; CamelMessageInfo *info; struct _store_info *si; struct _folder_info *mfi; + const gchar *full_name; gint new = 0; gint i; guint32 flags; gchar *uid = NULL, *sender = NULL, *subject = NULL; MailFolderCache *self = (MailFolderCache*) user_data; - d(printf("folder '%s' changed\n", folder->full_name)); + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS); local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); @@ -462,8 +464,8 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) g_mutex_lock (self->priv->stores_mutex); if (self->priv->stores != NULL - && (si = g_hash_table_lookup(self->priv->stores, store)) != NULL - && (mfi = g_hash_table_lookup(si->folders, folder->full_name)) != NULL + && (si = g_hash_table_lookup(self->priv->stores, parent_store)) != NULL + && (mfi = g_hash_table_lookup(si->folders, full_name)) != NULL && mfi->folder == folder) { update_1folder (self, mfi, new, uid, sender, subject, NULL); } @@ -478,16 +480,19 @@ static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data) { CamelFolder *folder = (CamelFolder *)o; - CamelStore *store = folder->parent_store; + CamelStore *parent_store; struct _store_info *si; struct _folder_info *mfi; MailFolderCache *self = (MailFolderCache*) user_data; + const gchar *full_name; + + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); - d(printf("Folder finalised '%s'!\n", ((CamelFolder *)o)->full_name)); g_mutex_lock (self->priv->stores_mutex); if (self->priv->stores != NULL - && (si = g_hash_table_lookup(self->priv->stores, store)) != NULL - && (mfi = g_hash_table_lookup(si->folders, folder->full_name)) != NULL + && (si = g_hash_table_lookup(self->priv->stores, parent_store)) != NULL + && (mfi = g_hash_table_lookup(si->folders, full_name)) != NULL && mfi->folder == folder) { mfi->folder = NULL; } @@ -500,8 +505,6 @@ folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data) CamelFolder *folder = (CamelFolder *)o; gchar *old = event_data; - d(printf("Folder renamed from '%s' to '%s'\n", old, folder->full_name)); - old = old; folder = folder; /* Dont do anything, do it from the store rename event? */ @@ -516,16 +519,18 @@ folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data) */ void mail_folder_cache_note_folder(MailFolderCache *self, CamelFolder *folder) { - CamelStore *store = folder->parent_store; + CamelStore *parent_store; struct _store_info *si; struct _folder_info *mfi; + const gchar *full_name; - d(printf("noting folder '%s'\n", folder->full_name)); + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); g_mutex_lock (self->priv->stores_mutex); if (self->priv->stores == NULL - || (si = g_hash_table_lookup(self->priv->stores, store)) == NULL - || (mfi = g_hash_table_lookup(si->folders, folder->full_name)) == NULL) { + || (si = g_hash_table_lookup(self->priv->stores, parent_store)) == NULL + || (mfi = g_hash_table_lookup(si->folders, full_name)) == NULL) { w(g_warning("Noting folder before store initialised")); g_mutex_unlock (self->priv->stores_mutex); return; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 22edd9a6a1..128cb28c9c 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -279,9 +279,11 @@ fetch_mail_exec (struct _fetch_mail_msg *m) /* this handles 'keep on server' stuff, if we have any new uid's to copy across, we need to copy them to a new array 'cause of the way fetch_mail_free works */ CamelUIDCache *cache = NULL; + CamelStore *parent_store; gchar *cachename; - cachename = uid_cachename_hack (folder->parent_store); + parent_store = camel_folder_get_parent_store (folder); + cachename = uid_cachename_hack (parent_store); cache = camel_uid_cache_new (cachename); g_free (cachename); @@ -605,14 +607,15 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT); if (folder != sent_folder) { - const gchar *name; + const gchar *description; - camel_object_get (folder, NULL, CAMEL_OBJECT_DESCRIPTION, (gchar **) &name, 0); + description = camel_folder_get_description (folder); if (err->len) g_string_append(err, "\n\n"); - g_string_append_printf (err, _("Failed to append to %s: %s\n" - "Appending to local 'Sent' folder instead."), - name, camel_exception_get_description (ex)); + g_string_append_printf ( + err, _("Failed to append to %s: %s\n" + "Appending to local 'Sent' folder instead."), + description, camel_exception_get_description (ex)); g_object_ref (sent_folder); g_object_unref (folder); folder = sent_folder; @@ -1486,19 +1489,21 @@ remove_folder_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex) static void remove_folder_exec (struct _remove_folder_msg *m) { - CamelStore *store; CamelFolderInfo *fi; + CamelStore *parent_store; + const gchar *full_name; m->removed = FALSE; - store = m->folder->parent_store; + full_name = camel_folder_get_full_name (m->folder); + parent_store = camel_folder_get_parent_store (m->folder); - fi = camel_store_get_folder_info (store, m->folder->full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &m->base.ex); + fi = camel_store_get_folder_info (parent_store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &m->base.ex); if (camel_exception_is_set (&m->base.ex)) return; - remove_folder_rec (store, fi, &m->base.ex); - camel_store_free_folder_info (store, fi); + remove_folder_rec (parent_store, fi, &m->base.ex); + camel_store_free_folder_info (parent_store, fi); m->removed = !camel_exception_is_set (&m->base.ex); } diff --git a/mail/mail-tools.c b/mail/mail-tools.c index d7cb5c6cca..e9470c9a63 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -385,18 +385,23 @@ mail_tools_x_evolution_message_parse (gchar *in, guint inlen, GPtrArray **uids) gchar * mail_tools_folder_to_url (CamelFolder *folder) { + CamelStore *parent_store; + const gchar *full_name; CamelURL *url; gchar *out; g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); - url = camel_url_copy(((CamelService *)folder->parent_store)->url); - if (((CamelService *)folder->parent_store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { - camel_url_set_fragment(url, folder->full_name); + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + url = camel_url_copy(((CamelService *)parent_store)->url); + if (((CamelService *)parent_store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { + camel_url_set_fragment(url, full_name); } else { - gchar *name = g_alloca(strlen(folder->full_name)+2); + gchar *name = g_alloca(strlen(full_name)+2); - sprintf(name, "/%s", folder->full_name); + sprintf(name, "/%s", full_name); camel_url_set_path(url, name); } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 3ff43cd10c..a97b5bb6b6 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -81,7 +81,9 @@ struct _setup_msg { static gchar * vfolder_setup_desc (struct _setup_msg *m) { - return g_strdup_printf(_("Setting up Search Folder: %s"), m->folder->full_name); + return g_strdup_printf ( + _("Setting up Search Folder: %s"), + camel_folder_get_full_name (m->folder)); } static void @@ -90,8 +92,6 @@ vfolder_setup_exec (struct _setup_msg *m) GList *l, *list = NULL; CamelFolder *folder; - d(printf("Setting up Search Folder: %s\n", m->folder->full_name)); - camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query); l = m->sources_uri; @@ -110,7 +110,6 @@ vfolder_setup_exec (struct _setup_msg *m) l = m->sources_folder; while (l && !vfolder_shutdown) { - d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); g_object_ref (l->data); list = g_list_append(list, l->data); l = l->next; @@ -807,9 +806,12 @@ rule_changed(EFilterRule *rule, CamelFolder *folder) { GList *sources_uri = NULL, *sources_folder = NULL; GString *query; + const gchar *full_name; + + full_name = camel_folder_get_full_name (folder); /* if the folder has changed name, then add it, then remove the old manually */ - if (strcmp(folder->full_name, rule->name) != 0) { + if (strcmp (full_name, rule->name) != 0) { gchar *oldname; gpointer key; @@ -817,18 +819,17 @@ rule_changed(EFilterRule *rule, CamelFolder *folder) G_LOCK (vfolder); d(printf("Changing folder name in hash table to '%s'\n", rule->name)); - if (g_hash_table_lookup_extended (vfolder_hash, folder->full_name, &key, &oldfolder)) { + if (g_hash_table_lookup_extended (vfolder_hash, full_name, &key, &oldfolder)) { g_hash_table_remove (vfolder_hash, key); g_free (key); g_hash_table_insert (vfolder_hash, g_strdup(rule->name), folder); G_UNLOCK (vfolder); } else { G_UNLOCK (vfolder); - g_warning("couldn't find a vfolder rule in our table? %s", folder->full_name); + g_warning("couldn't find a vfolder rule in our table? %s", full_name); } - /* TODO: make the folder->full_name var thread accessible */ - oldname = g_strdup(folder->full_name); + oldname = g_strdup (full_name); camel_store_rename_folder(vfolder_store, oldname, rule->name, NULL); g_free(oldname); } @@ -1023,6 +1024,7 @@ vfolder_load_storage(void) EFilterRule *rule; gchar *xmlfile; GConfClient *gconf; + CamelException ex; G_LOCK (vfolder_hash); @@ -1036,15 +1038,19 @@ vfolder_load_storage(void) G_UNLOCK (vfolder_hash); + camel_exception_init (&ex); + /* first, create the vfolder store, and set it up */ data_dir = mail_session_get_data_dir (); storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir); - vfolder_store = camel_session_get_store(session, storeuri, NULL); + vfolder_store = camel_session_get_store(session, storeuri, &ex); if (vfolder_store == NULL) { g_warning("Cannot open vfolder store - no vfolders available"); return; } + camel_exception_clear (&ex); + camel_object_hook_event(vfolder_store, "folder_created", (CamelObjectEventHookFunc)store_folder_created, NULL); camel_object_hook_event(vfolder_store, "folder_deleted", diff --git a/mail/message-list.c b/mail/message-list.c index 123c4971aa..db8dbfa176 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1972,6 +1972,7 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) /* build the spec based on the folder, and possibly from a saved file */ /* otherwise, leave default */ if (message_list->folder) { + CamelStore *parent_store; gchar *path; gchar *name; gint data = 1; @@ -1982,7 +1983,8 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) g_object_set (message_list, "uniform_row_height", TRUE, NULL); - name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); + parent_store = camel_folder_get_parent_store (message_list->folder); + name = camel_service_get_name (CAMEL_SERVICE (parent_store), TRUE); d(printf ("folder name is '%s'\n", name)); path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-"); @@ -2094,10 +2096,14 @@ struct _drop_msg { static gchar * ml_drop_async_desc (struct _drop_msg *m) { + const gchar *full_name; + + full_name = camel_folder_get_full_name (m->folder); + if (m->move) - return g_strdup_printf(_("Moving messages into folder %s"), m->folder->full_name); + return g_strdup_printf(_("Moving messages into folder %s"), full_name); else - return g_strdup_printf(_("Copying messages into folder %s"), m->folder->full_name); + return g_strdup_printf(_("Copying messages into folder %s"), full_name); } static void diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index 790f4336a8..55de059d12 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -347,26 +347,16 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, exit: if (camel_exception_is_set (&ex)) { - gchar *folder_name; + const gchar *folder_name = data; if (folder != NULL) - camel_object_get ( - folder, NULL, CAMEL_FOLDER_NAME, - &folder_name, NULL); - else - folder_name = g_strdup (data); + folder_name = camel_folder_get_name (folder); e_alert_run_dialog_for_args ( parent, "mail-composer:attach-nomessages", folder_name, camel_exception_get_description (&ex), NULL); - if (folder != NULL) - camel_object_free ( - folder, CAMEL_FOLDER_NAME, folder_name); - else - g_free (folder_name); - camel_exception_clear (&ex); } diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 5c60071d15..8a45c4b853 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -821,12 +821,13 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) EShellView *shell_view; EMailReader *reader; CamelStore *local_store; + CamelStore *parent_store; CamelFolder *folder; GPtrArray *uids; GString *buffer; const gchar *display_name; + const gchar *folder_name; const gchar *folder_uri; - gchar *folder_name; gchar *title; guint32 num_deleted; guint32 num_junked; @@ -863,15 +864,14 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) return; } - camel_object_get ( - folder, NULL, - CAMEL_FOLDER_NAME, &folder_name, - CAMEL_FOLDER_DELETED, &num_deleted, - CAMEL_FOLDER_JUNKED, &num_junked, - CAMEL_FOLDER_JUNKED_NOT_DELETED, &num_junked_not_deleted, - CAMEL_FOLDER_UNREAD, &num_unread, - CAMEL_FOLDER_VISIBLE, &num_visible, - NULL); + folder_name = camel_folder_get_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + num_deleted = folder->summary->deleted_count; + num_junked = folder->summary->junk_count; + num_junked_not_deleted = folder->summary->junk_not_deleted_count; + num_unread = folder->summary->unread_count; + num_visible = folder->summary->visible_count; buffer = g_string_sized_new (256); uids = e_mail_reader_get_selected_uids (reader); @@ -942,7 +942,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) em_utils_uids_free (uids); /* Choose a suitable folder name for displaying. */ - if (folder->parent_store == local_store && ( + if (parent_store == local_store && ( strcmp (folder_name, "Drafts") == 0 || strcmp (folder_name, "Inbox") == 0 || strcmp (folder_name, "Outbox") == 0 || @@ -959,6 +959,5 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) e_shell_view_set_title (shell_view, title); g_free (title); - camel_object_free (folder, CAMEL_FOLDER_NAME, folder_name); g_string_free (buffer, TRUE); } diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index acfcbdfb7d..e69ae55220 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -664,7 +664,7 @@ current_account: /* Create a new search folder. */ - store = folder->parent_store; + store = camel_folder_get_parent_store (folder); list = NULL; /* list of CamelFolders */ if (store->folders != NULL) { diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c index 192b4f2b0d..6e72b67320 100644 --- a/plugins/groupwise-features/junk-mail-settings.c +++ b/plugins/groupwise-features/junk-mail-settings.c @@ -77,7 +77,7 @@ gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view) folder = e_mail_reader_get_folder (reader); g_return_if_fail (folder != NULL); - cnc = get_cnc (folder->parent_store); + cnc = get_cnc (camel_folder_get_parent_store (folder)); dialog = gtk_dialog_new_with_buttons (_("Junk Settings"), NULL, diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c index 69b9acd5f0..466da1cb23 100644 --- a/plugins/groupwise-features/mail-retract.c +++ b/plugins/groupwise-features/mail-retract.c @@ -63,7 +63,7 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view) { EGwConnection *cnc; CamelFolder *folder; - CamelStore *store; + CamelStore *parent_store; gchar *id = NULL; GtkWidget *confirm_dialog, *confirm_warning; GtkWidget *content_area; @@ -72,9 +72,9 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view) g_return_if_fail (get_selected_info (shell_view, &folder, &id)); g_return_if_fail (folder != NULL); - store = folder->parent_store; + parent_store = camel_folder_get_parent_store (folder); - cnc = get_cnc (store); + cnc = get_cnc (parent_store); if (cnc && E_IS_GW_CONNECTION(cnc)) { confirm_dialog = gtk_dialog_new_with_buttons ( diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 10e9b341dc..91758da535 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -93,12 +93,14 @@ void shared_folder_commit (EPlugin *ep, EConfigTarget *tget) { EMConfigTargetFolder *target = (EMConfigTargetFolder *)tget->config->target; - CamelFolder *folder = target->folder; - CamelStore *store = folder->parent_store; + CamelStore *parent_store; EMFolderTreeModel *model = NULL; /*mail_component_peek_tree_model (mail_component_peek ())*/; + + parent_store = camel_folder_get_parent_store (target->folder); + if (common) { share_folder (common); - refresh_folder_tree (model, store); + refresh_folder_tree (model, parent_store); g_object_run_dispose ((GObject *)common); common = NULL; } @@ -370,7 +372,7 @@ org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_d EMConfigTargetFolder *target= (EMConfigTargetFolder *)hook_data->config->target; CamelFolder *folder = target->folder; - folder_name = g_strdup (folder->full_name); + folder_name = g_strdup (camel_folder_get_full_name (folder)); folderuri = g_strdup(target->uri); if (folderuri && folder_name) account = g_strrstr(folderuri, "groupwise"); @@ -396,8 +398,10 @@ org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_d } if (account) { - CamelStore *store = folder->parent_store; - cnc = get_cnc (store); + CamelStore *parent_store; + + parent_store = camel_folder_get_parent_store (folder); + cnc = get_cnc (parent_store); if (E_IS_GW_CONNECTION (cnc)) id = get_container_id (cnc, folder_name); diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c index 0243e1e453..83ecf6c1bf 100644 --- a/plugins/groupwise-features/status-track.c +++ b/plugins/groupwise-features/status-track.c @@ -184,7 +184,7 @@ gw_track_message_status_cb (GtkAction *action, gtk_table_set_col_spacings (table ,12); gtk_table_set_row_spacings (table, 6); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0); - cnc = get_cnc (folder->parent_store); + cnc = get_cnc (camel_folder_get_parent_store (folder)); if (E_IS_GW_CONNECTION(cnc)) { GSList *recipient_list; diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 5e555434ca..90f5b9ae27 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -816,6 +816,7 @@ find_server (struct _itip_puri *pitip, ECalComponent *comp) GSList *groups, *l, *sources_conflict = NULL, *all_sources = NULL; const gchar *uid; gchar *rid = NULL; + CamelStore *parent_store; CamelURL *url; gchar *uri; ESource *source = NULL, *current_source = NULL; @@ -823,8 +824,10 @@ find_server (struct _itip_puri *pitip, ECalComponent *comp) e_cal_component_get_uid (comp, &uid); rid = e_cal_component_get_recurid_as_string (comp); - url = CAMEL_SERVICE (pitip->folder->parent_store)->url; - uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + parent_store = camel_folder_get_parent_store (pitip->folder); + + url = CAMEL_SERVICE (parent_store)->url; + uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); @@ -1981,8 +1984,10 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) tag = camel_message_info_user_tag (mi, "recurrence-key"); camel_message_info_free (mi); if (tag) { - gint i = 0, count; + CamelStore *parent_store; GSList *list = NULL; + const gchar *full_name; + gint i = 0, count; count = camel_folder_summary_count (pitip->folder->summary); for (i = 0; i < count; i++) { @@ -2001,7 +2006,10 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) } camel_message_info_free (mi); } - camel_db_delete_uids (pitip->folder->parent_store->cdb_w, pitip->folder->full_name, list, NULL); + + full_name = camel_folder_get_full_name (pitip->folder); + parent_store = camel_folder_get_parent_store (pitip->folder); + camel_db_delete_uids (parent_store->cdb_w, full_name, list, NULL); g_slist_free (list); } } else { diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 9503aaf27a..e6dd1a267d 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -217,7 +217,10 @@ static void read_notify_dbus (EMEventTargetMessage *t) { if (bus != NULL) - send_dbus_message ("MessageReading", t->folder->name, 0, NULL, NULL, NULL); + send_dbus_message ( + "MessageReading", + camel_folder_get_name (t->folder), + 0, NULL, NULL, NULL); } static void diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 4bc389e77c..6f968ba0c6 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -348,8 +348,9 @@ mar_got_folder (gchar *folder_uri, gpointer data) { CamelFolderInfo *folder_info; - CamelStore *store; + CamelStore *parent_store; CamelException ex; + const gchar *full_name; gint response; /* FIXME we have to disable the menu item */ @@ -358,9 +359,11 @@ mar_got_folder (gchar *folder_uri, camel_exception_init (&ex); - store = folder->parent_store; + full_name = camel_folder_get_full_name (folder); + parent_store = camel_folder_get_parent_store (folder); + folder_info = camel_store_get_folder_info ( - store, folder->full_name, + parent_store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, &ex); @@ -375,10 +378,10 @@ mar_got_folder (gchar *folder_uri, if (response == GTK_RESPONSE_NO) mark_all_as_read (folder); else if (response == GTK_RESPONSE_YES) - mar_all_sub_folders (store, folder_info, &ex); + mar_all_sub_folders (parent_store, folder_info, &ex); exit: - camel_store_free_folder_info (store, folder_info); + camel_store_free_folder_info (parent_store, folder_info); } static void diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 97281246b5..74e167a9fe 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -554,22 +554,24 @@ build_template_menus_recurse (GtkUIManager *ui_manager, GPtrArray *uids; GtkAction *action; const gchar *action_label; + const gchar *folder_name; gchar *action_name; gchar *path; guint ii; folder = camel_store_get_folder ( store, folder_info->full_name, 0, NULL); + folder_name = camel_folder_get_name (folder); action_name = g_strdup_printf ( "templates-menu-%d", *action_count); *action_count = *action_count + 1; /* To avoid having a Templates dir, we ignore the top level */ - if (g_str_has_suffix (folder->name, "Templates")) + if (g_str_has_suffix (folder_name, "Templates")) action_label = _("Templates"); else - action_label = folder->name; + action_label = folder_name; action = gtk_action_new ( action_name, action_label, NULL, NULL); @@ -700,6 +702,7 @@ update_actions_cb (EShellView *shell_view) CamelStore *store; EMailReader *reader; GPtrArray *uids; + const gchar *full_name; guint action_count = 0; guint merge_id; gpointer data; @@ -730,9 +733,10 @@ update_actions_cb (EShellView *shell_view) store = e_mail_local_get_store (); templates_folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); + full_name = camel_folder_get_full_name (templates_folder); folder_info = camel_store_get_folder_info ( - store, templates_folder->full_name, + store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, NULL); |