aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-12-20 02:12:57 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-12-20 02:12:57 +0800
commitde861766eded0c80ffbe050088043a16d7e4923f (patch)
tree5010fda36af306efaab59e11ebfa12b7bd43023a
parent20dabfff3014eb67b5c930345e8cb64116dba374 (diff)
downloadgsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar.gz
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar.bz2
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar.lz
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar.xz
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.tar.zst
gsoc2013-evolution-de861766eded0c80ffbe050088043a16d7e4923f.zip
Fix confusion in the way the range is expanded.
2000-12-19 Federico Mena Quintero <federico@helixcode.com> * pcs/cal-backend-file.c (compute_alarm_range): Fix confusion in the way the range is expanded. * cal-util/cal-component.c (cal_component_alarms_free): Doh, alarms->alarms is a list, not a generic pointer. Free it properly. (cal_component_free_pilot_id): Removed unused function. (cal_component_free_pilot_status): Likewise. * gui/main.c (init_bonobo): Use VERSION instead of a hardcoded string. Pass argc by value, not by reference. Test the return value of gnome_init_with_popt_table(). * cal-client/cal-client.c (cal_client_free_alarms): Oops, missed implementing this function. * cal-util/timeutil.c (print_time_t): Better printing format. (isodiff_to_secs): Removed unused function. (isodiff_from_secs): Removed unused function. (time_day_end): Removed crufty part. (time_day_begin): Removed crufty part. (time_day_hour): Removed unused function. (format_simple_hour): Removed unused function. (get_time_t_hour): Removed unused function. (time_from_start_duration): Removed unused function. * cal-util/timeutil.h (parse_date): Removed unimplemented, unused function prototype. svn path=/trunk/; revision=7083
-rw-r--r--calendar/ChangeLog30
-rw-r--r--calendar/cal-client/cal-client.c41
-rw-r--r--calendar/cal-client/cal-client.h2
-rw-r--r--calendar/cal-util/cal-component.c170
-rw-r--r--calendar/cal-util/cal-component.h8
-rw-r--r--calendar/cal-util/timeutil.c240
-rw-r--r--calendar/cal-util/timeutil.h13
-rw-r--r--calendar/gui/alarm-notify/alarm.c3
-rw-r--r--calendar/gui/alarm.c3
-rw-r--r--calendar/gui/main.c15
-rw-r--r--calendar/pcs/cal-backend-file.c14
11 files changed, 170 insertions, 369 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 766258fc97..e84c8615b0 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,33 @@
+2000-12-19 Federico Mena Quintero <federico@helixcode.com>
+
+ * pcs/cal-backend-file.c (compute_alarm_range): Fix confusion in
+ the way the range is expanded.
+
+ * cal-util/cal-component.c (cal_component_alarms_free): Doh,
+ alarms->alarms is a list, not a generic pointer. Free it properly.
+ (cal_component_free_pilot_id): Removed unused function.
+ (cal_component_free_pilot_status): Likewise.
+
+ * gui/main.c (init_bonobo): Use VERSION instead of a hardcoded
+ string. Pass argc by value, not by reference. Test the return
+ value of gnome_init_with_popt_table().
+
+ * cal-client/cal-client.c (cal_client_free_alarms): Oops, missed
+ implementing this function.
+
+ * cal-util/timeutil.c (print_time_t): Better printing format.
+ (isodiff_to_secs): Removed unused function.
+ (isodiff_from_secs): Removed unused function.
+ (time_day_end): Removed crufty part.
+ (time_day_begin): Removed crufty part.
+ (time_day_hour): Removed unused function.
+ (format_simple_hour): Removed unused function.
+ (get_time_t_hour): Removed unused function.
+ (time_from_start_duration): Removed unused function.
+
+ * cal-util/timeutil.h (parse_date): Removed unimplemented, unused
+ function prototype.
+
2000-12-19 Christopher James Lahey <clahey@helixcode.com>
* gui/gnome-cal.c: Removed prototype for setup_alarm to fix a
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index b3e8cd507d..fb4e673ae7 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -1283,13 +1283,38 @@ cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end)
}
/**
+ * cal_client_free_alarms:
+ * @comp_alarms: A list of #CalComponentAlarms structures.
+ *
+ * Frees a list of #CalComponentAlarms structures as returned by
+ * cal_client_get_alarms_in_range().
+ **/
+void
+cal_client_free_alarms (GSList *comp_alarms)
+{
+ GSList *l;
+
+ for (l = comp_alarms; l; l = l->next) {
+ CalComponentAlarms *alarms;
+
+ alarms = l->data;
+ g_assert (alarms != NULL);
+
+ cal_component_alarms_free (alarms);
+ }
+
+ g_slist_free (comp_alarms);
+}
+
+/**
* cal_client_get_alarms_for_object:
* @client: A calendar client.
* @uid: Unique identifier for a calendar component.
* @start: Start time for query.
* @end: End time for query.
* @alarms: Return value for the component's alarm instances. Will return NULL
- * if no instances occur within the specified time range.
+ * if no instances occur within the specified time range. This should be freed
+ * using the cal_component_alarms_free() function.
*
* Queries a calendar for the alarms of a particular object that trigger in the
* specified range of time.
@@ -1412,6 +1437,20 @@ cal_client_update_object (CalClient *client, CalComponent *comp)
return retval;
}
+/**
+ * cal_client_remove_object:
+ * @client: A calendar client.
+ * @uid: Unique identifier of the calendar component to remove.
+ *
+ * Asks a calendar to remove a component. If the server is able to remove the
+ * component, all clients will be notified and they will emit the "obj_removed"
+ * signal.
+ *
+ * Return value: TRUE on success, FALSE on specifying a UID for a component that
+ * is not in the server. Returning FALSE is normal; the object may have
+ * disappeared from the server before the client has had a chance to receive the
+ * corresponding notification.
+ **/
gboolean
cal_client_remove_object (CalClient *client, const char *uid)
{
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index ecf714a9a4..bbd0d1871e 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -104,7 +104,7 @@ void cal_client_generate_instances (CalClient *client, CalObjType type,
GSList *cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end);
-void cal_client_free_alarms (GSList *alarms);
+void cal_client_free_alarms (GSList *comp_alarms);
gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid,
time_t start, time_t end,
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 1ece361da7..0c7ca50d9f 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -1130,73 +1130,6 @@ cal_component_set_uid (CalComponent *comp, const char *uid)
}
/**
- * cal_component_get_status:
- * @comp: A calendar component object.
- * @status: Return value for the status value. It is set to #ICAL_STATUS_NONE
- * if the component has no status property.
- *
- * Queries the status property of a calendar component object.
- **/
-void
-cal_component_get_status (CalComponent *comp, icalproperty_status *status)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (status != NULL);
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- if (!priv->status) {
- *status = ICAL_STATUS_NONE;
- return;
- }
-
- *status = icalproperty_get_status (priv->status);
-}
-
-/**
- * cal_component_set_status:
- * @comp: A calendar component object.
- * @status: Status value. You should use #ICAL_STATUS_NONE if you want to unset
- * this property.
- *
- * Sets the status property of a calendar component object.
- **/
-void
-cal_component_set_status (CalComponent *comp, icalproperty_status status)
-{
- CalComponentPrivate *priv;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (IS_CAL_COMPONENT (comp));
-
- priv = comp->priv;
- g_return_if_fail (priv->icalcomp != NULL);
-
- priv->need_sequence_inc = TRUE;
-
- if (status == ICAL_STATUS_NONE) {
- if (priv->status) {
- icalcomponent_remove_property (priv->icalcomp, priv->status);
- icalproperty_free (priv->status);
- priv->status = NULL;
- }
-
- return;
- }
-
- if (priv->status) {
- icalproperty_set_status (priv->status, status);
- } else {
- priv->status = icalproperty_new_status (status);
- icalcomponent_add_property (priv->icalcomp, priv->status);
- }
-}
-
-/**
* cal_component_get_categories_list:
* @comp: A calendar component object.
* @categ_list: Return value for the list of strings, where each string is a
@@ -2381,8 +2314,7 @@ cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list)
* @comp: A calendar component object.
* @recur_list: Returns a list of exception rule properties.
*
- * Returns a list of exception rule properties of a calendar component
- * object.
+ * Queries the list of exception rule properties of a calendar component object.
**/
void
cal_component_get_exrule_property_list (CalComponent *comp, GSList **recur_list)
@@ -2802,8 +2734,7 @@ cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list)
* @comp: A calendar component object.
* @recur_list: Returns a list of recurrence rule properties.
*
- * Returns a list of recurrence rule properties of a calendar component
- * object.
+ * Queries a list of recurrence rule properties of a calendar component object.
**/
void
cal_component_get_rrule_property_list (CalComponent *comp, GSList **recur_list)
@@ -2951,6 +2882,73 @@ cal_component_set_sequence (CalComponent *comp, int *sequence)
}
/**
+ * cal_component_get_status:
+ * @comp: A calendar component object.
+ * @status: Return value for the status value. It is set to #ICAL_STATUS_NONE
+ * if the component has no status property.
+ *
+ * Queries the status property of a calendar component object.
+ **/
+void
+cal_component_get_status (CalComponent *comp, icalproperty_status *status)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (status != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!priv->status) {
+ *status = ICAL_STATUS_NONE;
+ return;
+ }
+
+ *status = icalproperty_get_status (priv->status);
+}
+
+/**
+ * cal_component_set_status:
+ * @comp: A calendar component object.
+ * @status: Status value. You should use #ICAL_STATUS_NONE if you want to unset
+ * this property.
+ *
+ * Sets the status property of a calendar component object.
+ **/
+void
+cal_component_set_status (CalComponent *comp, icalproperty_status status)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ priv->need_sequence_inc = TRUE;
+
+ if (status == ICAL_STATUS_NONE) {
+ if (priv->status) {
+ icalcomponent_remove_property (priv->icalcomp, priv->status);
+ icalproperty_free (priv->status);
+ priv->status = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->status) {
+ icalproperty_set_status (priv->status, status);
+ } else {
+ priv->status = icalproperty_new_status (status);
+ icalcomponent_add_property (priv->icalcomp, priv->status);
+ }
+}
+
+/**
* cal_component_get_summary:
* @comp: A calendar component object.
* @summary: Return value for the summary property and its parameters.
@@ -3369,34 +3367,6 @@ cal_component_free_sequence (int *sequence)
}
/**
- * cal_component_free_pilot_id:
- * @sequence: Sequence number value.
- *
- * Frees a sequence number value.
- **/
-void
-cal_component_free_pilot_id (unsigned long *pilot_id)
-{
- g_return_if_fail (pilot_id != NULL);
-
- g_free (pilot_id);
-}
-
-/**
- * cal_component_free_pilot_status:
- * @sequence: Sequence number value.
- *
- * Frees a sequence number value.
- **/
-void
-cal_component_free_pilot_status (unsigned long *pilot_status)
-{
- g_return_if_fail (pilot_status != NULL);
-
- g_free (pilot_status);
-}
-
-/**
* cal_component_free_text_list:
* @text_list: List of #CalComponentText structures.
*
@@ -3625,7 +3595,7 @@ cal_component_alarms_free (CalComponentAlarms *alarms)
g_free (instance);
}
- g_free (alarms->alarms);
+ g_slist_free (alarms->alarms);
g_free (alarms);
}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 893e066f52..5d649fb7ca 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -173,9 +173,6 @@ void cal_component_commit_sequence (CalComponent *comp);
void cal_component_get_uid (CalComponent *comp, const char **uid);
void cal_component_set_uid (CalComponent *comp, const char *uid);
-void cal_component_get_status (CalComponent *comp, icalproperty_status *status);
-void cal_component_set_status (CalComponent *comp, icalproperty_status status);
-
void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list);
void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list);
@@ -243,6 +240,9 @@ gboolean cal_component_has_recurrences (CalComponent *comp);
void cal_component_get_sequence (CalComponent *comp, int **sequence);
void cal_component_set_sequence (CalComponent *comp, int *sequence);
+void cal_component_get_status (CalComponent *comp, icalproperty_status *status);
+void cal_component_set_status (CalComponent *comp, icalproperty_status status);
+
void cal_component_get_summary (CalComponent *comp, CalComponentText *summary);
void cal_component_set_summary (CalComponent *comp, CalComponentText *summary);
@@ -264,8 +264,6 @@ void cal_component_free_priority (int *priority);
void cal_component_free_period_list (GSList *period_list);
void cal_component_free_recur_list (GSList *recur_list);
void cal_component_free_sequence (int *sequence);
-void cal_component_free_pilot_id (unsigned long *pilot_status);
-void cal_component_free_pilot_status (unsigned long *pilot_status);
void cal_component_free_text_list (GSList *text_list);
/* Alarms */
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
index 933230872b..6bc893831d 100644
--- a/calendar/cal-util/timeutil.c
+++ b/calendar/cal-util/timeutil.c
@@ -17,20 +17,11 @@ print_time_t (time_t t)
{
struct tm *tm = localtime (&t);
- printf ("TIEMPO: %d/%d/%d %d:%d:%d\n",
- tm->tm_mon+1, tm->tm_mday, tm->tm_year,
+ printf ("%d/%02d/%02d %02d:%02d:%02d",
+ 1900 + tm->tm_year, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
-int
-get_time_t_hour (time_t t)
-{
- struct tm *tm;
-
- tm = localtime (&t);
- return tm->tm_hour;
-}
-
char *
isodate_from_time_t (time_t t)
{
@@ -43,43 +34,17 @@ isodate_from_time_t (time_t t)
}
time_t
-time_from_start_duration (time_t start, char *duration)
-{
- printf ("Not yet implemented\n");
- return 0;
-}
-
-char *
-format_simple_hour (int hour, int use_am_pm)
-{
- static char buf[256];
-
- /* I don't know whether this is the best way to internationalize it.
- * Does any language use different conventions? - Federico
- */
-
- if (use_am_pm)
- g_snprintf (buf, sizeof(buf), "%d%s",
- (hour == 0) ? 12 : (hour > 12) ? (hour - 12) : hour,
- (hour < 12) ? _("am") : _("pm"));
- else
- g_snprintf (buf, sizeof(buf), "%02d%s", hour, _("h"));
-
- return buf;
-
-}
-
-time_t
time_add_minutes (time_t time, int minutes)
{
struct tm *tm = localtime (&time);
time_t new_time;
tm->tm_min += minutes;
- if ((new_time = mktime (tm)) == -1){
+ if ((new_time = mktime (tm)) == -1) {
g_message ("time_add_minutes(): mktime() could not handle "
"adding %d minutes with\n", minutes);
print_time_t (time);
+ printf ("\n");
return time;
}
return new_time;
@@ -104,20 +69,21 @@ time_add_day (time_t time, int days)
tm->tm_mday += days;
tm->tm_isdst = -1;
- if ((new_time = mktime (tm)) == -1){
+ if ((new_time = mktime (tm)) == -1) {
g_message ("time_add_day(): mktime() could not handling adding %d days with\n",
days);
print_time_t (time);
+ printf ("\n");
return time;
}
#if 0
/* I don't know what this is for. See also time_day_begin() and
time_day_end(). - Damon. */
- if (dst_flag > tm->tm_isdst){
+ if (dst_flag > tm->tm_isdst) {
tm->tm_hour++;
new_time += 3600;
- } else if (dst_flag < tm->tm_isdst){
+ } else if (dst_flag < tm->tm_isdst) {
tm->tm_hour--;
new_time -= 3600;
}
@@ -143,14 +109,15 @@ time_add_month (time_t time, int months)
tm->tm_mon += months;
tm->tm_isdst = -1;
- if ((new_time = mktime (tm)) == -1){
+ if ((new_time = mktime (tm)) == -1) {
g_message ("time_add_month(): mktime() could not handling adding %d months with\n",
months);
print_time_t (time);
+ printf ("\n");
return time;
}
tm = localtime (&new_time);
- if (tm->tm_mday < mday){
+ if (tm->tm_mday < mday) {
tm->tm_mon--;
tm->tm_mday = time_days_in_month (tm->tm_year+1900, tm->tm_mon);
return new_time = mktime (tm);
@@ -166,28 +133,16 @@ time_add_year (time_t time, int years)
time_t new_time;
tm->tm_year += years;
- if ((new_time = mktime (tm)) == -1){
+ if ((new_time = mktime (tm)) == -1) {
g_message ("time_add_year(): mktime() could not handling adding %d years with\n",
years);
print_time_t (time);
+ printf ("\n");
return time;
}
return new_time;
}
-time_t
-time_day_hour (time_t t, int hour)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = hour;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- return mktime (&tm);
-}
-
/* Number of days in a month, for normal and leap years */
static const int days_in_month[2][12] = {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
@@ -329,7 +284,6 @@ time_week_end (time_t t)
time_t
time_day_begin (time_t t)
{
-#if 1
struct tm tm;
tm = *localtime (&t);
@@ -339,44 +293,12 @@ time_day_begin (time_t t)
tm.tm_isdst = -1;
return mktime (&tm);
-
-#else
- /* This is the original code which sometimes produces a time of 1:00.
- I don't understand why it looked at the tm_isdst flags at all.
- - Damon. */
-
- struct tm tm;
- time_t temp = t - 43200;
- int dstflag, dstflag2;
-
- tm = *localtime(&temp); /* one day */
- dstflag = tm.tm_isdst;
-
- tm = *localtime (&t);
- dstflag2 = tm.tm_isdst;
-
- if (dstflag < dstflag2)
- tm.tm_hour = 1;
- else
- tm.tm_hour = 0;
-
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- temp = mktime(&tm);
- if (dstflag > dstflag2){
- temp += 3600;
- }
-
- return temp;
-#endif
}
/* Returns the end of the day, according to the local time. */
time_t
time_day_end (time_t t)
{
-#if 1
struct tm tm;
tm = *localtime (&t);
@@ -387,140 +309,4 @@ time_day_end (time_t t)
tm.tm_isdst = -1;
return mktime (&tm);
-
-#else
- /* This is the original code which has more problems than
- time_day_begin(). - Damon. */
-
- struct tm tm;
- time_t temp;
- int dstflag, dstflag2;
-
- t += 10800;
- temp = t - 86400;
-
- tm = *localtime(&temp); /* one day */
- dstflag = tm.tm_isdst;
-
- tm = *localtime (&t);
- dstflag2 = tm.tm_isdst;
-
- if (dstflag < dstflag2)
- tm.tm_hour = 23;
- else {
- tm.tm_mday++;
- tm.tm_hour = 0;
- }
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- temp = mktime(&tm);
- if(dstflag > dstflag2) {
- }
- return temp;
-#endif
-}
-
-static char *
-pcat (char *dest, int num, char key)
-{
- int c;
-
- c = sprintf (dest, "%d%c", num, key);
- return dest + c;
-}
-
-/* Converts secs into the ISO difftime representation */
-char *
-isodiff_from_secs (int secs)
-{
- static char buffer [60], *p;
- int years, months, weeks, days, hours, minutes;
-
- years = months = weeks = days = hours = minutes = 0;
-
- years = secs / (365 * 86400);
- secs %= (365 * 86400);
- months = secs / (30 * 86400);
- secs %= (30 * 86400);
- weeks = secs / (7 * 86400);
- secs %= (7 * 86400);
- days = secs / 86400;
- secs %= 86400;
- hours = secs / 3600;
- secs %= 3600;
- minutes = secs / 60;
- secs %= 60;
-
- strcpy (buffer, "P");
- p = buffer + 1;
- if (years)
- p = pcat (p, years, 'Y');
- if (months)
- p = pcat (p, months, 'M');
- if (weeks)
- p = pcat (p, weeks, 'W');
- if (days)
- p = pcat (p, days, 'D');
- if (hours || minutes || secs){
- *p++ = 'T';
- if (hours)
- p = pcat (p, hours, 'H');
- if (minutes)
- p = pcat (p, minutes, 'M');
- if (secs)
- p = pcat (p, secs, 'S');
- }
-
- return buffer;
-}
-
-int
-isodiff_to_secs (char *str)
-{
- int value, time;
- int years, months, weeks, days, hours, minutes, seconds;
-
- value = years = months = weeks = days = hours = minutes = time = seconds = 0;
- if (*str != 'P')
- return 0;
-
- str++;
- while (*str){
- switch (*str){
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- value = value * 10 + (*str - '0');
- break;
- case 'Y':
- years = value; value = 0;
- break;
- case 'M':
- if (time)
- minutes = value;
- else
- months = value;
- value = 0;
- break;
- case 'W':
- weeks = value; value = 0;
- break;
- case 'D':
- days = value; value = 0;
- break;
- case 'T':
- value = 0; time = 1;
- break;
- case 'H':
- hours = value; value = 0;
- break;
- case 'S':
- seconds = value; value = 0;
- break;
- }
- str++;
- }
- return seconds + (minutes * 60) + (hours * 3600) +
- (days * 86400) + (weeks * 7 * 86400) +
- (months * 30 * 86400) + (years * 365 * 86400);
}
diff --git a/calendar/cal-util/timeutil.h b/calendar/cal-util/timeutil.h
index 6eaaf63cfb..b32e82d7ce 100644
--- a/calendar/cal-util/timeutil.h
+++ b/calendar/cal-util/timeutil.h
@@ -14,11 +14,7 @@
#include <ical.h>
-time_t time_from_start_duration (time_t start, char *duration);
char *isodate_from_time_t (time_t t);
-int get_time_t_hour (time_t t);
-int isodiff_to_secs (char *str);
-char *isodiff_from_secs (int secs);
time_t time_add_minutes (time_t time, int minutes);
time_t time_add_day (time_t time, int days);
@@ -27,12 +23,6 @@ time_t time_add_month (time_t time, int months);
time_t time_add_year (time_t time, int years);
-/* Returns pointer to a statically-allocated buffer with a string of the form
- * 3am, 4am, 12pm, 08h, 17h, etc.
- * The string is internationalized, hopefully correctly.
- */
-char *format_simple_hour (int hour, int use_am_pm);
-
/* Returns the number of days in the specified month. Years are full years (starting from year 1).
* Months are in [0, 11].
*/
@@ -43,8 +33,6 @@ int time_days_in_month (int year, int month);
*/
time_t time_from_day (int year, int month, int day);
-time_t time_day_hour (time_t t, int hour);
-
/* For the functions below, time ranges are considered to contain the start time, but not the end
* time.
*/
@@ -73,7 +61,6 @@ time_t time_week_end (time_t t);
time_t time_day_begin (time_t t);
time_t time_day_end (time_t t);
-time_t parse_date (char *str);
void print_time_t (time_t t);
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c
index 085111498b..087ec518bc 100644
--- a/calendar/gui/alarm-notify/alarm.c
+++ b/calendar/gui/alarm-notify/alarm.c
@@ -252,6 +252,8 @@ alarm_remove (gpointer alarm)
AlarmRecord *old_head;
GList *l;
+ g_return_if_fail (alarm != NULL);
+
ar = alarm;
l = g_list_find (alarms, ar);
@@ -277,7 +279,6 @@ alarm_remove (gpointer alarm)
/**
* alarm_init:
- * @void:
*
* Initializes the alarm notification system. This must be called near the
* beginning of the program.
diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c
index 085111498b..087ec518bc 100644
--- a/calendar/gui/alarm.c
+++ b/calendar/gui/alarm.c
@@ -252,6 +252,8 @@ alarm_remove (gpointer alarm)
AlarmRecord *old_head;
GList *l;
+ g_return_if_fail (alarm != NULL);
+
ar = alarm;
l = g_list_find (alarms, ar);
@@ -277,7 +279,6 @@ alarm_remove (gpointer alarm)
/**
* alarm_init:
- * @void:
*
* Initializes the alarm notification system. This must be called near the
* beginning of the program.
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index f34ac4518f..4f28031201 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -28,7 +28,6 @@
#include <gnome.h>
#include <glade/glade.h>
#include <bonobo.h>
-#include <bonobo/bonobo-control.h>
#include <glade/glade.h>
#include <liboaf/liboaf.h>
@@ -42,13 +41,13 @@
#include "e-itip-control.h"
static void
-init_bonobo (int *argc, char **argv)
+init_bonobo (int argc, char **argv)
{
- /* FIXME: VERSION instead of "0.0". */
- gnome_init_with_popt_table ("evolution-calendar", "0.0",
- *argc, argv, oaf_popt_options,
- 0, NULL);
- oaf_init (*argc, argv);
+ if (gnome_init_with_popt_table ("evolution-calendar", VERSION, argc, argv,
+ oaf_popt_options, 0, NULL) != 0)
+ g_error (_("Could not initialize GNOME"));
+
+ oaf_init (argc, argv);
if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
g_error (_("Could not initialize Bonobo"));
@@ -61,7 +60,7 @@ main (int argc, char **argv)
bindtextdomain(PACKAGE, EVOLUTION_LOCALEDIR);
textdomain(PACKAGE);
- init_bonobo (&argc, argv);
+ init_bonobo (argc, argv);
glade_gnome_init ();
alarm_init ();
e_cursors_init ();
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 85026a861a..4de8c8a4a2 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -958,24 +958,14 @@ compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t
continue;
case CAL_ALARM_TRIGGER_RELATIVE_START:
- dur = &trigger.u.rel_duration;
- dur_time = icaldurationtype_as_timet (*dur);
-
- if (dur->is_neg)
- *alarm_start = MIN (*alarm_start, start - dur_time);
- else
- *alarm_end = MAX (*alarm_end, start + dur_time);
-
- break;
-
case CAL_ALARM_TRIGGER_RELATIVE_END:
dur = &trigger.u.rel_duration;
dur_time = icaldurationtype_as_timet (*dur);
if (dur->is_neg)
- *alarm_start = MIN (*alarm_start, end - dur_time);
- else
*alarm_end = MAX (*alarm_end, end + dur_time);
+ else
+ *alarm_start = MIN (*alarm_start, start - dur_time);
break;