[evolution-mapi] Bug 773419 - Age limit for offline message download



commit 325ac6e88a83eed7d20609d63fa28d74f44dec6a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 12 22:27:19 2016 +0100

    Bug 773419 - Age limit for offline message download

 src/camel/camel-mapi-provider.c                    |    7 +-
 src/configuration/CMakeLists.txt                   |    2 +
 .../e-mail-config-mapi-offline-options.c           |  124 ++++++++++++++++++++
 .../e-mail-config-mapi-offline-options.h           |   28 +++++
 src/configuration/module-mapi-configuration.c      |    2 +
 5 files changed, 160 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/camel-mapi-provider.c b/src/camel/camel-mapi-provider.c
index ca752aa..4f77191 100644
--- a/src/camel/camel-mapi-provider.c
+++ b/src/camel/camel-mapi-provider.c
@@ -47,8 +47,6 @@ static CamelProviderConfEntry mapi_conf_entries[] = {
 
        { CAMEL_PROVIDER_CONF_SECTION_START, "generals", NULL,
          N_("Options") },
-       { CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
-         N_("Automatically synchroni_ze account locally"), "0" },
        { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", NULL,
          /* i18n: copy from evolution:camel-imap-provider.c */
          N_("_Apply filters to new messages in Inbox on this server"), "0" },
@@ -58,8 +56,11 @@ static CamelProviderConfEntry mapi_conf_entries[] = {
          N_("Only check for Junk messag_es in the Inbox folder"), "0" },
        { CAMEL_PROVIDER_CONF_CHECKBOX, "listen-notifications", NULL,
          N_("Lis_ten for server notifications"), "0" },
-
+       { CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
+         N_("Synchroni_ze remote mail locally in all folders"), "0" },
+       { CAMEL_PROVIDER_CONF_PLACEHOLDER, "mapi-limit-by-age-placeholder", NULL },
        { CAMEL_PROVIDER_CONF_SECTION_END },
+
        { CAMEL_PROVIDER_CONF_END }
 };
 
diff --git a/src/configuration/CMakeLists.txt b/src/configuration/CMakeLists.txt
index 72e6044..1b93b52 100644
--- a/src/configuration/CMakeLists.txt
+++ b/src/configuration/CMakeLists.txt
@@ -15,6 +15,8 @@ set(sources
        e-mail-config-mapi-page.h
        e-mail-config-mapi-extension.c
        e-mail-config-mapi-extension.h
+       e-mail-config-mapi-offline-options.c
+       e-mail-config-mapi-offline-options.h
        e-mapi-config-ui-extension.c
        e-mapi-config-ui-extension.h
        e-mapi-config-utils.c
diff --git a/src/configuration/e-mail-config-mapi-offline-options.c 
b/src/configuration/e-mail-config-mapi-offline-options.c
new file mode 100644
index 0000000..b5290e1
--- /dev/null
+++ b/src/configuration/e-mail-config-mapi-offline-options.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "evolution-mapi-config.h"
+
+#include <libebackend/libebackend.h>
+#include <libedataserver/libedataserver.h>
+
+#include <e-util/e-util.h>
+#include <mail/e-mail-config-provider-page.h>
+
+#include "e-mail-config-mapi-offline-options.h"
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS \
+       (e_mail_config_mapi_offline_options_get_type ())
+#define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptions))
+#define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptionsClass))
+#define E_IS_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS))
+#define E_IS_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS))
+#define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptionsClass))
+
+typedef struct _EMailConfigMapiOfflineOptions EMailConfigMapiOfflineOptions;
+typedef struct _EMailConfigMapiOfflineOptionsClass EMailConfigMapiOfflineOptionsClass;
+
+struct _EMailConfigMapiOfflineOptions {
+       EExtension parent;
+};
+
+struct _EMailConfigMapiOfflineOptionsClass {
+       EExtensionClass parent_class;
+};
+
+GType          e_mail_config_mapi_offline_options_get_type
+                                               (void) G_GNUC_CONST;
+
+G_DEFINE_DYNAMIC_TYPE (EMailConfigMapiOfflineOptions, e_mail_config_mapi_offline_options, E_TYPE_EXTENSION)
+
+static void
+mail_config_mapi_offline_options_constructed (GObject *object)
+{
+       EMailConfigProviderPage *provider_page;
+       EMailConfigServiceBackend *backend;
+       CamelProvider *provider;
+       CamelSettings *settings;
+       GtkBox *placeholder;
+       GtkWidget *hbox;
+
+       /* Chain up to parent's constructed() method. */
+       G_OBJECT_CLASS (e_mail_config_mapi_offline_options_parent_class)->constructed (object);
+
+       provider_page = E_MAIL_CONFIG_PROVIDER_PAGE (e_extension_get_extensible (E_EXTENSION (object)));
+       backend = e_mail_config_provider_page_get_backend (provider_page);
+       provider = e_mail_config_service_backend_get_provider (backend);
+       settings = e_mail_config_service_backend_get_settings (backend);
+
+       if (e_mail_config_provider_page_is_empty (provider_page) ||
+           !provider || g_strcmp0 (provider->protocol, "mapi") != 0)
+               return;
+
+       g_return_if_fail (CAMEL_IS_OFFLINE_SETTINGS (settings));
+
+       placeholder = e_mail_config_provider_page_get_placeholder (provider_page, 
"mapi-limit-by-age-placeholder");
+       g_return_if_fail (placeholder != NULL);
+
+       hbox = e_dialog_offline_settings_new_limit_box (CAMEL_OFFLINE_SETTINGS (settings));
+       gtk_box_pack_start (placeholder, hbox, FALSE, FALSE, 0);
+       gtk_widget_show (hbox);
+}
+
+static void
+e_mail_config_mapi_offline_options_class_init (EMailConfigMapiOfflineOptionsClass *class)
+{
+       GObjectClass *object_class;
+       EExtensionClass *extension_class;
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->constructed = mail_config_mapi_offline_options_constructed;
+
+       extension_class = E_EXTENSION_CLASS (class);
+       extension_class->extensible_type = E_TYPE_MAIL_CONFIG_PROVIDER_PAGE;
+}
+
+static void
+e_mail_config_mapi_offline_options_class_finalize (EMailConfigMapiOfflineOptionsClass *class)
+{
+}
+
+static void
+e_mail_config_mapi_offline_options_init (EMailConfigMapiOfflineOptions *extension)
+{
+}
+
+void
+e_mail_config_mapi_offline_options_type_register (GTypeModule *type_module)
+{
+       /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+        *     function, so we have to wrap it with a public function in
+        *     order to register types from a separate compilation unit. */
+       e_mail_config_mapi_offline_options_register_type (type_module);
+}
diff --git a/src/configuration/e-mail-config-mapi-offline-options.h 
b/src/configuration/e-mail-config-mapi-offline-options.h
new file mode 100644
index 0000000..8e86898
--- /dev/null
+++ b/src/configuration/e-mail-config-mapi-offline-options.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_H
+#define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_mapi_offline_options_type_register (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_H */
diff --git a/src/configuration/module-mapi-configuration.c b/src/configuration/module-mapi-configuration.c
index 20136e4..35ef59f 100644
--- a/src/configuration/module-mapi-configuration.c
+++ b/src/configuration/module-mapi-configuration.c
@@ -26,6 +26,7 @@
 #include "e-mail-config-mapi-backend.h"
 #include "e-mail-config-mapi-page.h"
 #include "e-mail-config-mapi-extension.h"
+#include "e-mail-config-mapi-offline-options.h"
 #include "e-mapi-config-ui-extension.h"
 #include "e-source-mapi-folder.h"
 
@@ -47,6 +48,7 @@ e_module_load (GTypeModule *type_module)
        e_mail_config_mapi_backend_type_register (type_module);
        e_mail_config_mapi_page_type_register (type_module);
        e_mail_config_mapi_extension_type_register (type_module);
+       e_mail_config_mapi_offline_options_type_register (type_module);
        e_mapi_config_ui_extension_type_register (type_module);
 }
 


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