diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-17 13:08:55 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-17 13:08:55 +0800 |
commit | ad0347d16bfd10f5f6b0783d7030cac420c4362a (patch) | |
tree | 4b0a09d1b133334ce8fee945e8442417ed1268b5 /calendar | |
parent | 541c3a7a73e084b5ebd82aae7c3fc1f3ba4f0b72 (diff) | |
download | gsoc2013-evolution-ad0347d16bfd10f5f6b0783d7030cac420c4362a.tar.gz gsoc2013-evolution-ad0347d16bfd10f5f6b0783d7030cac420c4362a.tar.zst gsoc2013-evolution-ad0347d16bfd10f5f6b0783d7030cac420c4362a.zip |
Remove deadly excessive abuse of encapsulation -mig
svn path=/trunk/; revision=147
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/cal-util/calobj.c | 16 | ||||
-rw-r--r-- | calendar/cal-util/calobj.h | 7 | ||||
-rw-r--r-- | calendar/calendar.c | 4 | ||||
-rw-r--r-- | calendar/calendar.h | 2 | ||||
-rw-r--r-- | calendar/calobj.c | 16 | ||||
-rw-r--r-- | calendar/calobj.h | 7 | ||||
-rw-r--r-- | calendar/eventedit.c | 4 | ||||
-rw-r--r-- | calendar/gncal-full-day.c | 5 | ||||
-rw-r--r-- | calendar/gui/calendar.c | 4 | ||||
-rw-r--r-- | calendar/gui/calendar.h | 2 | ||||
-rw-r--r-- | calendar/gui/eventedit.c | 4 | ||||
-rw-r--r-- | calendar/gui/gncal-full-day.c | 5 | ||||
-rw-r--r-- | calendar/pcs/calobj.c | 16 | ||||
-rw-r--r-- | calendar/pcs/calobj.h | 7 |
14 files changed, 43 insertions, 56 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 89bfc94540..c2fadad4d7 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -680,7 +680,7 @@ ical_object_to_vobject (iCalObject *ical) } void -ical_foreach (GList *events, iCalObjectFn fn, void *closure) +ical_foreach (GList *events, calendarfn fn, void *closure) { for (; events; events = events->next){ iCalObject *ical = events->data; @@ -690,13 +690,13 @@ ical_foreach (GList *events, iCalObjectFn fn, void *closure) } void -ical_object_set_user_data (iCalObject *ical, void *user_data) +ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure) { - ical->user_data = user_data; -} + if (!ico->recur){ + if ((start <= ico->dtstart) && (ico->dtend <= end)) + (*cb)(ico, ico->dtstart, ico->dtend, closure); + return; + } -void * -ical_object_get_user_data (iCalObject *ical) -{ - return ical->user_data; + /* The event has a recurrence rule */ } diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h index 9b69eefd5f..ab9d061956 100644 --- a/calendar/cal-util/calobj.h +++ b/calendar/cal-util/calobj.h @@ -157,16 +157,15 @@ typedef struct { } iCalObject; /* The callback for the recurrence generator */ -typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *); +typedef void (*calendarfn)(iCalObject *, time_t, time_t, void *); iCalObject *ical_new (char *comment, char *organizer, char *summary); iCalObject *ical_object_new (void); void ical_object_destroy (iCalObject *ico); iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name); VObject *ical_object_to_vobject (iCalObject *ical); -void ical_foreach (GList *events, iCalObjectFn fn, void *closure); -void ical_object_set_user_data (iCalObject *ical, void *user_data); -void *ical_object_get_user_data (iCalObject *ical); +void ical_foreach (GList *events, calendarfn fn, void *closure); +void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure); END_GNOME_DECLS diff --git a/calendar/calendar.c b/calendar/calendar.c index 8ad0208ac5..7b5f50c46f 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -32,7 +32,6 @@ calendar_new (char *title) void calendar_add_object (Calendar *cal, iCalObject *obj) { - printf ("Adding object\n"); switch (obj->type){ case ICAL_EVENT: cal->events = g_list_prepend (cal->events, obj); @@ -117,8 +116,7 @@ calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarf for (; objects; objects = objects->next){ iCalObject *object = objects->data; - if ((start <= object->dtstart) && (object->dtend <= end)) - (*cb)(object, object->dtstart, object->dtend, closure); + ical_object_generate_events (object, start, end, cb, closure); } } diff --git a/calendar/calendar.h b/calendar/calendar.h index 95c92e7fa8..9fbb6088a4 100644 --- a/calendar/calendar.h +++ b/calendar/calendar.h @@ -37,8 +37,6 @@ typedef struct { iCalObject *ico; } CalendarObject; -typedef void (*calendarfn)(iCalObject *obj, time_t start, time_t end, void *closure); - Calendar *calendar_new (char *title); void calendar_load (Calendar *cal, char *fname); void calendar_add_object (Calendar *cal, iCalObject *obj); diff --git a/calendar/calobj.c b/calendar/calobj.c index 89bfc94540..c2fadad4d7 100644 --- a/calendar/calobj.c +++ b/calendar/calobj.c @@ -680,7 +680,7 @@ ical_object_to_vobject (iCalObject *ical) } void -ical_foreach (GList *events, iCalObjectFn fn, void *closure) +ical_foreach (GList *events, calendarfn fn, void *closure) { for (; events; events = events->next){ iCalObject *ical = events->data; @@ -690,13 +690,13 @@ ical_foreach (GList *events, iCalObjectFn fn, void *closure) } void -ical_object_set_user_data (iCalObject *ical, void *user_data) +ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure) { - ical->user_data = user_data; -} + if (!ico->recur){ + if ((start <= ico->dtstart) && (ico->dtend <= end)) + (*cb)(ico, ico->dtstart, ico->dtend, closure); + return; + } -void * -ical_object_get_user_data (iCalObject *ical) -{ - return ical->user_data; + /* The event has a recurrence rule */ } diff --git a/calendar/calobj.h b/calendar/calobj.h index 9b69eefd5f..ab9d061956 100644 --- a/calendar/calobj.h +++ b/calendar/calobj.h @@ -157,16 +157,15 @@ typedef struct { } iCalObject; /* The callback for the recurrence generator */ -typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *); +typedef void (*calendarfn)(iCalObject *, time_t, time_t, void *); iCalObject *ical_new (char *comment, char *organizer, char *summary); iCalObject *ical_object_new (void); void ical_object_destroy (iCalObject *ico); iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name); VObject *ical_object_to_vobject (iCalObject *ical); -void ical_foreach (GList *events, iCalObjectFn fn, void *closure); -void ical_object_set_user_data (iCalObject *ical, void *user_data); -void *ical_object_get_user_data (iCalObject *ical); +void ical_foreach (GList *events, calendarfn fn, void *closure); +void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure); END_GNOME_DECLS diff --git a/calendar/eventedit.c b/calendar/eventedit.c index be308284aa..ff36d77507 100644 --- a/calendar/eventedit.c +++ b/calendar/eventedit.c @@ -971,7 +971,7 @@ event_editor_destroy (GtkObject *object) ee = EVENT_EDITOR (object); if (ee->ical) - ical_object_set_user_data (ee->ical, NULL); /* we are no longer editing it */ + ee->ical->user_data = NULL;/* we are no longer editing it */ } GtkWidget * @@ -991,7 +991,7 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) ical->new = 1; } - ical_object_set_user_data (ical, ee); /* so that the world can know we are editing it */ + ical->user_data = ee; /* so that the world can know we are editing it */ ee->ical = ical; ee->gnome_cal = gcal; diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index 028e3657b7..b048ba9de7 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -110,7 +110,7 @@ static void range_activated (GncalFullDay *fullday); static GtkContainerClass *parent_class; -static fullday_signals[LAST_SIGNAL] = { 0 }; +static int fullday_signals[LAST_SIGNAL] = { 0 }; static void @@ -390,7 +390,7 @@ child_popup_menu (GncalFullDay *fullday, Child *child, guint32 event_time) child_items[1].data = child; child_items[3].data = fullday; - sensitive = (ical_object_get_user_data (child->ico) == NULL); + sensitive = (child->ico->user_data == NULL); child_items[0].sensitive = sensitive; child_items[1].sensitive = sensitive; @@ -1892,7 +1892,6 @@ void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags) { GList *children; - GList *l_events, *events; Child *child; g_return_if_fail (fullday != NULL); diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index 8ad0208ac5..7b5f50c46f 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -32,7 +32,6 @@ calendar_new (char *title) void calendar_add_object (Calendar *cal, iCalObject *obj) { - printf ("Adding object\n"); switch (obj->type){ case ICAL_EVENT: cal->events = g_list_prepend (cal->events, obj); @@ -117,8 +116,7 @@ calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarf for (; objects; objects = objects->next){ iCalObject *object = objects->data; - if ((start <= object->dtstart) && (object->dtend <= end)) - (*cb)(object, object->dtstart, object->dtend, closure); + ical_object_generate_events (object, start, end, cb, closure); } } diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h index 95c92e7fa8..9fbb6088a4 100644 --- a/calendar/gui/calendar.h +++ b/calendar/gui/calendar.h @@ -37,8 +37,6 @@ typedef struct { iCalObject *ico; } CalendarObject; -typedef void (*calendarfn)(iCalObject *obj, time_t start, time_t end, void *closure); - Calendar *calendar_new (char *title); void calendar_load (Calendar *cal, char *fname); void calendar_add_object (Calendar *cal, iCalObject *obj); diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index be308284aa..ff36d77507 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -971,7 +971,7 @@ event_editor_destroy (GtkObject *object) ee = EVENT_EDITOR (object); if (ee->ical) - ical_object_set_user_data (ee->ical, NULL); /* we are no longer editing it */ + ee->ical->user_data = NULL;/* we are no longer editing it */ } GtkWidget * @@ -991,7 +991,7 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) ical->new = 1; } - ical_object_set_user_data (ical, ee); /* so that the world can know we are editing it */ + ical->user_data = ee; /* so that the world can know we are editing it */ ee->ical = ical; ee->gnome_cal = gcal; diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c index 028e3657b7..b048ba9de7 100644 --- a/calendar/gui/gncal-full-day.c +++ b/calendar/gui/gncal-full-day.c @@ -110,7 +110,7 @@ static void range_activated (GncalFullDay *fullday); static GtkContainerClass *parent_class; -static fullday_signals[LAST_SIGNAL] = { 0 }; +static int fullday_signals[LAST_SIGNAL] = { 0 }; static void @@ -390,7 +390,7 @@ child_popup_menu (GncalFullDay *fullday, Child *child, guint32 event_time) child_items[1].data = child; child_items[3].data = fullday; - sensitive = (ical_object_get_user_data (child->ico) == NULL); + sensitive = (child->ico->user_data == NULL); child_items[0].sensitive = sensitive; child_items[1].sensitive = sensitive; @@ -1892,7 +1892,6 @@ void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags) { GList *children; - GList *l_events, *events; Child *child; g_return_if_fail (fullday != NULL); diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c index 89bfc94540..c2fadad4d7 100644 --- a/calendar/pcs/calobj.c +++ b/calendar/pcs/calobj.c @@ -680,7 +680,7 @@ ical_object_to_vobject (iCalObject *ical) } void -ical_foreach (GList *events, iCalObjectFn fn, void *closure) +ical_foreach (GList *events, calendarfn fn, void *closure) { for (; events; events = events->next){ iCalObject *ical = events->data; @@ -690,13 +690,13 @@ ical_foreach (GList *events, iCalObjectFn fn, void *closure) } void -ical_object_set_user_data (iCalObject *ical, void *user_data) +ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure) { - ical->user_data = user_data; -} + if (!ico->recur){ + if ((start <= ico->dtstart) && (ico->dtend <= end)) + (*cb)(ico, ico->dtstart, ico->dtend, closure); + return; + } -void * -ical_object_get_user_data (iCalObject *ical) -{ - return ical->user_data; + /* The event has a recurrence rule */ } diff --git a/calendar/pcs/calobj.h b/calendar/pcs/calobj.h index 9b69eefd5f..ab9d061956 100644 --- a/calendar/pcs/calobj.h +++ b/calendar/pcs/calobj.h @@ -157,16 +157,15 @@ typedef struct { } iCalObject; /* The callback for the recurrence generator */ -typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *); +typedef void (*calendarfn)(iCalObject *, time_t, time_t, void *); iCalObject *ical_new (char *comment, char *organizer, char *summary); iCalObject *ical_object_new (void); void ical_object_destroy (iCalObject *ico); iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name); VObject *ical_object_to_vobject (iCalObject *ical); -void ical_foreach (GList *events, iCalObjectFn fn, void *closure); -void ical_object_set_user_data (iCalObject *ical, void *user_data); -void *ical_object_get_user_data (iCalObject *ical); +void ical_foreach (GList *events, calendarfn fn, void *closure); +void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure); END_GNOME_DECLS |