2000-05-11 Federico Mena Quintero <federico@helixcode.com> * gui/gnome-cal.c (gnome_calendar_update_all): Removed unused arguments. Load the initial alarms here. (load_alarms): New function to load a day's worth of alarms. (gnome_calendar_class_init): Eeeek! This was taking in an incorrect argument type. (gnome_calendar_init): Now the calendar keeps a hash table of UIDs->queued alarms. Create the hash table here. (gnome_calendar_destroy): Destroy the alarms hash table. (gnome_calendar_object_updated_cb): Remove the alarms for the object and regenerate them. (gnome_calendar_object_removed_cb): Remove the alarms for the object. * gui/alarm.c (alarm_add): Do not take in a CalendarAlarm, just the trigger time, the callback and the closure data. Return an opaque identifier for the alarm so that it can be removed by the client code if needed. Use the queue_alarm() helper function. (queue_alarm): Helper function to actually queue the alarm and set up the itimer. Deal with a nonzero return value from setitimer(). (alarm_remove): New function to remove an alarm based on its ID. (pop_alarm): New helper function; pops the first alarm of the queue and resets the timer as appropriate. (alarm_ready): Simplified a lot by using pop_alarm(). * idl/evolution-calendar.idl (Cal): Added get_alarms_in_range(). * pcs/cal.c (build_instance_seq): New function to build a CORBA sequence from the internal list of instances. (Cal_get_events_in_range): Use build_instance_seq(). (Cal_get_alarms_in_range): Implemented new method. * pcs/cal-backend.c (cal_backend_get_alarms_in_range): New function with the get_alarms_in_range() engine. * pcs/cal-backend-imc.c (cal_backend_imc_get_alarms_in_range): Implemented the get_alarms_in_range() method. * cal-client/cal-client.c (cal_client_get_alarms_in_range): New client-side function for getting the alarms. (build_instance_list): New helper function to build the CalObjInstance list from the CORBA sequence. (cal_client_get_events_in_range): Use build_instance_list(). * gui/calendar-commands.h: #include <cal-util/calobj.h>. #include "gnome-cal.h". * gui/e-week-view.c: #include "calendar-commands.h" instead of main.h; the latter is an obsolete file and will be killed. * gui/evolution-calendar-control.c (main): Call init_bonobo() before anything else. We need the GTK+ object system initialized. * gui/Makefile.am (evolution_calendar_SOURCES): Do not use main.h. * cal-util/cal-util.c (cal_alarm_instance_list_free): New function. svn path=/trunk/; revision=2987
101 lines
2.0 KiB
C
101 lines
2.0 KiB
C
/* Evolution calendar utilities and types
|
||
*
|
||
* Copyright (C) 2000 Helix Code, Inc.
|
||
*
|
||
* Author: Federico Mena-Quintero <federico@helixcode.com>
|
||
*
|
||
* This program is free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU General Public License
|
||
* along with this program; if not, write to the Free Software
|
||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||
*/
|
||
|
||
#include <config.h>
|
||
#include <stdlib.h>
|
||
#include "cal-util.h"
|
||
#include "libversit/vcc.h"
|
||
|
||
|
||
|
||
/**
|
||
* cal_obj_instance_list_free:
|
||
* @list: List of #CalObjInstance structures.
|
||
*
|
||
* Frees a list of #CalObjInstance structures.
|
||
**/
|
||
void
|
||
cal_obj_instance_list_free (GList *list)
|
||
{
|
||
CalObjInstance *i;
|
||
GList *l;
|
||
|
||
for (l = list; l; l = l->next) {
|
||
i = l->data;
|
||
|
||
g_assert (i != NULL);
|
||
g_assert (i->uid != NULL);
|
||
|
||
g_free (i->uid);
|
||
g_free (i);
|
||
}
|
||
|
||
g_list_free (list);
|
||
}
|
||
|
||
/**
|
||
* cal_alarm_instance_list_free:
|
||
* @list: List of #CalAlarmInstance structures.
|
||
*
|
||
* Frees a list of #CalAlarmInstance structures.
|
||
**/
|
||
void
|
||
cal_alarm_instance_list_free (GList *list)
|
||
{
|
||
CalAlarmInstance *i;
|
||
GList *l;
|
||
|
||
for (l = list; l; l = l->next) {
|
||
i = l->data;
|
||
|
||
g_assert (i != NULL);
|
||
g_assert (i->uid != NULL);
|
||
|
||
g_free (i->uid);
|
||
g_free (i);
|
||
}
|
||
|
||
g_list_free (list);
|
||
}
|
||
|
||
/**
|
||
* cal_obj_uid_list_free:
|
||
* @list: List of strings with unique identifiers.
|
||
*
|
||
* Frees a list of unique identifiers for calendar objects.
|
||
**/
|
||
void
|
||
cal_obj_uid_list_free (GList *list)
|
||
{
|
||
GList *l;
|
||
|
||
for (l = list; l; l = l->next) {
|
||
char *uid;
|
||
|
||
uid = l->data;
|
||
|
||
g_assert (uid != NULL);
|
||
g_free (uid);
|
||
}
|
||
|
||
g_list_free (list);
|
||
}
|