[evolution-data-server/wip/camel-more-gobject] Remove unused CamelMessageInfo::preview related stuff
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/camel-more-gobject] Remove unused CamelMessageInfo::preview related stuff
- Date: Tue, 13 Sep 2016 12:00:43 +0000 (UTC)
commit 7be4009307f7719aa3c72b825a24beebb8714974
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 13 14:00:03 2016 +0200
Remove unused CamelMessageInfo::preview related stuff
camel/camel-db.c | 111 -------------
camel/camel-db.h | 5 -
camel/camel-folder-summary.c | 247 +----------------------------
camel/camel-folder-summary.h | 9 -
camel/camel-message-info-base.c | 46 ------
camel/camel-message-info.c | 100 ------------
camel/camel-message-info.h | 6 -
camel/camel-mime-part-utils.c | 93 -----------
camel/camel-mime-part-utils.h | 2 -
camel/camel-vee-message-info.c | 15 --
camel/providers/local/camel-mbox-folder.c | 5 -
11 files changed, 1 insertions(+), 638 deletions(-)
---
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 641f025..3eaf024 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -1418,104 +1418,6 @@ camel_db_get_folder_deleted_uids (CamelDB *db,
return array;
}
-struct ReadPreviewData
-{
- GHashTable *columns_hash;
- GHashTable *hash;
-};
-
-static gint
-read_preview_callback (gpointer ref,
- gint ncol,
- gchar **cols,
- gchar **name)
-{
- struct ReadPreviewData *rpd = ref;
- const gchar *uid = NULL;
- gchar *msg = NULL;
- gint i;
-
- for (i = 0; i < ncol; ++i) {
- if (!name[i] || !cols[i])
- continue;
-
- switch (camel_db_get_column_ident (&rpd->columns_hash, i, ncol, name)) {
- case CAMEL_DB_COLUMN_UID:
- uid = camel_pstring_strdup (cols[i]);
- break;
- case CAMEL_DB_COLUMN_PREVIEW:
- msg = g_strdup (cols[i]);
- break;
- default:
- g_warn_if_reached ();
- break;
- }
- }
-
- g_hash_table_insert (rpd->hash, (gchar *) uid, msg);
-
- return 0;
-}
-
-/**
- * camel_db_get_folder_preview:
- *
- * Returns: (element-type utf8 utf8) (transfer full):
- *
- * Since: 2.28
- **/
-GHashTable *
-camel_db_get_folder_preview (CamelDB *db,
- const gchar *folder_name,
- GError **error)
-{
- gchar *sel_query;
- gint ret;
- struct ReadPreviewData rpd;
- GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- sel_query = sqlite3_mprintf ("SELECT uid, preview FROM '%q_preview'", folder_name);
-
- rpd.columns_hash = NULL;
- rpd.hash = hash;
-
- ret = camel_db_select (db, sel_query, read_preview_callback, &rpd, error);
- sqlite3_free (sel_query);
-
- if (rpd.columns_hash)
- g_hash_table_destroy (rpd.columns_hash);
-
- if (!g_hash_table_size (hash) || ret != 0) {
- g_hash_table_destroy (hash);
- hash = NULL;
- }
-
- return hash;
-}
-
-/**
- * camel_db_write_preview_record:
- *
- * Since: 2.28
- **/
-gint
-camel_db_write_preview_record (CamelDB *db,
- const gchar *folder_name,
- const gchar *uid,
- const gchar *msg,
- GError **error)
-{
- gchar *query;
- gint ret;
-
- query = sqlite3_mprintf ("INSERT OR REPLACE INTO '%q_preview' VALUES(%Q,%Q)", folder_name, uid, msg);
-
- ret = camel_db_add_to_transaction (db, query, error);
- sqlite3_free (query);
-
- return ret;
-}
-
/**
* camel_db_create_folders_table:
*
@@ -1606,11 +1508,6 @@ camel_db_create_message_info_table (CamelDB *cdb,
ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
sqlite3_free (table_creation_query);
- /* Create message preview table. */
- table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS '%q_preview' ( uid TEXT PRIMARY
KEY , preview TEXT)", folder_name);
- ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
- sqlite3_free (table_creation_query);
-
/* FIXME: sqlize folder_name before you create the index */
safe_index = g_strdup_printf ("SINDEX-%s", folder_name);
table_creation_query = sqlite3_mprintf ("DROP INDEX IF EXISTS %Q", safe_index);
@@ -1618,13 +1515,6 @@ camel_db_create_message_info_table (CamelDB *cdb,
g_free (safe_index);
sqlite3_free (table_creation_query);
- /* INDEX on preview */
- safe_index = g_strdup_printf ("SINDEX-%s-preview", folder_name);
- table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON '%q_preview' (uid,
preview)", safe_index, folder_name);
- ret = camel_db_add_to_transaction (cdb, table_creation_query, error);
- g_free (safe_index);
- sqlite3_free (table_creation_query);
-
/* Index on deleted*/
safe_index = g_strdup_printf ("DELINDEX-%s", folder_name);
table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (deleted)", safe_index,
folder_name);
@@ -2646,7 +2536,6 @@ static struct _known_column_names {
{ "mlist", CAMEL_DB_COLUMN_MLIST },
{ "nextuid", CAMEL_DB_COLUMN_NEXTUID },
{ "part", CAMEL_DB_COLUMN_PART },
- { "preview", CAMEL_DB_COLUMN_PREVIEW },
{ "read", CAMEL_DB_COLUMN_READ },
{ "replied", CAMEL_DB_COLUMN_REPLIED },
{ "saved_count", CAMEL_DB_COLUMN_SAVED_COUNT },
diff --git a/camel/camel-db.h b/camel/camel-db.h
index bcfb202..6535502 100644
--- a/camel/camel-db.h
+++ b/camel/camel-db.h
@@ -250,7 +250,6 @@ typedef enum {
CAMEL_DB_COLUMN_MLIST,
CAMEL_DB_COLUMN_NEXTUID,
CAMEL_DB_COLUMN_PART,
- CAMEL_DB_COLUMN_PREVIEW,
CAMEL_DB_COLUMN_READ,
CAMEL_DB_COLUMN_REPLIED,
CAMEL_DB_COLUMN_SAVED_COUNT,
@@ -332,10 +331,6 @@ gint camel_db_set_collate (CamelDB *cdb, const gchar *col, const gchar *collate,
gint camel_db_start_in_memory_transactions (CamelDB *cdb, GError **error);
gint camel_db_flush_in_memory_transactions (CamelDB *cdb, const gchar * folder_name, GError **error);
-GHashTable *
-camel_db_get_folder_preview (CamelDB *db, const gchar *folder_name, GError **error);
-gint camel_db_write_preview_record (CamelDB *db, const gchar *folder_name, const gchar *uid, const gchar
*msg, GError **error);
-
gint
camel_db_reset_folder_version (CamelDB *cdb, const gchar *folder_name, gint reset_version, GError **error);
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index f438739..81dc2b6 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -83,9 +83,6 @@ struct _CamelFolderSummaryPrivate {
GRecMutex summary_lock; /* for the summary hashtable/array */
GRecMutex filter_lock; /* for accessing any of the filtering/indexing stuff, since we share them */
- gboolean need_preview;
- GHashTable *preview_updates;
-
guint32 nextuid; /* next uid? */
guint32 saved_count; /* how many were saved/loaded */
guint32 unread_count; /* handy totals */
@@ -150,8 +147,7 @@ enum {
PROP_JUNK_COUNT,
PROP_JUNK_NOT_DELETED_COUNT,
PROP_VISIBLE_COUNT,
- PROP_BUILD_CONTENT,
- PROP_NEED_PREVIEW
+ PROP_BUILD_CONTENT
};
G_DEFINE_TYPE (CamelFolderSummary, camel_folder_summary, G_TYPE_OBJECT)
@@ -238,8 +234,6 @@ folder_summary_finalize (GObject *object)
g_hash_table_foreach (priv->filter_charset, free_o_name, NULL);
g_hash_table_destroy (priv->filter_charset);
- g_hash_table_destroy (priv->preview_updates);
-
g_rec_mutex_clear (&priv->summary_lock);
g_rec_mutex_clear (&priv->filter_lock);
@@ -277,12 +271,6 @@ folder_summary_set_property (GObject *object,
CAMEL_FOLDER_SUMMARY (object),
g_value_get_boolean (value));
return;
-
- case PROP_NEED_PREVIEW:
- camel_folder_summary_set_need_preview (
- CAMEL_FOLDER_SUMMARY (object),
- g_value_get_boolean (value));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -350,13 +338,6 @@ folder_summary_get_property (GObject *object,
camel_folder_summary_get_build_content (
CAMEL_FOLDER_SUMMARY (object)));
return;
-
- case PROP_NEED_PREVIEW:
- g_value_set_boolean (
- value,
- camel_folder_summary_get_need_preview (
- CAMEL_FOLDER_SUMMARY (object)));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -903,20 +884,6 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *class)
"Whether to build CamelMessageInfo.content",
FALSE,
G_PARAM_READWRITE));
-
- /**
- * CamelFolderSummary:need-preview
- *
- **/
- g_object_class_install_property (
- object_class,
- PROP_NEED_PREVIEW,
- g_param_spec_boolean (
- "need-preview",
- "Need preview",
- "",
- FALSE,
- G_PARAM_READWRITE));
}
static void
@@ -931,9 +898,6 @@ camel_folder_summary_init (CamelFolderSummary *summary)
summary->priv->filter_charset = g_hash_table_new (
camel_strcase_hash, camel_strcase_equal);
- summary->priv->need_preview = FALSE;
- summary->priv->preview_updates = g_hash_table_new (g_str_hash, g_str_equal);
-
summary->priv->nextuid = 1;
summary->priv->uids = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)
camel_pstring_free, NULL);
summary->priv->loaded_infos = g_hash_table_new (g_str_hash, g_str_equal);
@@ -1152,33 +1116,6 @@ camel_folder_summary_get_build_content (CamelFolderSummary *summary)
}
/**
- * camel_folder_summary_set_need_preview:
- *
- * Since: 2.28
- **/
-void
-camel_folder_summary_set_need_preview (CamelFolderSummary *summary,
- gboolean preview)
-{
- g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
-
- summary->priv->need_preview = preview;
-}
-
-/**
- * camel_folder_summary_get_need_preview:
- *
- * Since: 2.28
- **/
-gboolean
-camel_folder_summary_get_need_preview (CamelFolderSummary *summary)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
-
- return summary->priv->need_preview;
-}
-
-/**
* camel_folder_summary_next_uid:
* @summary: a #CamelFolderSummary object
*
@@ -1848,117 +1785,6 @@ cfs_cache_size (CamelFolderSummary *summary)
return g_hash_table_size (summary->priv->uids);
}
-/* Update preview of cached messages */
-
-static void
-msg_update_preview (const gchar *uid,
- gpointer value,
- CamelFolder *folder)
-{
- CamelMessageInfo *info = camel_folder_summary_get (folder->summary, uid);
- CamelMimeMessage *msg;
- CamelStore *parent_store;
- const gchar *full_name;
-
- full_name = camel_folder_get_full_name (folder);
- parent_store = camel_folder_get_parent_store (folder);
-
- /* FIXME Pass a GCancellable */
- msg = camel_folder_get_message_sync (folder, uid, NULL, NULL);
- if (msg != NULL) {
- if (camel_mime_message_build_preview ((CamelMimePart *) msg, info) &&
camel_message_info_get_preview (info)) {
- if (parent_store && !is_in_memory_summary (folder->summary))
- camel_db_write_preview_record (parent_store->cdb_w, full_name,
- camel_message_info_get_uid (info), camel_message_info_get_preview
(info), NULL);
- }
- }
- g_clear_object (&info);
-}
-
-static void
-pick_uids (const gchar *uid,
- CamelMessageInfo *mi,
- GPtrArray *array)
-{
- if (camel_message_info_get_preview (mi))
- g_ptr_array_add (array, (gchar *) camel_pstring_strdup (uid));
-}
-
-static void
-copy_all_uids_to_hash (gpointer uid,
- gpointer hash)
-{
- g_return_if_fail (uid != NULL);
-
- g_hash_table_insert (hash, (gchar *) camel_pstring_strdup (uid), GINT_TO_POINTER (1));
-}
-
-static gboolean
-fill_mi (gchar *uid,
- gchar *msg,
- CamelFolder *folder)
-{
- CamelMessageInfo *info;
-
- info = g_hash_table_lookup (folder->summary->priv->loaded_infos, uid);
- if (info) /* We re assign the memory of msg */
- camel_message_info_set_preview (info, msg);
- camel_pstring_free (uid); /* unref the uid */
- g_free (msg);
-
- return TRUE;
-}
-
-static void
-preview_update (CamelSession *session,
- GCancellable *cancellable,
- CamelFolder *folder,
- GError **error)
-{
- /* FIXME: Either lock & use or copy & use.*/
- GPtrArray *uids_uncached, *uids_array;
- GHashTable *preview_data, *uids_hash;
- CamelStore *parent_store;
- const gchar *full_name;
- gboolean is_in_memory = is_in_memory_summary (folder->summary);
- gint i;
-
- uids_array = camel_folder_summary_get_array (folder->summary);
- uids_hash = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) camel_pstring_free,
NULL);
- g_ptr_array_foreach (uids_array, copy_all_uids_to_hash, uids_hash);
- uids_uncached = camel_folder_get_uncached_uids (folder, uids_array, NULL);
- camel_folder_summary_free_array (uids_array);
- uids_array = NULL;
-
- full_name = camel_folder_get_full_name (folder);
- parent_store = camel_folder_get_parent_store (folder);
- preview_data = (!parent_store || is_in_memory) ? NULL : camel_db_get_folder_preview
(parent_store->cdb_r, full_name, NULL);
- if (preview_data) {
- g_hash_table_foreach_remove (preview_data, (GHRFunc) fill_mi, folder);
- g_hash_table_destroy (preview_data);
- }
-
- camel_folder_summary_lock (folder->summary);
- g_hash_table_foreach (folder->summary->priv->loaded_infos, (GHFunc) pick_uids, uids_uncached);
- camel_folder_summary_unlock (folder->summary);
-
- for (i = 0; i < uids_uncached->len; i++) {
- g_hash_table_remove (uids_hash, uids_uncached->pdata[i]);
- }
-
- camel_folder_lock (folder);
- if (parent_store && !is_in_memory)
- camel_db_begin_transaction (parent_store->cdb_w, NULL);
- g_hash_table_foreach (uids_hash, (GHFunc) msg_update_preview, folder);
- if (parent_store && !is_in_memory)
- camel_db_end_transaction (parent_store->cdb_w, NULL);
- camel_folder_unlock (folder);
- camel_folder_free_uids (folder, uids_uncached);
- g_hash_table_destroy (uids_hash);
-}
-
-/* end */
-
static void
cfs_reload_from_db (CamelFolderSummary *summary,
GError **error)
@@ -1994,54 +1820,6 @@ cfs_reload_from_db (CamelFolderSummary *summary,
g_hash_table_destroy (data.columns_hash);
cfs_schedule_info_release_timer (summary);
-
- /* FIXME Convert this to a GTask, submitted through
- * camel_service_queue_task(). Then it won't
- * have to call camel_folder_lock/unlock(). */
- if (summary->priv->need_preview) {
- CamelSession *session;
-
- /* This may not be available in a case of this being called as part
- of CamelSession's dispose, because the CamelService uses GWeakRef
- object which is invalidates its content when it reaches the dispose. */
- session = camel_service_ref_session (CAMEL_SERVICE (parent_store));
- if (session) {
- gchar *description;
-
- /* Translators: The first '%s' is replaced with an account name and the second '%s'
- is replaced with a full path name. The spaces around ':' are intentional, as
- the whole '%s : %s' is meant as an absolute identification of the folder. */
- description = g_strdup_printf (_("Update preview data for folder '%s : %s'"),
- camel_service_get_display_name (CAMEL_SERVICE (parent_store)),
- camel_folder_get_full_name (summary->priv->folder));
-
- camel_session_submit_job (
- session, description,
- (CamelSessionCallback) preview_update,
- g_object_ref (summary->priv->folder),
- (GDestroyNotify) g_object_unref);
-
- g_object_unref (session);
- g_free (description);
- }
- }
-
- return;
-}
-
-/**
- * camel_folder_summary_add_preview:
- *
- * Since: 2.28
- **/
-void
-camel_folder_summary_add_preview (CamelFolderSummary *summary,
- CamelMessageInfo *info)
-{
- camel_folder_summary_lock (summary);
- g_hash_table_insert (summary->priv->preview_updates, (gpointer) camel_message_info_get_uid (info),
(gpointer) camel_message_info_get_preview (info));
- camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary);
}
/**
@@ -2427,23 +2205,6 @@ save_message_infos_to_db (CamelFolderSummary *summary,
return 0;
}
-static void
-msg_save_preview (const gchar *uid,
- gpointer value,
- CamelFolder *folder)
-{
- CamelStore *parent_store;
- const gchar *full_name;
-
- full_name = camel_folder_get_full_name (folder);
- parent_store = camel_folder_get_parent_store (folder);
-
- if (parent_store) {
- camel_db_write_preview_record (
- parent_store->cdb_w, full_name, uid, (gchar *) value, NULL);
- }
-}
-
/**
* camel_folder_summary_save_to_db:
*
@@ -2473,12 +2234,6 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
camel_folder_summary_lock (summary);
d (printf ("\ncamel_folder_summary_save_to_db called \n"));
- if (summary->priv->need_preview && g_hash_table_size (summary->priv->preview_updates)) {
- camel_db_begin_transaction (parent_store->cdb_w, NULL);
- g_hash_table_foreach (summary->priv->preview_updates, (GHFunc) msg_save_preview,
summary->priv->folder);
- g_hash_table_remove_all (summary->priv->preview_updates);
- camel_db_end_transaction (parent_store->cdb_w, NULL);
- }
summary->flags &= ~CAMEL_FOLDER_SUMMARY_DIRTY;
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 3ca1e1a..f3a9844 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -201,11 +201,6 @@ void camel_folder_summary_set_build_content
gboolean state);
gboolean camel_folder_summary_get_build_content
(CamelFolderSummary *summary);
-void camel_folder_summary_set_need_preview
- (CamelFolderSummary *summary,
- gboolean preview);
-gboolean camel_folder_summary_get_need_preview
- (CamelFolderSummary *summary);
guint32 camel_folder_summary_next_uid (CamelFolderSummary *summary);
void camel_folder_summary_set_next_uid
(CamelFolderSummary *summary,
@@ -257,10 +252,6 @@ void camel_folder_summary_content_info_free
(CamelFolderSummary *summary,
CamelMessageContentInfo *ci);
-void camel_folder_summary_add_preview
- (CamelFolderSummary *summary,
- CamelMessageInfo *info);
-
/* add a new raw summary item */
void camel_folder_summary_add (CamelFolderSummary *summary,
CamelMessageInfo *info);
diff --git a/camel/camel-message-info-base.c b/camel/camel-message-info-base.c
index bc214a1..c766f52 100644
--- a/camel/camel-message-info-base.c
+++ b/camel/camel-message-info-base.c
@@ -31,7 +31,6 @@ struct _CamelMessageInfoBasePrivate {
CamelNamedFlags *user_flags;
CamelNameValueArray *user_tags;
gchar *subject;
- gchar *preview;
gchar *from;
gchar *to;
gchar *cc;
@@ -339,48 +338,6 @@ message_info_base_set_subject (CamelMessageInfo *mi,
}
static const gchar *
-message_info_base_get_preview (const CamelMessageInfo *mi)
-{
- CamelMessageInfoBase *bmi;
- const gchar *result;
-
- g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
-
- bmi = CAMEL_MESSAGE_INFO_BASE (mi);
-
- camel_message_info_property_lock (mi);
- result = bmi->priv->preview;
- camel_message_info_property_unlock (mi);
-
- return result;
-}
-
-static gboolean
-message_info_base_set_preview (CamelMessageInfo *mi,
- const gchar *preview)
-{
- CamelMessageInfoBase *bmi;
- gboolean changed;
-
- g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
-
- bmi = CAMEL_MESSAGE_INFO_BASE (mi);
-
- camel_message_info_property_lock (mi);
-
- changed = g_strcmp0 (bmi->priv->preview, preview) != 0;
-
- if (changed) {
- g_free (bmi->priv->preview);
- bmi->priv->preview = g_strdup (preview);
- }
-
- camel_message_info_property_unlock (mi);
-
- return changed;
-}
-
-static const gchar *
message_info_base_get_from (const CamelMessageInfo *mi)
{
CamelMessageInfoBase *bmi;
@@ -837,7 +794,6 @@ message_info_base_dispose (GObject *object)
#define free_ptr(x) G_STMT_START { g_free (x); x = NULL; } G_STMT_END
free_ptr (bmi->priv->subject);
- free_ptr (bmi->priv->preview);
free_ptr (bmi->priv->from);
free_ptr (bmi->priv->to);
free_ptr (bmi->priv->cc);
@@ -880,8 +836,6 @@ camel_message_info_base_class_init (CamelMessageInfoBaseClass *class)
mi_class->take_user_tags = message_info_base_take_user_tags;
mi_class->get_subject = message_info_base_get_subject;
mi_class->set_subject = message_info_base_set_subject;
- mi_class->get_preview = message_info_base_get_preview;
- mi_class->set_preview = message_info_base_set_preview;
mi_class->get_from = message_info_base_get_from;
mi_class->set_from = message_info_base_set_from;
mi_class->get_to = message_info_base_get_to;
diff --git a/camel/camel-message-info.c b/camel/camel-message-info.c
index a5f1bf0..d8a930e 100644
--- a/camel/camel-message-info.c
+++ b/camel/camel-message-info.c
@@ -55,7 +55,6 @@ enum {
PROP_USER_FLAGS,
PROP_USER_TAGS,
PROP_SUBJECT,
- PROP_PREVIEW,
PROP_FROM,
PROP_TO,
PROP_CC,
@@ -106,7 +105,6 @@ message_info_clone (const CamelMessageInfo *mi,
camel_message_info_take_user_flags (result, camel_message_info_dup_user_flags (mi));
camel_message_info_take_user_tags (result, camel_message_info_dup_user_tags (mi));
camel_message_info_set_subject (result, camel_message_info_get_subject (mi));
- camel_message_info_set_preview (result, camel_message_info_get_preview (mi));
camel_message_info_set_from (result, camel_message_info_get_from (mi));
camel_message_info_set_to (result, camel_message_info_get_to (mi));
camel_message_info_set_cc (result, camel_message_info_get_cc (mi));
@@ -401,10 +399,6 @@ message_info_set_property (GObject *object,
camel_message_info_set_subject (mi, g_value_get_string (value));
return;
- case PROP_PREVIEW:
- camel_message_info_set_preview (mi, g_value_get_string (value));
- return;
-
case PROP_FROM:
camel_message_info_set_from (mi, g_value_get_string (value));
return;
@@ -498,10 +492,6 @@ message_info_get_property (GObject *object,
g_value_set_string (value, camel_message_info_get_subject (mi));
return;
- case PROP_PREVIEW:
- g_value_set_string (value, camel_message_info_get_preview (mi));
- return;
-
case PROP_FROM:
g_value_set_string (value, camel_message_info_get_from (mi));
return;
@@ -774,23 +764,6 @@ camel_message_info_class_init (CamelMessageInfoClass *class)
G_PARAM_READWRITE));
/**
- * CamelMessageInfo:preview
- *
- * Preview of the associated message.
- *
- * Since: 3.24
- **/
- g_object_class_install_property (
- object_class,
- PROP_PREVIEW,
- g_param_spec_string (
- "preview",
- "Preview",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- /**
* CamelMessageInfo:from
*
* From address of the associated message.
@@ -2154,79 +2127,6 @@ camel_message_info_set_subject (CamelMessageInfo *mi,
}
/**
- * camel_message_info_get_preview:
- * @mi: a #CamelMessageInfo
- *
- * Returns: (transfer none): Preview of the @mi.
- *
- * Since: 3.24
- **/
-const gchar *
-camel_message_info_get_preview (const CamelMessageInfo *mi)
-{
- CamelMessageInfoClass *klass;
- const gchar *result;
-
- g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
-
- klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
- g_return_val_if_fail (klass != NULL, NULL);
- g_return_val_if_fail (klass->get_preview != NULL, NULL);
-
- camel_message_info_property_lock (mi);
- result = klass->get_preview (mi);
- camel_message_info_property_unlock (mi);
-
- return result;
-}
-
-/**
- * camel_message_info_set_preview:
- * @mi: a #CamelMessageInfo
- * @preview: (nullable): a preview to set
- *
- * Sets preview of the associated message.
- *
- * This property is considered static, in a meaning that it should
- * not change during the life-time of the @mi, the same as it doesn't
- * change in the associated message.
- *
- * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is abort notifications. There is not emitted
- * folder's "changed" signal for this @mi.
- *
- * Returns: Whether the value changed.
- *
- * Since: 3.24
- **/
-gboolean
-camel_message_info_set_preview (CamelMessageInfo *mi,
- const gchar *preview)
-{
- CamelMessageInfoClass *klass;
- gboolean changed, abort_notifications;
-
- g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
-
- klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
- g_return_val_if_fail (klass != NULL, FALSE);
- g_return_val_if_fail (klass->set_preview != NULL, FALSE);
-
- camel_message_info_property_lock (mi);
- changed = klass->set_preview (mi, preview);
- abort_notifications = mi->priv->abort_notifications;
- camel_message_info_property_unlock (mi);
-
- if (changed && !abort_notifications) {
- g_object_notify (G_OBJECT (mi), "preview");
- camel_message_info_set_dirty (mi, TRUE);
- camel_message_info_set_folder_flagged (mi, TRUE);
- }
-
- return changed;
-}
-
-/**
* camel_message_info_get_from:
* @mi: a #CamelMessageInfo
*
diff --git a/camel/camel-message-info.h b/camel/camel-message-info.h
index 52b3394..7b355cb 100644
--- a/camel/camel-message-info.h
+++ b/camel/camel-message-info.h
@@ -149,9 +149,6 @@ struct _CamelMessageInfoClass {
const gchar * (* get_subject) (const CamelMessageInfo *mi);
gboolean (* set_subject) (CamelMessageInfo *mi,
const gchar *subject);
- const gchar * (* get_preview) (const CamelMessageInfo *mi);
- gboolean (* set_preview) (CamelMessageInfo *mi,
- const gchar *preview);
const gchar * (* get_from) (const CamelMessageInfo *mi);
gboolean (* set_from) (CamelMessageInfo *mi,
const gchar *from);
@@ -279,9 +276,6 @@ gboolean camel_message_info_take_user_tags
const gchar * camel_message_info_get_subject (const CamelMessageInfo *mi);
gboolean camel_message_info_set_subject (CamelMessageInfo *mi,
const gchar *subject);
-const gchar * camel_message_info_get_preview (const CamelMessageInfo *mi);
-gboolean camel_message_info_set_preview (CamelMessageInfo *mi,
- const gchar *preview);
const gchar * camel_message_info_get_from (const CamelMessageInfo *mi);
gboolean camel_message_info_set_from (CamelMessageInfo *mi,
const gchar *from);
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 61328c4..6ee8e11 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -151,96 +151,3 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw,
return success;
}
-
-/**
- * camel_mime_message_build_preview:
- *
- * <note>
- * <para>
- * This function blocks like crazy.
- * </para>
- * </note>
- *
- * Since: 2.28
- **/
-gboolean
-camel_mime_message_build_preview (CamelMimePart *msg,
- CamelMessageInfo *info)
-{
- CamelDataWrapper *dw;
- gboolean got_plain = FALSE;
-
- dw = camel_medium_get_content ((CamelMedium *) msg);
- if (camel_content_type_is (dw->mime_type, "multipart", "*")) {
- gint i, nparts;
- CamelMultipart *mp = (CamelMultipart *) camel_medium_get_content ((CamelMedium *) msg);
-
- g_warn_if_fail (CAMEL_IS_MULTIPART (mp));
-
- nparts = camel_multipart_get_number (mp);
- for (i = 0; i < nparts && !got_plain; i++) {
- CamelMimePart *part = camel_multipart_get_part (mp, i);
- got_plain = camel_mime_message_build_preview (part, info);
- }
-
- } else if (camel_content_type_is (dw->mime_type, "text", "*") &&
- /* !camel_content_type_is (dw->mime_type, "text", "html") && */
- !camel_content_type_is (dw->mime_type, "text", "calendar")) {
- CamelStream *mstream, *bstream;
-
- /* FIXME Pass a GCancellable and GError here. */
- mstream = camel_stream_mem_new ();
- if (camel_data_wrapper_decode_to_stream_sync (dw, mstream, NULL, NULL) > 0) {
- gchar *line = NULL;
- GString *str = g_string_new (NULL);
- gchar *preview_str;
-
- g_seekable_seek (
- G_SEEKABLE (mstream), 0,
- G_SEEK_SET, NULL, NULL);
-
- bstream = camel_stream_buffer_new (mstream, CAMEL_STREAM_BUFFER_READ |
CAMEL_STREAM_BUFFER_BUFFER);
-
- /* We should fetch just 200 unquoted lines. */
- while ((line = camel_stream_buffer_read_line ((CamelStreamBuffer *) bstream, NULL,
NULL)) && str->len < 200) {
- gchar *tmp = line;
-
- if (*line == '>' || strstr (line, "wrote:")) {
- g_free (tmp);
- continue;
- }
- if (g_str_has_prefix (line, "--")) {
- g_free (tmp);
- line = NULL;
- break;
- }
- while (*line && ((*line == ' ') || *line == '\t'))
- line++;
- if (*line == '\0' || *line == '\n') {
- g_free (tmp);
- continue;
- }
-
- g_string_append (str, " ");
- g_string_append (str, line);
- g_free (tmp);
- line = NULL;
- }
- if (str->len > 100) {
- g_string_insert (str, 100, "\n");
- }
-
- preview_str = camel_utf8_make_valid (str->str);
-
- camel_message_info_set_preview (info, preview_str);
- g_string_free (str, TRUE);
- g_free (preview_str);
-
- g_object_unref (bstream);
- }
- g_object_unref (mstream);
- return TRUE;
- }
-
- return got_plain;
-}
diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h
index 916cc33..b5e9580 100644
--- a/camel/camel-mime-part-utils.h
+++ b/camel/camel-mime-part-utils.h
@@ -35,8 +35,6 @@ gboolean camel_mime_part_construct_content_from_parser
CamelMimeParser *mp,
GCancellable *cancellable,
GError **error);
-gboolean camel_mime_message_build_preview (CamelMimePart *mime_part,
- CamelMessageInfo *info);
G_END_DECLS
diff --git a/camel/camel-vee-message-info.c b/camel/camel-vee-message-info.c
index 6c1e87f..0d05d08 100644
--- a/camel/camel-vee-message-info.c
+++ b/camel/camel-vee-message-info.c
@@ -255,19 +255,6 @@ vee_message_info_set_subject (CamelMessageInfo *mi,
}
static const gchar *
-vee_message_info_get_preview (const CamelMessageInfo *mi)
-{
- vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_preview, (orig_mi));
-}
-
-static gboolean
-vee_message_info_set_preview (CamelMessageInfo *mi,
- const gchar *preview)
-{
- vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_preview, (orig_mi, preview));
-}
-
-static const gchar *
vee_message_info_get_from (const CamelMessageInfo *mi)
{
vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_from, (orig_mi));
@@ -434,8 +421,6 @@ camel_vee_message_info_class_init (CamelVeeMessageInfoClass *class)
mi_class->take_user_tags = vee_message_info_take_user_tags;
mi_class->get_subject = vee_message_info_get_subject;
mi_class->set_subject = vee_message_info_set_subject;
- mi_class->get_preview = vee_message_info_get_preview;
- mi_class->set_preview = vee_message_info_set_preview;
mi_class->get_from = vee_message_info_get_from;
mi_class->set_from = vee_message_info_set_from;
mi_class->get_to = vee_message_info_get_to;
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index c9b7e8b..8e200ec 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -232,11 +232,6 @@ mbox_folder_append_message_sync (CamelFolder *folder,
g_object_unref (output_stream);
g_free (fromline);
- if (camel_folder_summary_get_need_preview (folder->summary) && !camel_message_info_get_preview (mi)) {
- if (camel_mime_message_build_preview ((CamelMimePart *) message, mi) &&
camel_message_info_get_preview (mi))
- camel_folder_summary_add_preview (folder->summary, mi);
- }
-
/* now we 'fudge' the summary to tell it its uptodate, because its idea of uptodate has just changed
*/
/* the stat really shouldn't fail, we just wrote to it */
if (g_stat (lf->folder_path, &st) == 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]