aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-account-store.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-04-11 19:53:22 +0800
committerMilan Crha <mcrha@redhat.com>2013-04-11 19:53:22 +0800
commit765a50d3df2d53b73b149fc2646f46722add7635 (patch)
tree8e540bebd24d80af919c04825ed7247ae0866e46 /mail/e-mail-account-store.c
parent5a389fa7bd73671410ce4a47c225d580ad87bd2a (diff)
downloadgsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar.gz
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar.bz2
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar.lz
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar.xz
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.tar.zst
gsoc2013-evolution-765a50d3df2d53b73b149fc2646f46722add7635.zip
Bug #697710 - Going offline doesn't disconnect remote stores
Diffstat (limited to 'mail/e-mail-account-store.c')
-rw-r--r--mail/e-mail-account-store.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index e79943c32e..7b4605b64d 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -185,15 +185,51 @@ mail_account_store_update_row (EMailAccountStore *store,
-1);
}
+struct ServiceNotifyCbData
+{
+ EMailAccountStore *store;
+ CamelService *service;
+};
+
+static void
+service_notify_cb_data_free (gpointer ptr)
+{
+ struct ServiceNotifyCbData *data = ptr;
+
+ g_clear_object (&data->store);
+ g_clear_object (&data->service);
+ g_slice_free (struct ServiceNotifyCbData, data);
+}
+
+static gboolean
+mail_account_store_service_notify_idle_cb (gpointer user_data)
+{
+ struct ServiceNotifyCbData *data = user_data;
+ GtkTreeIter iter;
+
+ g_return_val_if_fail (data != NULL, FALSE);
+
+ if (mail_account_store_get_iter (data->store, data->service, &iter))
+ mail_account_store_update_row (data->store, data->service, &iter);
+
+ return FALSE;
+}
+
static void
mail_account_store_service_notify_cb (CamelService *service,
GParamSpec *pspec,
EMailAccountStore *store)
{
- GtkTreeIter iter;
+ struct ServiceNotifyCbData *data;
- if (mail_account_store_get_iter (store, service, &iter))
- mail_account_store_update_row (store, service, &iter);
+ data = g_slice_new0 (struct ServiceNotifyCbData);
+ data->store = g_object_ref (store);
+ data->service = g_object_ref (service);
+
+ g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+ mail_account_store_service_notify_idle_cb,
+ data,
+ service_notify_cb_data_free);
}
static void