From 0f91739965d3c701a198062c4f7af39aff401a7f Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 9 Feb 2004 15:00:47 +0000 Subject: don't add the clients to the internal hash/list here, just remove it if 2004-02-09 Rodrigo Moya * gui/gnome-cal.c (client_cal_opened_cb): don't add the clients to the internal hash/list here, just remove it if opening the calendar fails. (gnome_calendar_add_event_source): add the client to the internal hash/list here. svn path=/trunk/; revision=24682 --- calendar/ChangeLog | 7 +++++++ calendar/gui/gnome-cal.c | 23 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7a5e44bb8f..4484f2711d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2004-02-09 Rodrigo Moya + + * gui/gnome-cal.c (client_cal_opened_cb): don't add the clients to the + internal hash/list here, just remove it if opening the calendar fails. + (gnome_calendar_add_event_source): add the client to the internal + hash/list here. + 2004-02-09 Kidd Wang * gui/e-cal-model-tasks.c: (ecmt_set_value_at): refuse to update diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index bd9d8aba4d..40f40a8513 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1751,10 +1751,6 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) } else { int i; - /* add the client to internal structure */ - g_hash_table_insert (priv->clients, g_strdup (e_cal_get_uri (ecal)), ecal); - priv->clients_list = g_list_prepend (priv->clients_list, ecal); - /* add client to the views */ for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { ECalModel *model; @@ -1766,8 +1762,21 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) /* update date navigator query */ update_query (gcal); } - } else + } else { + if (ecal != priv->task_pad_client) { + gpointer orig_uid; + gpointer orig_client; + + if (g_hash_table_lookup_extended (priv->clients, e_cal_get_uri (ecal), &orig_uid, &orig_client)) { + g_hash_table_remove (priv->clients, e_cal_get_uri (ecal)); + g_free (orig_uid); + } + + priv->clients_list = g_list_append (priv->clients_list, ecal); + } + g_object_unref (ecal); + } } static gboolean @@ -2117,6 +2126,10 @@ gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source) g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), gcal); g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal); + /* add the client to internal structure */ + g_hash_table_insert (priv->clients, g_strdup (e_cal_get_uri (client)), client); + priv->clients_list = g_list_prepend (priv->clients_list, client); + open_ecal (gcal, client, FALSE); return TRUE; -- cgit v1.2.3