static CamelLocalSummary *
mbox_folder_create_summary (CamelLocalFolder *lf,
                            const gchar *folder,
                            CamelIndex *index)
{
	return (CamelLocalSummary *) camel_mbox_summary_new ((CamelFolder *) lf, folder, index);
}
Exemplo n.º 2
0
/* NB: duplicated in maildir store */
static void
fill_fi (CamelStore *store,
         CamelFolderInfo *fi,
         guint32 flags)
{
	CamelFolder *folder;

	fi->unread = -1;
	fi->total = -1;
	folder = camel_object_bag_peek (store->folders, fi->full_name);
	if (folder) {
		if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0)
			camel_folder_refresh_info_sync (folder, NULL, NULL);
		fi->unread = camel_folder_get_unread_message_count (folder);
		fi->total = camel_folder_get_message_count (folder);
		g_object_unref (folder);
	} else {
		CamelLocalStore *local_store;
		gchar *folderpath;
		CamelMboxSummary *mbs;

		local_store = CAMEL_LOCAL_STORE (store);

		/* This should be fast enough not
		 * to have to test for INFO_FAST. */
		folderpath = camel_local_store_get_full_path (
			local_store, fi->full_name);

		mbs = (CamelMboxSummary *) camel_mbox_summary_new (
			NULL, folderpath, NULL);
		/* FIXME[disk-summary] track exception */
		if (camel_folder_summary_header_load_from_db ((CamelFolderSummary *) mbs, store, fi->full_name, NULL)) {
			fi->unread = camel_folder_summary_get_unread_count (
				(CamelFolderSummary *) mbs);
			fi->total = camel_folder_summary_get_saved_count (
				(CamelFolderSummary *) mbs);
		}

		g_object_unref (mbs);
		g_free (folderpath);
	}

	if (camel_local_store_is_main_store (CAMEL_LOCAL_STORE (store)) && fi->full_name
	    && (fi->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_NORMAL)
		fi->flags =
			(fi->flags & ~CAMEL_FOLDER_TYPE_MASK) |
			camel_local_store_get_folder_type_by_full_name (
			CAMEL_LOCAL_STORE (store), fi->full_name);
}