diff options
Diffstat (limited to 'camel/camel-imapx-store.c')
| -rw-r--r-- | camel/camel-imapx-store.c | 93 |
1 files changed, 36 insertions, 57 deletions
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c index e830f9a01..75de63fa2 100644 --- a/camel/camel-imapx-store.c +++ b/camel/camel-imapx-store.c @@ -239,14 +239,11 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store, const gchar *old_folder_path, const gchar *new_folder_path) { - CamelStoreSummary *store_summary; GPtrArray *array; gint olen = strlen (old_folder_path); guint ii; - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - - array = camel_store_summary_array (store_summary); + array = camel_store_summary_array (imapx_store->summary); for (ii = 0; ii < array->len; ii++) { CamelStoreInfo *si; @@ -256,7 +253,7 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store, gchar *new_mailbox_name; si = g_ptr_array_index (array, ii); - path = camel_store_info_path (store_summary, si); + path = camel_store_info_path (imapx_store->summary, si); /* We need to adjust not only the entry for the renamed * folder, but also the entries for all the descendants @@ -272,7 +269,7 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store, new_path = g_strdup (new_folder_path); camel_store_info_set_string ( - store_summary, si, + imapx_store->summary, si, CAMEL_STORE_INFO_PATH, new_path); imapx_si = (CamelIMAPXStoreInfo *) si; @@ -286,12 +283,12 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store, g_free (imapx_si->mailbox_name); imapx_si->mailbox_name = new_mailbox_name; - camel_store_summary_touch (store_summary); + camel_store_summary_touch (imapx_store->summary); g_free (new_path); } - camel_store_summary_array_free (store_summary, array); + camel_store_summary_array_free (imapx_store->summary, array); } static void @@ -395,7 +392,6 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store, CamelFolderInfo *fi; CamelIMAPXStoreInfo *si; CamelStoreInfoFlags flags; - CamelStoreSummary *summary; CamelSettings *settings; gboolean use_subscriptions; gboolean mailbox_is_subscribed; @@ -409,8 +405,6 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store, const gchar *mailbox_name; gchar separator; - summary = CAMEL_STORE_SUMMARY (store->summary); - settings = camel_service_ref_settings (CAMEL_SERVICE (store)); use_subscriptions = camel_imapx_settings_get_use_subscriptions ( CAMEL_IMAPX_SETTINGS (settings)); @@ -454,10 +448,11 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store, if ((flags ^ si->info.flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) { si->info.flags &= ~CAMEL_FOLDER_SUBSCRIBED; si->info.flags |= flags & CAMEL_FOLDER_SUBSCRIBED; - camel_store_summary_touch (summary); + camel_store_summary_touch (store->summary); } - folder_path = camel_store_info_path (summary, (CamelStoreInfo *) si); + folder_path = camel_store_info_path ( + store->summary, (CamelStoreInfo *) si); fi = imapx_store_build_folder_info (store, folder_path, flags); /* Figure out which signals to emit, if any. */ @@ -1034,14 +1029,12 @@ get_folder_offline (CamelStore *store, CamelFolder *new_folder = NULL; CamelStoreInfo *si; CamelService *service; - CamelStoreSummary *store_summary; const gchar *user_cache_dir; service = CAMEL_SERVICE (store); user_cache_dir = camel_service_get_user_cache_dir (service); - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - si = camel_store_summary_path (store_summary, folder_name); + si = camel_store_summary_path (imapx_store->summary, folder_name); if (si != NULL) { gchar *base_dir; @@ -1054,7 +1047,7 @@ get_folder_offline (CamelStore *store, g_free (folder_dir); g_free (base_dir); - camel_store_summary_info_unref (store_summary, si); + camel_store_summary_info_unref (imapx_store->summary, si); } else { g_set_error ( error, CAMEL_STORE_ERROR, @@ -1117,19 +1110,16 @@ imapx_unmark_folder_subscribed (CamelIMAPXStore *imapx_store, const gchar *folder_path, gboolean emit_signal) { - CamelStoreSummary *store_summary; CamelStoreInfo *si; - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - - si = camel_store_summary_path (store_summary, folder_path); + si = camel_store_summary_path (imapx_store->summary, folder_path); if (si != NULL) { if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) { si->flags &= ~CAMEL_STORE_INFO_FOLDER_SUBSCRIBED; - camel_store_summary_touch (store_summary); - camel_store_summary_save (store_summary); + camel_store_summary_touch (imapx_store->summary); + camel_store_summary_save (imapx_store->summary); } - camel_store_summary_info_unref (store_summary, si); + camel_store_summary_info_unref (imapx_store->summary, si); } if (emit_signal) { @@ -1181,9 +1171,8 @@ imapx_delete_folder_from_cache (CamelIMAPXStore *imapx_store, g_free (folder_dir); event: - camel_store_summary_remove_path ( - (CamelStoreSummary *) imapx_store->summary, folder_path); - camel_store_summary_save ((CamelStoreSummary *) imapx_store->summary); + camel_store_summary_remove_path (imapx_store->summary, folder_path); + camel_store_summary_save (imapx_store->summary); fi = imapx_store_build_folder_info (imapx_store, folder_path, 0); camel_store_folder_deleted (CAMEL_STORE (imapx_store), fi); @@ -1199,7 +1188,6 @@ get_folder_info_offline (CamelStore *store, CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (store); CamelService *service; CamelSettings *settings; - CamelStoreSummary *store_summary; gboolean include_inbox = FALSE; CamelFolderInfo *fi; GPtrArray *folders; @@ -1230,9 +1218,7 @@ get_folder_info_offline (CamelStore *store, * the moment. So let it do the right thing by bailing out if it's * not a folder we're explicitly interested in. */ - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - - array = camel_store_summary_array (store_summary); + array = camel_store_summary_array (imapx_store->summary); for (ii = 0; ii < array->len; ii++) { CamelStoreInfo *si; @@ -1241,7 +1227,7 @@ get_folder_info_offline (CamelStore *store, gboolean si_is_match; si = g_ptr_array_index (array, ii); - folder_path = camel_store_info_path (store_summary, si); + folder_path = camel_store_info_path (imapx_store->summary, si); si_is_inbox = (g_ascii_strcasecmp (folder_path, "INBOX") == 0); /* Filter by folder path. */ @@ -1301,7 +1287,7 @@ get_folder_info_offline (CamelStore *store, g_ptr_array_add (folders, fi); } - camel_store_summary_array_free (store_summary, array); + camel_store_summary_array_free (imapx_store->summary, array); fi = camel_folder_info_build (folders, top, '/', TRUE); @@ -1315,14 +1301,11 @@ collect_folder_info_for_list (CamelIMAPXStore *imapx_store, CamelIMAPXMailbox *mailbox, GHashTable *folder_info_results) { - CamelStoreSummary *store_summary; CamelIMAPXStoreInfo *si; CamelFolderInfo *fi; const gchar *folder_path; const gchar *mailbox_name; - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - mailbox_name = camel_imapx_mailbox_get_name (mailbox); si = camel_imapx_store_summary_mailbox ( @@ -1330,7 +1313,7 @@ collect_folder_info_for_list (CamelIMAPXStore *imapx_store, g_return_if_fail (si != NULL); folder_path = camel_store_info_path ( - store_summary, (CamelStoreInfo *) si); + imapx_store->summary, (CamelStoreInfo *) si); fi = imapx_store_build_folder_info (imapx_store, folder_path, 0); /* Takes ownership of the CamelFolderInfo. */ @@ -1515,7 +1498,6 @@ sync_folders (CamelIMAPXStore *imapx_store, GError **error) { CamelIMAPXServer *server; - CamelStoreSummary *store_summary; GHashTable *folder_info_results; GPtrArray *array; guint ii; @@ -1525,8 +1507,6 @@ sync_folders (CamelIMAPXStore *imapx_store, if (server == NULL) return FALSE; - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); - /* mailbox name -> CamelFolderInfo */ folder_info_results = g_hash_table_new_full ( (GHashFunc) imapx_name_hash, @@ -1568,7 +1548,7 @@ sync_folders (CamelIMAPXStore *imapx_store, if (!success) goto exit; - array = camel_store_summary_array (store_summary); + array = camel_store_summary_array (imapx_store->summary); for (ii = 0; ii < array->len; ii++) { CamelStoreInfo *si; @@ -1578,7 +1558,7 @@ sync_folders (CamelIMAPXStore *imapx_store, gboolean pattern_match; si = g_ptr_array_index (array, ii); - si_path = camel_store_info_path (store_summary, si); + si_path = camel_store_info_path (imapx_store->summary, si); mailbox_name = ((CamelIMAPXStoreInfo *) si)->mailbox_name; if (mailbox_name == NULL || *mailbox_name == '\0') @@ -1603,12 +1583,13 @@ sync_folders (CamelIMAPXStore *imapx_store, imapx_store, dup_folder_path); g_free (dup_folder_path); } else { - camel_store_summary_remove (store_summary, si); + camel_store_summary_remove ( + imapx_store->summary, si); } } } - camel_store_summary_array_free (store_summary, array); + camel_store_summary_array_free (imapx_store->summary, array); exit: g_hash_table_destroy (folder_info_results); @@ -1643,7 +1624,7 @@ imapx_refresh_finfo (CamelSession *session, sync_folders (store, NULL, 0, cancellable, error); - camel_store_summary_save (CAMEL_STORE_SUMMARY (store->summary)); + camel_store_summary_save (store->summary); exit: camel_operation_pop_message (cancellable); @@ -1811,13 +1792,11 @@ imapx_store_get_folder_info_sync (CamelStore *store, CamelFolderInfo *fi = NULL; CamelService *service; CamelSettings *settings; - CamelStoreSummary *store_summary; gboolean initial_setup = FALSE; gboolean use_subscriptions; service = CAMEL_SERVICE (store); imapx_store = CAMEL_IMAPX_STORE (store); - store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary); settings = camel_service_ref_settings (service); @@ -1874,7 +1853,7 @@ imapx_store_get_folder_info_sync (CamelStore *store, if (!sync_folders (imapx_store, top, flags, cancellable, error)) goto exit; - camel_store_summary_save (store_summary); + camel_store_summary_save (imapx_store->summary); /* ensure the INBOX is subscribed if lsub was preferred*/ if (initial_setup && use_subscriptions) @@ -2276,11 +2255,12 @@ imapx_store_initable_init (GInitable *initable, service = CAMEL_SERVICE (initable); user_cache_dir = camel_service_get_user_cache_dir (service); - imapx_store->summary = camel_imapx_store_summary_new (); + imapx_store->summary = + g_object_new (CAMEL_TYPE_IMAPX_STORE_SUMMARY, NULL); summary = g_build_filename (user_cache_dir, ".ev-store-summary", NULL); - camel_store_summary_set_filename ((CamelStoreSummary *) imapx_store->summary, summary); - camel_store_summary_load ((CamelStoreSummary *) imapx_store->summary); + camel_store_summary_set_filename (imapx_store->summary, summary); + camel_store_summary_load (imapx_store->summary); g_free (summary); @@ -2338,12 +2318,11 @@ imapx_store_folder_is_subscribed (CamelSubscribable *subscribable, if (folder_name && *folder_name == '/') folder_name++; - si = camel_store_summary_path ( - (CamelStoreSummary *) imapx_store->summary, folder_name); - if (si) { - is_subscribed = (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) != 0; - camel_store_summary_info_unref ( - (CamelStoreSummary *) imapx_store->summary, si); + si = camel_store_summary_path (imapx_store->summary, folder_name); + if (si != NULL) { + if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) + is_subscribed = TRUE; + camel_store_summary_info_unref (imapx_store->summary, si); } return is_subscribed; |
