[evolution-data-server/imap-pop-mobile: 5/12] Add mobile mode settings to POP3.



commit 0fc196b156d208c8c994e7b353f3b34e2bbd0dc8
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Thu Jan 12 14:31:22 2012 +0530

    Add mobile mode settings to POP3.

 camel/providers/pop3/camel-pop3-provider.c |    3 +-
 camel/providers/pop3/camel-pop3-settings.c |  133 +++++++++++++++++++++++++++-
 camel/providers/pop3/camel-pop3-settings.h |   10 ++
 3 files changed, 142 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-provider.c b/camel/providers/pop3/camel-pop3-provider.c
index 0a7973e..d72a14b 100644
--- a/camel/providers/pop3/camel-pop3-provider.c
+++ b/camel/providers/pop3/camel-pop3-provider.c
@@ -66,7 +66,8 @@ static CamelProvider pop3_provider = {
 	"mail",
 
 	CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
-	CAMEL_PROVIDER_SUPPORTS_SSL,
+	CAMEL_PROVIDER_SUPPORTS_SSL | 
+	CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES,
 
 	CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
 
diff --git a/camel/providers/pop3/camel-pop3-settings.c b/camel/providers/pop3/camel-pop3-settings.c
index e7bcf05..131428c 100644
--- a/camel/providers/pop3/camel-pop3-settings.c
+++ b/camel/providers/pop3/camel-pop3-settings.c
@@ -28,6 +28,8 @@ struct _CamelPOP3SettingsPrivate {
 	gboolean disable_extensions;
 	gboolean keep_on_server;
 	gboolean auto_fetch;
+	gboolean mobile_mode;
+	gint batch_fetch_count;
 };
 
 enum {
@@ -41,7 +43,9 @@ enum {
 	PROP_PORT,
 	PROP_SECURITY_METHOD,
 	PROP_USER,
-	PROP_AUTO_FETCH	
+	PROP_AUTO_FETCH,
+	PROP_USE_MOBILE_MODE,
+	PROP_BATCH_FETCH_COUNT
 };
 
 G_DEFINE_TYPE_WITH_CODE (
@@ -115,6 +119,16 @@ pop3_settings_set_property (GObject *object,
 				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),
+				g_value_get_int (value));
+			return;			
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -194,6 +208,18 @@ pop3_settings_get_property (GObject *object,
 				value,
 				camel_pop3_settings_get_auto_fetch (
 				CAMEL_POP3_SETTINGS (object)));
+		case PROP_USE_MOBILE_MODE:
+			g_value_set_boolean (
+				value,
+				camel_pop3_settings_get_mobile_mode (
+				CAMEL_POP3_SETTINGS (object)));
+		case PROP_BATCH_FETCH_COUNT:
+			g_value_set_int (
+				value,
+				camel_pop3_settings_get_batch_fetch_count (
+				CAMEL_POP3_SETTINGS (object)));
+			return;
+
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -276,7 +302,7 @@ camel_pop3_settings_class_init (CamelPOP3SettingsClass *class)
 
 	g_object_class_install_property (
 		object_class,
-		PROP_KEEP_ON_SERVER,
+		PROP_AUTO_FETCH,
 		g_param_spec_boolean (
 			"auto-fetch",
 			"Auto Fetch mails",
@@ -286,6 +312,32 @@ camel_pop3_settings_class_init (CamelPOP3SettingsClass *class)
 			G_PARAM_CONSTRUCT |
 			G_PARAM_STATIC_STRINGS));
 
+	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",
+			"Batch fetch count",
+			"Number of messages to download in a batch.",
+			0,
+			G_MAXINT,
+			-1,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT |
+			G_PARAM_STATIC_STRINGS));
+
 	/* Inherited from CamelNetworkSettings. */
 	g_object_class_override_property (
 		object_class,
@@ -520,7 +572,82 @@ camel_pop3_settings_set_auto_fetch (CamelPOP3Settings *settings,
 
 	settings->priv->auto_fetch = auto_fetch;
 
-	g_object_notify (G_OBJECT (settings), "auto_fetch");
+	g_object_notify (G_OBJECT (settings), "auto-fetch");
+}
+
+/**
+ * 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));
+
+	settings->priv->mobile_mode = mobile_mode;
+
+	g_object_notify (G_OBJECT (settings), "mobile-mode");
+}
+
+/**
+ * camel_pop3_settings_get_batch_fetch_count:
+ * @settings: a #CamelPOP3Settings
+ *
+ * Returns the batch fetch count while fetching mails.
+ *
+ * Returns: the batch fetch count.
+ *
+ * Since: 3.4
+ **/
+gint
+camel_pop3_settings_get_batch_fetch_count (CamelPOP3Settings *settings)
+{
+	g_return_val_if_fail (CAMEL_IS_POP3_SETTINGS (settings), FALSE);
+
+	return settings->priv->batch_fetch_count;
 }
 
+/**
+ * camel_pop3_settings_set_batch_fetch_count:
+ * @settings: a #CamelPOP3Settings
+ * @batch_fetch_count: number of mails to download in a batch.
+ *
+ * Sets the number of mails to download in a batch.
+ *
+ * Since: 3.4
+ **/
+void
+camel_pop3_settings_set_batch_fetch_count (CamelPOP3Settings *settings,
+                                           gboolean batch_fetch_count)
+{
+	g_return_if_fail (CAMEL_IS_POP3_SETTINGS (settings));
+
+	settings->priv->batch_fetch_count = batch_fetch_count;
+
+	g_object_notify (G_OBJECT (settings), "batch-fetch-count");
+}
 
diff --git a/camel/providers/pop3/camel-pop3-settings.h b/camel/providers/pop3/camel-pop3-settings.h
index c531ad4..bd2a9e6 100644
--- a/camel/providers/pop3/camel-pop3-settings.h
+++ b/camel/providers/pop3/camel-pop3-settings.h
@@ -81,6 +81,16 @@ 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
+						(CamelPOP3Settings *settings,
+						 int batch_fetch_count);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]