[evolution/wip/gsettings] Add option "Check for new messages in all active accounts"



commit fc91bfc86e3a58d97d7819dbbbda74a33d3f1c2a
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 30 09:30:58 2010 +0100

    Add option "Check for new messages in all active accounts"
    
    As a follow-up for bug #633949

 mail/evolution-mail.schemas.in       |   17 +++++++++++++++++
 mail/mail-config.ui                  |   24 ++++++++++++++++++++++++
 mail/mail-send-recv.c                |   16 ++++++++++++++--
 modules/mail/e-mail-shell-settings.c |    4 ++++
 modules/mail/em-mailer-prefs.c       |   12 ++++++++++++
 5 files changed, 71 insertions(+), 2 deletions(-)
---
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 4493c22..d0222a8 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -1571,6 +1571,23 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/mail/send_recv_all_on_start</key>
+      <applyto>/apps/evolution/mail/send_recv_all_on_start</applyto>
+      <owner>evolution-mail</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Check for new messages in all active accounts</short>
+        <long>
+          Whether check for new messages in all active accounts regardless
+	  of the account "Check for new messages every X minutes" option
+	  when Evolution is started. This option is used only together
+	  with 'send_recv_on_start' option.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/mail/send_recv_height</key>
       <applyto>/apps/evolution/mail/send_recv_height</applyto>
       <owner>evolution-mail</owner>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 8677b95..bfa365e 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -2468,6 +2468,30 @@ For example: "Work" or "Personal"</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkHBox" id="start-up-hbox2">
+                        <property name="visible">True</property>
+                        <property name="spacing">4</property>
+                        <child>
+                          <object class="GtkCheckButton" id="chkCheckMailInAllOnStart">
+                            <property name="label" translatable="yes">Check for new messa_ges in all active accounts</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index deb38eb..fa0b9d2 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -1195,20 +1195,32 @@ auto_online (EShell *shell)
 	EIterator *iter;
 	EAccountList *accounts;
 	struct _auto_data *info;
+	gboolean can_update_all;
 
 	if (!e_shell_get_online (shell))
 		return;
 
+	can_update_all = e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-check-on-start")
+			&& e_shell_settings_get_boolean (e_shell_get_shell_settings (shell), "mail-check-all-on-start");
+
 	accounts = e_get_account_list ();
 	for (iter = e_list_get_iterator ((EList *)accounts);
 	     e_iterator_is_valid (iter);
 	     e_iterator_next (iter)) {
+		EAccount *account = (EAccount *) e_iterator_get (iter);
+
+		if (!account || !account->enabled)
+			continue;
+
 		info = g_object_get_data (
-			G_OBJECT (e_iterator_get (iter)),
+			G_OBJECT (account),
 			"mail-autoreceive");
-		if (info && info->timeout_id)
+		if (info && (info->timeout_id || can_update_all))
 			auto_timeout (info);
 	}
+
+	if (iter)
+		g_object_unref (iter);
 }
 
 /* call to setup initial, and after changes are made to the config */
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index d6e9aab..1b70289 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -113,6 +113,10 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
 		"/apps/evolution/mail/send_recv_on_start");
 
 	e_shell_settings_install_property_for_key (
+		"mail-check-all-on-start",
+		"/apps/evolution/mail/send_recv_all_on_start");
+
+	e_shell_settings_install_property_for_key (
 		"mail-citation-color",
 		"/apps/evolution/mail/display/citation_colour");
 
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 1913f8e..267195b 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -839,6 +839,18 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
 		G_BINDING_BIDIRECTIONAL |
 		G_BINDING_SYNC_CREATE);
 
+	widget = e_builder_get_widget (prefs->builder, "chkCheckMailInAllOnStart");
+	g_object_bind_property (
+		shell_settings, "mail-check-all-on-start",
+		widget, "active",
+		G_BINDING_BIDIRECTIONAL |
+		G_BINDING_SYNC_CREATE);
+	g_object_bind_property (
+		shell_settings, "mail-check-on-start",
+		widget, "sensitive",
+		G_BINDING_BIDIRECTIONAL |
+		G_BINDING_SYNC_CREATE);
+
 	/* Message Display */
 
 	widget = e_builder_get_widget (prefs->builder, "view-check");



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