diff options
author | JP Rosevear <jpr@ximian.com> | 2004-04-15 05:41:21 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-04-15 05:41:21 +0800 |
commit | 726d0388cf3d1164e7d31709e15a93ab00654988 (patch) | |
tree | bfbd38e2154b94226eeb8a97d238deed868da28d /calendar | |
parent | 24c56f175744c852ef211207405ea40ae3fba450 (diff) | |
download | gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar.gz gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar.bz2 gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar.lz gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar.xz gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.tar.zst gsoc2013-evolution-726d0388cf3d1164e7d31709e15a93ab00654988.zip |
Fixes #56613
2004-04-14 JP Rosevear <jpr@ximian.com>
Fixes #56613
* gui/gnome-cal.h: add proto
* gui/gnome-cal.c (client_cal_opened_cb): key the clients by uid
(backend_died_cb): ditto
(gnome_calendar_add_source): ditto
(gnome_calendar_remove_source): use remove_source_by_uid
(gnome_calendar_remove_source_by_uid): new function to remove a
source by uid
(gnome_calendar_set_default_source): key the clients by uid
* gui/calendar-component.c (update_task_selection): the source
could be NULL if the source was deleted rather than unchecked
(update_primary_task_selection): look at the task source list
svn path=/trunk/; revision=25469
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 6 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 45 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.h | 1 |
4 files changed, 46 insertions, 24 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fc1ef61fec..265537db7f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,23 @@ 2004-04-14 JP Rosevear <jpr@ximian.com> + Fixes #56613 + + * gui/gnome-cal.h: add proto + + * gui/gnome-cal.c (client_cal_opened_cb): key the clients by uid + (backend_died_cb): ditto + (gnome_calendar_add_source): ditto + (gnome_calendar_remove_source): use remove_source_by_uid + (gnome_calendar_remove_source_by_uid): new function to remove a + source by uid + (gnome_calendar_set_default_source): key the clients by uid + + * gui/calendar-component.c (update_task_selection): the source + could be NULL if the source was deleted rather than unchecked + (update_primary_task_selection): look at the task source list + +2004-04-14 JP Rosevear <jpr@ximian.com> + Fixes #56553 * importers/icalendar-importer.c (prepare_events): don't double diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 3ea1d99f46..828c751fe4 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -238,7 +238,9 @@ update_task_selection (CalendarComponent *calendar_component) ESource *source; source = e_source_list_peek_source_by_uid (priv->task_source_list, uid); - if (!is_in_uids (uids_selected, source)) + if (!source) + gnome_calendar_remove_source_by_uid (priv->calendar, E_CAL_SOURCE_TYPE_TODO, uid); + else if (!is_in_uids (uids_selected, source)) gnome_calendar_remove_source (priv->calendar, E_CAL_SOURCE_TYPE_TODO, source); g_free (uid); @@ -294,7 +296,7 @@ update_primary_task_selection (CalendarComponent *calendar_component) uid = calendar_config_get_primary_tasks (); if (uid) { - source = e_source_list_peek_source_by_uid (priv->source_list, uid); + source = e_source_list_peek_source_by_uid (priv->task_source_list, uid); g_free (uid); } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 31cec1741f..32d07898a3 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1215,7 +1215,7 @@ gnome_calendar_goto_date (GnomeCalendar *gcal, GnomeCalendarGotoDateType goto_date) { GnomeCalendarPrivate *priv; - time_t new_time; + time_t new_time = 0; gboolean need_updating = FALSE; g_return_if_fail (gcal != NULL); @@ -1747,6 +1747,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) { GnomeCalendarPrivate *priv; ECalSourceType source_type; + ESource *source; char *msg; int i; @@ -1755,10 +1756,11 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) e_calendar_view_set_status_message (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)), NULL); source_type = e_cal_get_source_type (ecal); + source = e_cal_get_source (ecal); if (status != E_CALENDAR_STATUS_OK) { priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal); - g_hash_table_remove (priv->clients[source_type], e_cal_get_uri (ecal)); + g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source)); return; } @@ -1931,7 +1933,7 @@ backend_died_cb (ECal *ecal, gpointer data) source = e_cal_get_source (ecal); priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal); - g_hash_table_remove (priv->clients[source_type], e_cal_get_uri (ecal)); + g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source)); switch (source_type) { case E_CAL_SOURCE_TYPE_EVENT: @@ -2062,7 +2064,6 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou { GnomeCalendarPrivate *priv; ECal *client; - char *str_uri; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); @@ -2070,9 +2071,7 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou priv = gcal->priv; - str_uri = e_source_get_uri (source); - client = g_hash_table_lookup (priv->clients[source_type], str_uri); - g_free (str_uri); + client = g_hash_table_lookup (priv->clients[source_type], e_source_peek_uid (source)); if (client) return TRUE; @@ -2085,7 +2084,7 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou 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[source_type], g_strdup (e_cal_get_uri (client)), client); + g_hash_table_insert (priv->clients[source_type], g_strdup (e_source_peek_uid (source)), client); priv->clients_list[source_type] = g_list_prepend (priv->clients_list[source_type], client); open_ecal (gcal, client, FALSE); @@ -2106,24 +2105,30 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou gboolean gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source) { + g_return_val_if_fail (gcal != NULL, FALSE); + g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); + g_return_val_if_fail (E_IS_SOURCE (source), FALSE); + + return gnome_calendar_remove_source_by_uid (gcal, source_type, e_source_peek_uid (source)); +} + +gboolean +gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_type, const char *uid) +{ GnomeCalendarPrivate *priv; ECal *client; ECalModel *model; - char *str_uri; int i; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); - g_return_val_if_fail (E_IS_SOURCE (source), FALSE); + g_return_val_if_fail (uid != NULL, FALSE); priv = gcal->priv; - str_uri = e_source_get_uri (source); - client = g_hash_table_lookup (priv->clients[source_type], str_uri); - if (!client) { - g_free (str_uri); + client = g_hash_table_lookup (priv->clients[source_type], uid); + if (!client) return TRUE; - } priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], client); g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, @@ -2136,7 +2141,7 @@ gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, E e_cal_model_remove_client (model, client); } break; - + case E_CAL_SOURCE_TYPE_TODO: model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)); e_cal_model_remove_client (model, client); @@ -2147,8 +2152,7 @@ gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, E break; } - g_hash_table_remove (priv->clients[source_type], str_uri); - g_free (str_uri); + g_hash_table_remove (priv->clients[source_type], uid); /* update date navigator query */ update_query (gcal); @@ -2174,7 +2178,6 @@ gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_ty GnomeCalendarPrivate *priv; ECal *client; int i; - char *str_uri; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); @@ -2182,9 +2185,7 @@ gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_ty priv = gcal->priv; - str_uri = e_source_get_uri (source); - client = g_hash_table_lookup (priv->clients[source_type], str_uri); - g_free (str_uri); + client = g_hash_table_lookup (priv->clients[source_type], e_source_peek_uid (source)); if (!client) return FALSE; diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index edb9405b1f..cb7e60ee0b 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -109,6 +109,7 @@ ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal); gboolean gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source); gboolean gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source); +gboolean gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_type, const char *uid); gboolean gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source); void gnome_calendar_next (GnomeCalendar *gcal); |