From f9e394b345c636056ade16b48ceac0b2e27b595d Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 23 Oct 2003 07:40:08 +0000 Subject: new function to remove calendars from the views. 2003-10-22 Rodrigo Moya * gui/gnome-cal.[ch] (gnome_calendar_remove_event_uri): new function to remove calendars from the views. svn path=/trunk/; revision=23027 --- calendar/ChangeLog | 5 +++++ calendar/gui/gnome-cal.c | 37 +++++++++++++++++++++++++++++++++++++ calendar/gui/gnome-cal.h | 1 + 3 files changed, 43 insertions(+) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1b7fec48bc..37aebb7644 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2003-10-22 Rodrigo Moya + + * gui/gnome-cal.[ch] (gnome_calendar_remove_event_uri): new + function to remove calendars from the views. + 2003-10-22 Ettore Perazzoli * gui/GNOME_Evolution_Calendar.server.in.in: Add an diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index bcefd8eeee..c28b965627 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2209,6 +2209,43 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri) return TRUE; } +/** + * gnome_calendar_remove_event_uri + * @gcal: A #GnomeCalendar. + * @str_uri: URI to be removed from the clients. + * + * Removes the given URI from the list of clients being shown by the + * calendar views. + * + * Returns: TRUE if successful, FALSE otherwise. + */ +gboolean +gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri) +{ + GnomeCalendarPrivate *priv; + int i; + + g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); + g_return_val_if_fail (str_uri != NULL, FALSE); + + priv = gcal->priv; + + for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { + ECalModel *model; + CalClient *client; + + model = e_cal_view_get_model (priv->views[i]); + client = e_cal_model_get_client_for_uri (model, str_uri); + if (client) + e_cal_model_remove_client (model, client); + } + + /* update date navigator query */ + update_query (gcal); + + return TRUE; +} + /* Tells the calendar to reload all config settings. If initializing is TRUE it sets the pane positions as well. (We don't want to reset the pane positions after the user clicks 'Apply' in the diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index f56ec69211..f36bafd6d3 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -111,6 +111,7 @@ void gnome_calendar_set_default_client (GnomeCalendar *gcal, CalClient CalClient *gnome_calendar_get_task_pad_cal_client(GnomeCalendar *gcal); gboolean gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri); +gboolean gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri); void gnome_calendar_set_query (GnomeCalendar *gcal, const char *sexp); -- cgit v1.2.3