aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1999-05-26 07:00:09 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-05-26 07:00:09 +0800
commit089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9 (patch)
tree8a92ae9ee072d1d584d265e2fc1c386624923416 /calendar
parent9193140bcff4341412dd8e60a1e5647ebe122d6d (diff)
downloadgsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar.gz
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar.bz2
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar.lz
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar.xz
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.tar.zst
gsoc2013-evolution-089aee24eab2eaae8ecec6aedb3d3e82e0eeebf9.zip
Add some assertions here, to pin point the bug reported on gnome-list.
1999-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx> * gnome-cal.c (gnome_calendar_set_view): Add some assertions here, to pin point the bug reported on gnome-list. svn path=/trunk/; revision=943
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog3
-rw-r--r--calendar/gnome-cal.c46
-rw-r--r--calendar/gui/gnome-cal.c46
3 files changed, 91 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 18716dcf2a..9e6f34d745 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,8 @@
1999-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx>
+ * gnome-cal.c (gnome_calendar_set_view): Add some assertions here,
+ to pin point the bug reported on gnome-list.
+
* calobj.c (load_recurrence): Make intervals always exist. a 0
interval is wrong.
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index 72a411777c..d040a9b594 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -80,7 +80,12 @@ get_current_page (GnomeCalendar *gcal)
char *
gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
{
- GtkWidget *page = get_current_page (gcal);
+ GtkWidget *page;
+
+ g_return_val_if_fail (gcal != NULL, "dayview");
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), "dayview");
+
+ page = get_current_page (gcal);
if (page == gcal->day_view)
return "dayview";
@@ -97,10 +102,13 @@ gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
void
gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
{
- GtkWidget *current = get_current_page (gcal);
+ GtkWidget *current;
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
g_return_if_fail (new_time != -1);
+ current = get_current_page (gcal);
new_time = time_day_begin (new_time);
if (current == gcal->day_view)
@@ -145,18 +153,27 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction)
void
gnome_calendar_next (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_direction (gcal, 1);
}
void
gnome_calendar_previous (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_direction (gcal, -1);
}
void
gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), 0);
gnome_calendar_goto (gcal, time);
}
@@ -164,6 +181,9 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
void
gnome_calendar_goto_today (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_goto (gcal, time (NULL));
}
@@ -172,6 +192,11 @@ gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name)
{
int page = 0;
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (page_name != NULL);
+
+
if (strcmp (page_name, "dayview") == 0)
page = 0;
else if (strcmp (page_name, "weekview") == 0)
@@ -218,6 +243,10 @@ int
gnome_calendar_load (GnomeCalendar *gcal, char *file)
{
char *r;
+
+ g_return_val_if_fail (gcal != NULL, 0);
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
+ g_return_val_if_fail (file != NULL, 0);
if ((r = calendar_load (gcal->cal, file)) != NULL){
printf ("Error loading calendar: %s\n", r);
@@ -230,6 +259,10 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file)
void
gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (obj != NULL);
+
calendar_add_object (gcal->cal, obj);
gnome_calendar_update_all (gcal, obj, CHANGE_NEW);
}
@@ -237,6 +270,10 @@ gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
void
gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (obj != NULL);
+
calendar_remove_object (gcal->cal, obj);
gnome_calendar_update_all (gcal, obj, CHANGE_ALL);
}
@@ -445,6 +482,11 @@ gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal)
time_t month_begin, month_end;
struct tm tm;
+ g_return_if_fail (cal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (cal));
+ g_return_if_fail (gtk_cal != NULL);
+ g_return_if_fail (GTK_IS_CALENDAR (gtk_cal));
+
/* compute month_begin */
tm.tm_hour = 0;
tm.tm_min = 0;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 72a411777c..d040a9b594 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -80,7 +80,12 @@ get_current_page (GnomeCalendar *gcal)
char *
gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
{
- GtkWidget *page = get_current_page (gcal);
+ GtkWidget *page;
+
+ g_return_val_if_fail (gcal != NULL, "dayview");
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), "dayview");
+
+ page = get_current_page (gcal);
if (page == gcal->day_view)
return "dayview";
@@ -97,10 +102,13 @@ gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
void
gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
{
- GtkWidget *current = get_current_page (gcal);
+ GtkWidget *current;
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
g_return_if_fail (new_time != -1);
+ current = get_current_page (gcal);
new_time = time_day_begin (new_time);
if (current == gcal->day_view)
@@ -145,18 +153,27 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction)
void
gnome_calendar_next (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_direction (gcal, 1);
}
void
gnome_calendar_previous (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_direction (gcal, -1);
}
void
gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), 0);
gnome_calendar_goto (gcal, time);
}
@@ -164,6 +181,9 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
void
gnome_calendar_goto_today (GnomeCalendar *gcal)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
gnome_calendar_goto (gcal, time (NULL));
}
@@ -172,6 +192,11 @@ gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name)
{
int page = 0;
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (page_name != NULL);
+
+
if (strcmp (page_name, "dayview") == 0)
page = 0;
else if (strcmp (page_name, "weekview") == 0)
@@ -218,6 +243,10 @@ int
gnome_calendar_load (GnomeCalendar *gcal, char *file)
{
char *r;
+
+ g_return_val_if_fail (gcal != NULL, 0);
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
+ g_return_val_if_fail (file != NULL, 0);
if ((r = calendar_load (gcal->cal, file)) != NULL){
printf ("Error loading calendar: %s\n", r);
@@ -230,6 +259,10 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file)
void
gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (obj != NULL);
+
calendar_add_object (gcal->cal, obj);
gnome_calendar_update_all (gcal, obj, CHANGE_NEW);
}
@@ -237,6 +270,10 @@ gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
void
gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj)
{
+ g_return_if_fail (gcal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (obj != NULL);
+
calendar_remove_object (gcal->cal, obj);
gnome_calendar_update_all (gcal, obj, CHANGE_ALL);
}
@@ -445,6 +482,11 @@ gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal)
time_t month_begin, month_end;
struct tm tm;
+ g_return_if_fail (cal != NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (cal));
+ g_return_if_fail (gtk_cal != NULL);
+ g_return_if_fail (GTK_IS_CALENDAR (gtk_cal));
+
/* compute month_begin */
tm.tm_hour = 0;
tm.tm_min = 0;