diff options
author | JP Rosevear <jpr@novell.com> | 2004-05-18 21:33:40 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-05-18 21:33:40 +0800 |
commit | 8f8ecd25e13165724e6e4cc71af09a383d44d727 (patch) | |
tree | d0ef937163862fb6bab7b79c4a4ac8202fee6a05 /calendar/gui/alarm-notify/alarm-queue.c | |
parent | a2a2f0b03919f44d467d5a3ef30bda33d7ed28e8 (diff) | |
download | gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar.gz gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar.bz2 gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar.lz gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar.xz gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.tar.zst gsoc2013-evolution-8f8ecd25e13165724e6e4cc71af09a383d44d727.zip |
just set up the alarm notify object
2004-05-18 JP Rosevear <jpr@novell.com>
* gui/alarm-notify/notify-main.c (init_alarm_service): just set
up
the alarm notify object
* gui/alarm-notify/alarm-notify.h: update proto
* gui/alarm-notify/alarm-notify.c (process_removal_in_hash):
process removals using the source list
(list_changed_cb): when the list changes, update
(load_calendars): initially load the calendars
(alarm_notify_init): load the calendars here and don't listen
for
a selection notification
(alarm_notify_add_calendar): get the source type when adding a
calendar
* gui/alarm-notify/notify-main.c (main): no need to
init/shutdown
gnome vfs
* gui/alarm-notify/config-data.h: new proto
* gui/alarm-notify/config-data.c
(config_data_get_notify_with_tray): routine to get schema value
* gui/alarm-notify/alarm.c (alarm_ready_cb): no timeout checking
here, setup_timeout does that
(queue_alarm): ditto
(setup_timeout): calculate the timeout better
* gui/alarm-notify/alarm-queue.c (query_objects_changed_cb):
tidy
(edit_component): clean up exception handling
(display_notification): don't show the tray icon if we aren't
notifying with the tray
* gui/apps_evolution_calendar.schemas.in.in: add
notify_with_tray
option
svn path=/trunk/; revision=25958
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-queue.c')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 115 |
1 files changed, 57 insertions, 58 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index b00e979ad6..1258324d0e 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -26,6 +26,7 @@ #include <glib.h> #include <bonobo-activation/bonobo-activation.h> #include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-exception.h> #include <gtk/gtksignal.h> #include <gtk/gtkbox.h> #include <gtk/gtkdialog.h> @@ -328,6 +329,7 @@ add_component_alarms (ClientAlarms *ca, ECalComponentAlarms *alarms) /* No alarms? */ if (alarms == NULL || alarms->alarms == NULL) { + g_message ("No alarms to add"); if (alarms) e_cal_component_alarms_free (alarms); return; @@ -347,6 +349,7 @@ add_component_alarms (ClientAlarms *ca, ECalComponentAlarms *alarms) instance = l->data; + g_message ("Adding alarm at %lu (%lu)", instance->trigger, time (NULL)); alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); if (!alarm_id) { g_message ("add_component_alarms(): Could not schedule a trigger for " @@ -415,6 +418,7 @@ load_alarms_for_today (ClientAlarms *ca) zone = config_data_get_timezone (); + g_message ("Loading alarms for today"); day_end = time_day_end_with_zone (now, zone); load_alarms (ca, now, day_end); } @@ -530,61 +534,64 @@ query_objects_changed_cb (ECal *client, GList *objects, gpointer data) zone = config_data_get_timezone (); day_end = time_day_end_with_zone (time (NULL), zone); - + g_message ("Query response for alarms"); for (l = objects; l != NULL; l = l->next) { const char *uid; + GSList *sl; uid = icalcomponent_get_uid (l->data); found = e_cal_get_alarms_for_object (ca->client, uid, from, day_end, &alarms); if (!found) { + g_message ("No alarms found on object"); remove_comp (ca, uid); continue; } cqa = lookup_comp_queued_alarms (ca, uid); - if (!cqa) + if (!cqa) { + g_message ("No currently queue alarms"); add_component_alarms (ca, alarms); - else { - GSList *sl; + continue; + } - /* if the alarms or the alarms list is empty, just remove it */ - if (alarms == NULL || alarms->alarms == NULL) { - if (alarms) - e_cal_component_alarms_free (alarms); - } - else { - /* if already in the list, just update it */ - remove_alarms (cqa, FALSE); - cqa->alarms = alarms; - cqa->queued_alarms = NULL; - - /* add the new alarms */ - for (sl = cqa->alarms->alarms; sl; sl = sl->next) { - ECalComponentAlarmInstance *instance; - gpointer alarm_id; - QueuedAlarm *qa; - - instance = sl->data; - - alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); - if (!alarm_id) { - g_message ("obj_updated_cb(): Could not schedule a trigger for " - "%ld, discarding...", (long) instance->trigger); - continue; - } - - qa = g_new (QueuedAlarm, 1); - qa->alarm_id = alarm_id; - qa->instance = instance; - qa->snooze = FALSE; - - cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); - } - - cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms); + g_message ("Already existing alarms"); + /* if the alarms or the alarms list is empty, just remove it */ + if (alarms == NULL || alarms->alarms == NULL) { + if (alarms) + e_cal_component_alarms_free (alarms); + continue; + } + + /* if already in the list, just update it */ + remove_alarms (cqa, FALSE); + cqa->alarms = alarms; + cqa->queued_alarms = NULL; + + /* add the new alarms */ + for (sl = cqa->alarms->alarms; sl; sl = sl->next) { + ECalComponentAlarmInstance *instance; + gpointer alarm_id; + QueuedAlarm *qa; + + instance = sl->data; + + alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); + if (!alarm_id) { + g_message (G_STRLOC ": Could not schedule a trigger for " + "%ld, discarding...", (long) instance->trigger); + continue; } + + qa = g_new (QueuedAlarm, 1); + qa->alarm_id = alarm_id; + qa->instance = instance; + qa->snooze = FALSE; + + cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); } + + cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms); } } @@ -655,31 +662,22 @@ edit_component (ECal *client, ECalComponent *comp) factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory:" BASE_VERSION, 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("edit_component(): Could not activate the component editor factory"); + if (BONOBO_EX (&ev)) { + g_message (G_STRLOC ": Could not activate the component editor factory"); CORBA_exception_free (&ev); return; } - CORBA_exception_free (&ev); /* Edit the component */ - - CORBA_exception_init (&ev); GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, uri, (char *) uid, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("edit_component(): Exception while editing the component"); + if (BONOBO_EX (&ev)) + g_message (G_STRLOC ": Exception while editing the component"); CORBA_exception_free (&ev); /* Get rid of the factory */ - - CORBA_exception_init (&ev); - bonobo_object_release_unref (factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("edit_component(): Could not unref the calendar component factory"); - - CORBA_exception_free (&ev); + bonobo_object_release_unref (factory, NULL); } typedef struct { @@ -909,7 +907,6 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, { QueuedAlarm *qa; ECalComponent *comp; - ECalComponentVType vtype; const char *message; ECalComponentAlarm *alarm; GtkWidget *tray_icon, *image, *ebox; @@ -924,9 +921,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, qa = lookup_queued_alarm (cqa, alarm_id); if (!qa) return; - - vtype = e_cal_component_get_vtype (comp); - + /* get a sensible description for the event */ alarm = e_cal_component_get_alarm (comp, qa->instance->auid); g_assert (alarm != NULL); @@ -1000,7 +995,11 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, tray_data->blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data); - gtk_widget_show (tray_icon); + if (!config_data_get_notify_with_tray ()) { + open_alarm_dialog (tray_data); + } else { + gtk_widget_show (tray_icon); + } } /* Performs notification of an audio alarm */ |