[evolution-data-server] CamelPOP3Settings: Remove unused "mobile-mode" property.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelPOP3Settings: Remove unused "mobile-mode" property.
- Date: Fri, 29 Nov 2013 20:16:29 +0000 (UTC)
commit d386edc5eb179b1c39becb45d674e8e270c165cf
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Nov 28 12:05:19 2013 -0500
CamelPOP3Settings: Remove unused "mobile-mode" property.
Not used by Evolution and not clear what this mode even means.
Removing it makes a bunch of confusing complexity drop out, which is
justification enough for me.
camel/providers/pop3/camel-pop3-folder.c | 183 ----------------------------
camel/providers/pop3/camel-pop3-folder.h | 1 -
camel/providers/pop3/camel-pop3-settings.c | 70 +----------
camel/providers/pop3/camel-pop3-settings.h | 5 -
docs/reference/camel/camel-sections.txt | 2 -
5 files changed, 4 insertions(+), 257 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 5c305cd..4aec0e6 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -53,33 +53,6 @@ struct _CamelPOP3FolderInfo {
G_DEFINE_TYPE (CamelPOP3Folder, camel_pop3_folder, CAMEL_TYPE_FOLDER)
static void
-free_fi (CamelPOP3Folder *pop3_folder,
- CamelPOP3FolderInfo *fi)
-{
-
- CamelPOP3Store *pop3_store;
- CamelStore *store;
-
- store = camel_folder_get_parent_store (CAMEL_FOLDER (pop3_folder));
- pop3_store = CAMEL_POP3_STORE (store);
-
- g_hash_table_remove (pop3_folder->uids_id, GINT_TO_POINTER (fi->id));
- if (fi->cmd != NULL) {
- CamelPOP3Engine *pop3_engine;
-
- pop3_engine = camel_pop3_store_ref_engine (pop3_store);
-
- camel_pop3_engine_command_free (pop3_engine, fi->cmd);
- fi->cmd = NULL;
-
- g_object_unref (pop3_engine);
- }
- g_free (fi->uid);
- g_free (fi);
-
-}
-
-static void
cmd_uidl (CamelPOP3Engine *pe,
CamelPOP3Stream *stream,
GCancellable *cancellable,
@@ -174,26 +147,12 @@ cmd_list (CamelPOP3Engine *pe,
guint len, id, size;
guchar *line;
CamelFolder *folder = data;
- CamelStore *parent_store;
CamelPOP3FolderInfo *fi;
- gint i = 0, total, last_uid=-1;
CamelPOP3Folder *pop3_folder;
- CamelService *service;
- CamelSettings *settings;
- gint batch_fetch_count;
g_return_if_fail (pe != NULL);
- parent_store = camel_folder_get_parent_store (folder);
pop3_folder = (CamelPOP3Folder *) folder;
- service = (CamelService *) parent_store;
-
- settings = camel_service_ref_settings (service);
-
- batch_fetch_count = camel_pop3_settings_get_batch_fetch_count (
- CAMEL_POP3_SETTINGS (settings));
-
- g_object_unref (settings);
do {
ret = camel_pop3_stream_line (stream, &line, &len, cancellable, error);
@@ -217,125 +176,6 @@ cmd_list (CamelPOP3Engine *pe,
}
}
} while (ret > 0);
-
- /* Trim the list for mobile devices*/
- if (pop3_folder->mobile_mode && pop3_folder->uids->len) {
- gint y = 0;
- gboolean save_uid = FALSE;
-
- /* Preserve the first message's ID */
- fi = pop3_folder->uids->pdata[0];
- pop3_folder->first_id = fi->id;
-
- total = pop3_folder->uids->len;
- if (pop3_folder->key_file) {
- last_uid = g_key_file_get_integer (pop3_folder->key_file, "UIDConfig",
"last-saved-uid", NULL);
- if (!last_uid) {
- /* First time downloading the POP folder, lets just download only a batch. */
- last_uid = -1;
- }
- d (printf ("Last stored' first uid: %d\n", last_uid));
- }
-
- if (last_uid == -1)
- save_uid = TRUE;
-
- for (i = total - 1; i >= 0; i--) {
- fi = pop3_folder->uids->pdata[i];
-
- if ((last_uid != -1 && last_uid >= fi->id) || (last_uid == -1 && i == total -
batch_fetch_count)) {
- if (last_uid != -1 && last_uid < fi->id)
- i++; /* if the last uid was deleted on the server, then we need the
last but 1 */
- break;
- }
-
- }
- if (i> 0 && pop3_folder->fetch_type == CAMEL_FETCH_OLD_MESSAGES && pop3_folder->fetch_more) {
- gint k = 0;
- /* Lets pull another window of old messages */
- save_uid = TRUE;
- /* Decrement 'i' by another batch count or till we reach the first message */
- d (printf ("Fetch more (%d): from %d", pop3_folder->fetch_more, i));
- for (k = 0; k< pop3_folder->fetch_more && i>= 0; k++, i--);
- d (printf (" to %d\n", i));
-
- /* Don't load messages newer than the latest we already had. We had to just get old
messages and not
- * new messages. */
- for (y = i; y < total; y++) {
- fi = pop3_folder->uids->pdata[y];
- if (fi->id == pop3_folder->latest_id) {
- /* Delete everything after this. */
-
- for (y = k + 1; y < total; y++) {
- fi = pop3_folder->uids->pdata[y];
- free_fi (pop3_folder, fi);
- }
- g_ptr_array_remove_range (pop3_folder->uids, k + 1, total - k - 1);
- break;
- }
- }
-
- } else if (pop3_folder->fetch_more == CAMEL_FETCH_NEW_MESSAGES && pop3_folder->fetch_more) {
- /* We need to download new messages. */
- gint k = 0;
-
- for (k = i; k < total; k++) {
- fi = pop3_folder->uids->pdata[k];
- if (fi->id == pop3_folder->latest_id) {
- /* We need to just download the specified number of messages. */
- y= (k + pop3_folder->fetch_more) < total ? (k +
pop3_folder->fetch_more) : total - 1;
- break;
- }
- }
-
- }
-
- /* Delete the unnecessary old messages */
- if (i > 0) {
- gint j = 0;
- /* i is the start of the last fetch UID, so remove everything else from 0 to i */
- for (; j < i; j++) {
- fi = pop3_folder->uids->pdata[j];
- free_fi (pop3_folder, fi);
- }
- g_ptr_array_remove_range (pop3_folder->uids, 0, i);
- d (printf ("Removing %d uids that are old\n", i));
-
- }
-
- /* Delete the unnecessary new message references. */
- if (y + 1 < total) {
- gint k;
-
- for (k = y + 1; k < total; k++) {
- fi = pop3_folder->uids->pdata[k];
- free_fi (pop3_folder, fi);
- }
- g_ptr_array_remove_range (pop3_folder->uids, y + 1, total - y - 1);
- }
-
- if (save_uid) {
- gchar *contents;
- gsize len;
- const gchar *root;
- gchar *path;
-
- /* Save the last fetched UID */
- fi = pop3_folder->uids->pdata[0];
- g_key_file_set_integer (pop3_folder->key_file, "UIDConfig", "last-saved-uid", fi->id);
- contents = g_key_file_to_data (pop3_folder->key_file, &len, NULL);
- root = camel_service_get_user_cache_dir (service);
- path = g_build_filename (root, "uidconfig", NULL);
- g_file_set_contents (path, contents, len, NULL);
- g_key_file_load_from_file (pop3_folder->key_file, path, G_KEY_FILE_NONE, NULL);
- g_free (contents);
- g_free (path);
- d (printf ("Saving last uid %d\n", fi->id));
-
- }
-
- }
-
}
static void
@@ -1054,12 +894,8 @@ camel_pop3_folder_new (CamelStore *parent,
GError **error)
{
CamelFolder *folder;
- CamelService *service;
- CamelSettings *settings;
CamelPOP3Folder *pop3_folder;
- service = CAMEL_SERVICE (parent);
-
d (printf ("opening pop3 INBOX folder\n"));
folder = g_object_new (
@@ -1067,28 +903,9 @@ camel_pop3_folder_new (CamelStore *parent,
"full-name", "inbox", "display-name", "inbox",
"parent-store", parent, NULL);
- settings = camel_service_ref_settings (service);
-
pop3_folder = (CamelPOP3Folder *) folder;
- pop3_folder->mobile_mode = camel_pop3_settings_get_mobile_mode (
- CAMEL_POP3_SETTINGS (settings));
-
- g_object_unref (settings);
pop3_folder->fetch_more = 0;
- if (pop3_folder->mobile_mode) {
- /* Setup Keyfile */
- gchar *path;
- const gchar *root;
-
- pop3_folder->key_file = g_key_file_new ();
- root = camel_service_get_user_cache_dir (service);
- path = g_build_filename (root, "uidconfig", NULL);
- g_key_file_load_from_file (pop3_folder->key_file, path, G_KEY_FILE_NONE, NULL);
-
- g_free (path);
- }
-
if (camel_service_get_connection_status (CAMEL_SERVICE (parent)) != CAMEL_SERVICE_CONNECTED)
return folder;
diff --git a/camel/providers/pop3/camel-pop3-folder.h b/camel/providers/pop3/camel-pop3-folder.h
index 09bc593..e76239c 100644
--- a/camel/providers/pop3/camel-pop3-folder.h
+++ b/camel/providers/pop3/camel-pop3-folder.h
@@ -65,7 +65,6 @@ struct _CamelPOP3Folder {
GHashTable *uids_id;
GKeyFile *key_file;
- gboolean mobile_mode;
gint fetch_more;
CamelFetchType fetch_type;
gint first_id;
diff --git a/camel/providers/pop3/camel-pop3-settings.c b/camel/providers/pop3/camel-pop3-settings.c
index 2fd552a..a966326 100644
--- a/camel/providers/pop3/camel-pop3-settings.c
+++ b/camel/providers/pop3/camel-pop3-settings.c
@@ -28,7 +28,6 @@ struct _CamelPOP3SettingsPrivate {
gboolean disable_extensions;
gboolean keep_on_server;
gboolean auto_fetch;
- gboolean mobile_mode;
gint batch_fetch_count;
};
@@ -44,7 +43,6 @@ enum {
PROP_SECURITY_METHOD,
PROP_USER,
PROP_AUTO_FETCH,
- PROP_USE_MOBILE_MODE,
PROP_BATCH_FETCH_COUNT
};
@@ -115,16 +113,13 @@ pop3_settings_set_property (GObject *object,
CAMEL_NETWORK_SETTINGS (object),
g_value_get_string (value));
return;
+
case PROP_AUTO_FETCH:
camel_pop3_settings_set_auto_fetch (
CAMEL_POP3_SETTINGS (object),
g_value_get_boolean (value));
return;
- case PROP_USE_MOBILE_MODE:
- camel_pop3_settings_set_mobile_mode (
- CAMEL_POP3_SETTINGS (object),
- g_value_get_boolean (value));
- return;
+
case PROP_BATCH_FETCH_COUNT:
camel_pop3_settings_set_batch_fetch_count (
CAMEL_POP3_SETTINGS (object),
@@ -204,18 +199,14 @@ pop3_settings_get_property (GObject *object,
camel_network_settings_dup_user (
CAMEL_NETWORK_SETTINGS (object)));
return;
+
case PROP_AUTO_FETCH:
g_value_set_boolean (
value,
camel_pop3_settings_get_auto_fetch (
CAMEL_POP3_SETTINGS (object)));
return;
- case PROP_USE_MOBILE_MODE:
- g_value_set_boolean (
- value,
- camel_pop3_settings_get_mobile_mode (
- CAMEL_POP3_SETTINGS (object)));
- return;
+
case PROP_BATCH_FETCH_COUNT:
g_value_set_int (
value,
@@ -317,18 +308,6 @@ camel_pop3_settings_class_init (CamelPOP3SettingsClass *class)
g_object_class_install_property (
object_class,
- PROP_USE_MOBILE_MODE,
- g_param_spec_boolean (
- "mobile-mode",
- "Enable mobile mode",
- "Optimized POP3 provider for mobile clients.",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
PROP_BATCH_FETCH_COUNT,
g_param_spec_int (
"batch-fetch-count",
@@ -594,47 +573,6 @@ camel_pop3_settings_set_auto_fetch (CamelPOP3Settings *settings,
}
/**
- * camel_pop3_settings_get_mobile_mode:
- * @settings: a #CamelPOP3Settings
- *
- * Returns whether the provider is operating in mobile mode.
- *
- * Returns: Whether the provider is operating in mobile mode.
- *
- * Since: 3.4
- **/
-gboolean
-camel_pop3_settings_get_mobile_mode (CamelPOP3Settings *settings)
-{
- g_return_val_if_fail (CAMEL_IS_POP3_SETTINGS (settings), FALSE);
-
- return settings->priv->mobile_mode;
-}
-
-/**
- * camel_pop3_settings_set_mobile_mode:
- * @settings: a #CamelPOP3Settings
- * @mobile_mode: whether the backend should operate in mobile mode.
- *
- * Sets whether the provider should operate in mobile mode.
- *
- * Since: 3.4
- **/
-void
-camel_pop3_settings_set_mobile_mode (CamelPOP3Settings *settings,
- gboolean mobile_mode)
-{
- g_return_if_fail (CAMEL_IS_POP3_SETTINGS (settings));
-
- if (settings->priv->mobile_mode == mobile_mode)
- return;
-
- settings->priv->mobile_mode = mobile_mode;
-
- g_object_notify (G_OBJECT (settings), "mobile-mode");
-}
-
-/**
* camel_pop3_settings_get_batch_fetch_count:
* @settings: a #CamelPOP3Settings
*
diff --git a/camel/providers/pop3/camel-pop3-settings.h b/camel/providers/pop3/camel-pop3-settings.h
index 30d5109..941946b 100644
--- a/camel/providers/pop3/camel-pop3-settings.h
+++ b/camel/providers/pop3/camel-pop3-settings.h
@@ -81,11 +81,6 @@ gboolean camel_pop3_settings_get_auto_fetch
void camel_pop3_settings_set_auto_fetch
(CamelPOP3Settings *settings,
gboolean auto_fetch);
-gboolean camel_pop3_settings_get_mobile_mode
- (CamelPOP3Settings *settings);
-void camel_pop3_settings_set_mobile_mode
- (CamelPOP3Settings *settings,
- gboolean mobile_mode);
gboolean camel_pop3_settings_get_batch_fetch_count
(CamelPOP3Settings *settings);
void camel_pop3_settings_set_batch_fetch_count
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 9480f0b..2fe0f8c 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -3957,8 +3957,6 @@ camel_pop3_settings_get_keep_on_server
camel_pop3_settings_set_keep_on_server
camel_pop3_settings_get_auto_fetch
camel_pop3_settings_set_auto_fetch
-camel_pop3_settings_get_mobile_mode
-camel_pop3_settings_set_mobile_mode
camel_pop3_settings_get_batch_fetch_count
camel_pop3_settings_set_batch_fetch_count
<SUBSECTION Standard>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]