[evolution/evolution-3-12] Bug 728329 - Evolution fails to get back online
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/evolution-3-12] Bug 728329 - Evolution fails to get back online
- Date: Mon, 15 Sep 2014 11:10:15 +0000 (UTC)
commit 4cef0ede10932310ecfa0a31afbda9ac03bd761b
Author: Jonas Hahnfeld <hahnjo hahnjo de>
Date: Mon Sep 15 13:06:55 2014 +0200
Bug 728329 - Evolution fails to get back online
shell/e-shell.c | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/shell/e-shell.c b/shell/e-shell.c
index dc2d993..be8de74 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -46,6 +46,8 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL, EShellPrivate))
+#define SET_ONLINE_TIMEOUT_SECONDS 5
+
struct _EShellPrivate {
GQueue alerts;
ESourceRegistry *registry;
@@ -64,6 +66,7 @@ struct _EShellPrivate {
gchar *module_directory;
guint inhibit_cookie;
+ guint set_online_timeout_id;
gulong backend_died_handler_id;
@@ -263,6 +266,20 @@ shell_add_actions (GApplication *application)
g_object_unref (action);
}
+static gboolean
+e_shell_set_online_cb (gpointer user_data)
+{
+ EShell *shell = user_data;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ shell->priv->set_online_timeout_id = 0;
+
+ e_shell_set_online (shell, TRUE);
+
+ return FALSE;
+}
+
static void
shell_ready_for_offline (EShell *shell,
EActivity *activity,
@@ -662,6 +679,11 @@ shell_dispose (GObject *object)
priv = E_SHELL_GET_PRIVATE (object);
+ if (priv->set_online_timeout_id > 0) {
+ g_source_remove (priv->set_online_timeout_id);
+ priv->set_online_timeout_id = 0;
+ }
+
while ((alert = g_queue_pop_head (&priv->alerts)) != NULL) {
g_signal_handlers_disconnect_by_func (
alert, shell_alert_response_cb, object);
@@ -1666,7 +1688,18 @@ e_shell_set_network_available (EShell *shell,
shell->priv->auto_reconnect = TRUE;
} else if (network_available && shell->priv->auto_reconnect) {
g_message ("Connection established. Going online.");
- e_shell_set_online (shell, TRUE);
+
+ /* Wait some seconds to give the network enough time to become
+ * fully available. */
+ if (shell->priv->set_online_timeout_id > 0) {
+ g_source_remove (shell->priv->set_online_timeout_id);
+ shell->priv->set_online_timeout_id = 0;
+ }
+
+ shell->priv->set_online_timeout_id = e_named_timeout_add_seconds_full (
+ G_PRIORITY_DEFAULT, SET_ONLINE_TIMEOUT_SECONDS, e_shell_set_online_cb,
+ g_object_ref (shell), g_object_unref);
+
shell->priv->auto_reconnect = FALSE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]