aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/alarm-notify.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-05-21 01:00:33 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-05-21 01:00:33 +0800
commitde5b0738fd523214973cbc12287a599164baad5c (patch)
tree607359a531abd33569cbbfb29ff829cc14903319 /calendar/gui/alarm-notify/alarm-notify.c
parent3b787a2d62b885c248ca92d770e22051d2694091 (diff)
downloadgsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar.gz
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar.bz2
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar.lz
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar.xz
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.tar.zst
gsoc2013-evolution-de5b0738fd523214973cbc12287a599164baad5c.zip
ported changes from evolution-1-0 to make it work with reminders on remote
2002-05-20 Rodrigo Moya <rodrigo@ximian.com> * gui/alarm-notify/alarm-notify.c: * gui/alarm-notify/notify-main.c: ported changes from evolution-1-0 to make it work with reminders on remote backends. svn path=/trunk/; revision=16944
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-notify.c')
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 7dbb77ceeb..2f7889b4db 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -349,6 +349,52 @@ alarm_notify_new (void)
return an;
}
+typedef struct {
+ CalClient *client;
+ char *str_uri;
+} RetryData;
+
+static gboolean
+retry_timeout_cb (gpointer data)
+{
+ RetryData *retry_data = data;
+
+ if (cal_client_get_load_state (retry_data->client) != CAL_CLIENT_LOAD_LOADED) {
+ cal_client_open_calendar (retry_data->client, retry_data->str_uri, FALSE);
+ }
+
+ g_free (retry_data->str_uri);
+ g_free (retry_data);
+
+ return FALSE;
+}
+
+static void
+cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+{
+ EUri *uri = (EUri *) data;
+
+ if (status == CAL_CLIENT_OPEN_SUCCESS) {
+ add_uri_to_load (uri);
+ alarm_queue_add_client (client);
+
+ e_uri_free (uri);
+ }
+ else {
+ RetryData *retry_data;
+
+ remove_uri_to_load (uri);
+
+ /* retry opening this calendar */
+ retry_data = g_new0 (RetryData, 1);
+ retry_data->client = client;
+ retry_data->str_uri = e_uri_to_string (uri, FALSE);
+
+ /* we set a timeout of 5 mins before retrying */
+ g_timeout_add (300000, (GSourceFunc) retry_timeout_cb, retry_data);
+ }
+}
+
/**
* alarm_notify_add_calendar:
* @an: An alarm notification service.
@@ -385,12 +431,11 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
return;
}
- if (load_afterwards)
- add_uri_to_load (uri);
-
lc = g_hash_table_lookup (priv->uri_client_hash, str_uri);
if (lc) {
+ if (load_afterwards)
+ add_uri_to_load (uri);
e_uri_free (uri);
g_assert (lc->refcount > 0);
lc->refcount++;
@@ -400,6 +445,12 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
client = cal_client_new ();
if (client) {
+ /* we only add the URI to load_afterwards if we open it
+ correctly */
+ gtk_signal_connect (GTK_OBJECT (client), "cal_opened",
+ GTK_SIGNAL_FUNC (cal_opened_cb),
+ e_uri_copy (uri));
+
if (cal_client_open_calendar (client, str_uri, FALSE)) {
lc = g_new (LoadedClient, 1);
lc->client = client;
@@ -407,8 +458,6 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
lc->refcount = 1;
g_hash_table_insert (priv->uri_client_hash,
g_strdup (str_uri), lc);
-
- alarm_queue_add_client (client);
} else {
gtk_object_unref (GTK_OBJECT (client));
client = NULL;
@@ -423,4 +472,6 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
NULL);
return;
}
+
+ e_uri_free (uri);
}