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



commit 4e784bb0c12ed6317ac3133be33cd46407273902
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 12 22:26:10 2016 +0100

    Bug 773419 - Age limit for offline message download

 src/camel/camel-ews-provider.c                     |    3 +-
 src/configuration/CMakeLists.txt                   |    2 +
 .../e-mail-config-ews-offline-options.c            |  124 ++++++++++++++++++++
 .../e-mail-config-ews-offline-options.h            |   28 +++++
 src/configuration/module-ews-configuration.c       |    2 +
 5 files changed, 158 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/camel-ews-provider.c b/src/camel/camel-ews-provider.c
index ed445f2..3b47b89 100644
--- a/src/camel/camel-ews-provider.c
+++ b/src/camel/camel-ews-provider.c
@@ -57,7 +57,8 @@ static CamelProviderConfEntry ews_conf_entries[] = {
        { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk-inbox", "filter-junk",
          N_("Only check for Junk messages in the IN_BOX folder"), "0" },
        { CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
-         N_("Automatically synchroni_ze remote mail locally"), "0" },
+         N_("Synchroni_ze remote mail locally in all folders"), "0" },
+       { CAMEL_PROVIDER_CONF_PLACEHOLDER, "ews-limit-by-age-placeholder", NULL },
        { CAMEL_PROVIDER_CONF_SECTION_END },
 
        { CAMEL_PROVIDER_CONF_SECTION_START, "connection", NULL, N_("Connection") },
diff --git a/src/configuration/CMakeLists.txt b/src/configuration/CMakeLists.txt
index 0361877..ad684df 100644
--- a/src/configuration/CMakeLists.txt
+++ b/src/configuration/CMakeLists.txt
@@ -23,6 +23,8 @@ set(sources
        e-mail-config-ews-delegates-page.h
        e-mail-config-ews-folder-sizes-page.c
        e-mail-config-ews-folder-sizes-page.h
+       e-mail-config-ews-offline-options.c
+       e-mail-config-ews-offline-options.h
        e-mail-config-ews-ooo-page.c
        e-mail-config-ews-ooo-page.h
        e-ews-config-ui-extension.c
diff --git a/src/configuration/e-mail-config-ews-offline-options.c 
b/src/configuration/e-mail-config-ews-offline-options.c
new file mode 100644
index 0000000..fa67d69
--- /dev/null
+++ b/src/configuration/e-mail-config-ews-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-ews-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-ews-offline-options.h"
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS \
+       (e_mail_config_ews_offline_options_get_type ())
+#define E_MAIL_CONFIG_EWS_OFFLINE_OPTIONS(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS, EMailConfigEwsOfflineOptions))
+#define E_MAIL_CONFIG_EWS_OFFLINE_OPTIONS_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS, EMailConfigEwsOfflineOptionsClass))
+#define E_IS_MAIL_CONFIG_EWS_OFFLINE_OPTIONS(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS))
+#define E_IS_MAIL_CONFIG_EWS_OFFLINE_OPTIONS_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS))
+#define E_MAIL_CONFIG_EWS_OFFLINE_OPTIONS_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_MAIL_CONFIG_EWS_OFFLINE_OPTIONS, EMailConfigEwsOfflineOptionsClass))
+
+typedef struct _EMailConfigEwsOfflineOptions EMailConfigEwsOfflineOptions;
+typedef struct _EMailConfigEwsOfflineOptionsClass EMailConfigEwsOfflineOptionsClass;
+
+struct _EMailConfigEwsOfflineOptions {
+       EExtension parent;
+};
+
+struct _EMailConfigEwsOfflineOptionsClass {
+       EExtensionClass parent_class;
+};
+
+GType          e_mail_config_ews_offline_options_get_type
+                                               (void) G_GNUC_CONST;
+
+G_DEFINE_DYNAMIC_TYPE (EMailConfigEwsOfflineOptions, e_mail_config_ews_offline_options, E_TYPE_EXTENSION)
+
+static void
+mail_config_ews_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_ews_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, "ews") != 0)
+               return;
+
+       g_return_if_fail (CAMEL_IS_OFFLINE_SETTINGS (settings));
+
+       placeholder = e_mail_config_provider_page_get_placeholder (provider_page, 
"ews-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_ews_offline_options_class_init (EMailConfigEwsOfflineOptionsClass *class)
+{
+       GObjectClass *object_class;
+       EExtensionClass *extension_class;
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->constructed = mail_config_ews_offline_options_constructed;
+
+       extension_class = E_EXTENSION_CLASS (class);
+       extension_class->extensible_type = E_TYPE_MAIL_CONFIG_PROVIDER_PAGE;
+}
+
+static void
+e_mail_config_ews_offline_options_class_finalize (EMailConfigEwsOfflineOptionsClass *class)
+{
+}
+
+static void
+e_mail_config_ews_offline_options_init (EMailConfigEwsOfflineOptions *extension)
+{
+}
+
+void
+e_mail_config_ews_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_ews_offline_options_register_type (type_module);
+}
diff --git a/src/configuration/e-mail-config-ews-offline-options.h 
b/src/configuration/e-mail-config-ews-offline-options.h
new file mode 100644
index 0000000..8a50f42
--- /dev/null
+++ b/src/configuration/e-mail-config-ews-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_EWS_OFFLINE_OPTIONS_H
+#define E_MAIL_CONFIG_EWS_OFFLINE_OPTIONS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_ews_offline_options_type_register (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_EWS_OFFLINE_OPTIONS_H */
diff --git a/src/configuration/module-ews-configuration.c b/src/configuration/module-ews-configuration.c
index 0fd659d..0267e6f 100644
--- a/src/configuration/module-ews-configuration.c
+++ b/src/configuration/module-ews-configuration.c
@@ -28,6 +28,7 @@
 #include "e-mail-config-ews-notebook.h"
 #include "e-mail-config-ews-oal-combo-box.h"
 #include "e-mail-config-ews-delegates-page.h"
+#include "e-mail-config-ews-offline-options.h"
 #include "e-mail-config-ews-ooo-page.h"
 #include "e-mail-config-ews-folder-sizes-page.h"
 #include "e-ews-ooo-notificator.h"
@@ -49,6 +50,7 @@ e_module_load (GTypeModule *type_module)
        e_book_config_ews_type_register (type_module);
        e_mail_config_ews_autodiscover_type_register (type_module);
        e_mail_config_ews_backend_type_register (type_module);
+       e_mail_config_ews_offline_options_type_register (type_module);
        e_mail_config_ews_gal_type_register (type_module);
        e_mail_config_ews_notebook_type_register (type_module);
        e_mail_config_ews_oal_combo_box_type_register (type_module);


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