aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-component.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-10-19 03:50:29 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-10-19 03:50:29 +0800
commitd21e6e4dc143f1b077da4d9c9375947e63321d7a (patch)
treecb01ffe152063455c05e2d802ae5309d0d96685a /calendar/gui/calendar-component.c
parentf7d9f635db0b3375f31bfa8d7984032dad87c5d1 (diff)
downloadgsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar.gz
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar.bz2
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar.lz
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar.xz
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.tar.zst
gsoc2013-evolution-d21e6e4dc143f1b077da4d9c9375947e63321d7a.zip
Adds session management for the alarm daemon. Also makes it store a list
2001-10-18 Federico Mena Quintero <federico@ximian.com> Adds session management for the alarm daemon. Also makes it store a list of calendars to be monitored. Those calendars will all be loaded when the alarm daemon starts up. * idl/evolution-calendar.idl (AlarmNotify): Removed the ::die() method. The alarm daemon now handles termination via the session manager's commands. * gui/alarm-notify/notify-main.c (set_session_parameters): New function, sets some parameters so that the session manager can restart the daemon via the evolution-alarm-client program. Also, sets up the "die" signal so that the daemon can terminate when the session ends. (load_calendars): New function to load the calendars on startup. (main): Set the session parameters. Load the calendars on startup. * gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar): New function, moved over from the impl_ function. Added a load_afterwards argument to indicate whether the calendar should just be loaded or if it should also be added to the list of calendars to load on startup. (AlarmNotify_addCalendar): Use alarm_notify_add_calendar(). (AlarmNotify_removeCalendar): Remove the calendar from the list of calendars to load on startup. * gui/alarm-notify/save.c (save_calendars_to_load): New function, saves a sequence of the URIs to load. (get_calendars_to_load): New function, loads a sequence of calendars to load. * gui/alarm-notify/alarm.h: Removed stale prototype for alarm_init(). * gui/component-factory.c (remove_folder): Ask the alarm daemon to stop monitoring alarms for the folder that is being deleted. svn path=/trunk/; revision=13763
Diffstat (limited to 'calendar/gui/calendar-component.c')
-rw-r--r--calendar/gui/calendar-component.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index e13a3f8a50..5aa8913f73 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -142,6 +142,60 @@ create_folder (EvolutionShellComponent *shell_component,
CORBA_exception_free (&ev);
}
+/* Asks the alarm daemon to stop monitoring the specified URI */
+static void
+stop_alarms (GnomeVFSURI *uri)
+{
+ char *str_uri;
+ CORBA_Environment ev;
+ GNOME_Evolution_Calendar_AlarmNotify an;
+
+ /* Activate the alarm notification service */
+
+ CORBA_exception_init (&ev);
+ an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("stop_alarms(): Could not activate the alarm notification service");
+ CORBA_exception_free (&ev);
+ return;
+ }
+ CORBA_exception_free (&ev);
+
+ /* Ask the service to remove the URI from its list of calendars */
+
+ str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ g_assert (str_uri != NULL);
+
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Calendar_AlarmNotify_removeCalendar (an, str_uri, &ev);
+ g_free (str_uri);
+
+ if (ev._major == CORBA_USER_EXCEPTION) {
+ char *ex_id;
+
+ ex_id = CORBA_exception_id (&ev);
+ if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0)
+ g_message ("stop_alarms(): Invalid URI reported from the "
+ "alarm notification service");
+ else if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound) == 0) {
+ /* This is OK; the service may not have loaded that calendar */
+ }
+ } else if (ev._major != CORBA_NO_EXCEPTION)
+ g_message ("stop_alarms(): Could not issue the removeCalendar request");
+
+ CORBA_exception_free (&ev);
+
+ /* Get rid of the service */
+
+ CORBA_exception_init (&ev);
+ bonobo_object_release_unref (an, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ g_message ("stop_alarms(): Could not unref the alarm notification service");
+
+ CORBA_exception_free (&ev);
+}
+
static void
remove_folder (EvolutionShellComponent *shell_component,
const char *physical_uri,
@@ -217,6 +271,10 @@ remove_folder (EvolutionShellComponent *shell_component,
goto out;
}
+ /* Ask the alarm daemon to stop monitoring this URI */
+
+ stop_alarms (data_uri);
+
/* Delete the data and backup files; the shell will take care of the rest */
data_result = gnome_vfs_unlink_from_uri (data_uri);