From 96d24f1297eaa5a6333b9fcfdf35420d273703af Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 1 Aug 2001 03:41:51 +0000 Subject: The Wombat now keeps track of which categories are present in the objects 2001-07-31 Federico Mena Quintero The Wombat now keeps track of which categories are present in the objects of a calendar. It will notify the clients of changes in this set. This is to make the category drop-down menus in the calendar/tasks views be always up to date. * idl/evolution-calendar.idl (Listener): Added a notifyCategoriesChanged() method. The Wombat now keeps track of the categories within a calendar. * cal-client/cal-listener.[ch]: Switched it to use BonoboXObject. Also added the notifyCategoriesChanged implementation. * cal-client/cal-client.[ch]: Added a "categories_changed" signal. * pcs/cal-backend-file.c: Maintain a list of the live categories. (update_categories_from_comp): New function to maintain the set of live categories. (add_component): Update the set of categories. (remove_component): Likewise. (open_cal): Notify about changes in the set of categories. (create_cal): Likewise. (cal_backend_file_update_objects): Likewise. (cal_backend_file_remove_object): Likewise. (notify_categories_changed): New function to notify the clients about the current set of categories. * pcs/cal.c (cal_notify_categories_changed): New function. svn path=/trunk/; revision=11536 --- calendar/pcs/cal.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'calendar/pcs/cal.c') diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index f89d5c820f..cb92f391b5 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -673,6 +673,37 @@ cal_notify_remove (Cal *cal, const char *uid) CORBA_exception_free (&ev); } +/** + * cal_notify_categories_changed: + * @cal: A calendar client interface. + * @categories: List of categories. + * + * Notifies a listener attached to a calendar client interface object about the + * current set of categories in a calendar backend. + **/ +void +cal_notify_categories_changed (Cal *cal, GNOME_Evolution_Calendar_StringSeq *categories) +{ + CalPrivate *priv; + CORBA_Environment ev; + + g_return_if_fail (cal != NULL); + g_return_if_fail (IS_CAL (cal)); + g_return_if_fail (categories != NULL); + + priv = cal->priv; + g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); + + CORBA_exception_init (&ev); + GNOME_Evolution_Calendar_Listener_notifyCategoriesChanged (priv->listener, categories, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + g_message ("cal_notify_categories_changed(): Could not notify the listener " + "about the current set of categories"); + + CORBA_exception_free (&ev); +} + /** * cal_get_password: * @cal: A calendar client interface. -- cgit v1.2.3