aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/mark.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-08-16 04:55:34 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-08-16 04:55:34 +0800
commit6f0b054a1c5b55f9d965c9e0a585bb51281eae4e (patch)
treeafd2956ff19336cc2c4ec7319df2eff84d30fe6a /calendar/gui/mark.c
parent68d735186505c598fd021fde44c2735263d4591d (diff)
downloadgsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar.gz
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar.bz2
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar.lz
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar.xz
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.tar.zst
gsoc2013-evolution-6f0b054a1c5b55f9d965c9e0a585bb51281eae4e.zip
Callback used to mark every event in a month. (mark_month_item): Use
2000-08-15 JP Rosevear <jpr@helixcode.com> * gui/mark.c (mark_month_item_cb): Callback used to mark every event in a month. (mark_month_item): Use cal_client_generate_instances with above callback svn path=/trunk/; revision=4848
Diffstat (limited to 'calendar/gui/mark.c')
-rw-r--r--calendar/gui/mark.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/calendar/gui/mark.c b/calendar/gui/mark.c
index ea83845b2a..383eca5196 100644
--- a/calendar/gui/mark.c
+++ b/calendar/gui/mark.c
@@ -25,6 +25,14 @@
#include "calendar-commands.h"
#include "mark.h"
+/* Closure data */
+struct minfo
+{
+ GnomeMonthItem *mitem;
+ time_t start;
+ time_t end;
+};
+
/* Frees the specified data when an object is destroyed */
@@ -115,38 +123,35 @@ mark_event_in_month (GnomeMonthItem *mitem, time_t start, time_t end)
}
}
+static gboolean
+mark_month_item_cb (CalComponent *comp, time_t istart, time_t iend, gpointer data)
+{
+ struct minfo *mi = (struct minfo *)data;
+
+ mark_event_in_month (mi->mitem, MAX (istart, mi->start), MIN (iend, mi->end));
+
+ return TRUE;
+}
+
void
mark_month_item (GnomeMonthItem *mitem, GnomeCalendar *gcal)
{
- time_t month_begin, month_end;
- GList *events;
- GList *l;
+ struct minfo mi;
g_return_if_fail (mitem != NULL);
g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- month_begin = time_month_begin (time_from_day (mitem->year, mitem->month, 1));
- month_end = time_month_end (month_begin);
-
- events = cal_client_get_events_in_range (gcal->client, month_begin, month_end);
-
- for (l = events; l; l = l->next) {
- CalObjInstance *coi;
-
- coi = l->data;
-
- /* We clip the event's start and end times to the month's limits */
-
- mark_event_in_month (mitem,
- MAX (coi->start, month_begin),
- MIN (coi->end, month_end));
- }
-
- cal_obj_instance_list_free (events);
+ mi.mitem = mitem;
+ mi.start = time_month_begin (time_from_day (mitem->year, mitem->month, 1));
+ mi.end = time_month_end (mi.start);
+
+ cal_client_generate_instances (gcal->client, CALOBJ_TYPE_EVENT, mi.start, mi.end,
+ mark_month_item_cb, &mi);
}
+
void
mark_month_item_index (GnomeMonthItem *mitem, int index, GetColorFunc func, gpointer func_data)
{
@@ -287,3 +292,6 @@ default_color_func (ColorProp propnum, gpointer data)
{
return color_spec_from_prop (propnum);
}
+
+
+