Year view marks ranges of new dates (on update view). Recurrence iterator
Year view marks ranges of new dates (on update view). Recurrence iterator functions are here now (clap, clap, clap). Microsoft Outlook's days are counted. Miguel. svn path=/trunk/; revision=139
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
|
* calobj.c (ical_foreach): Define iterator routine.
|
||||||
|
|
||||||
1998-04-15 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx>
|
1998-04-15 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx>
|
||||||
|
|
||||||
* gncal-year-view.[hc]: Now using time_t for new and set.
|
* gncal-year-view.[hc]: Now using time_t for new and set.
|
||||||
|
@ -100,6 +100,12 @@ ical_object_destroy (iCalObject *ico)
|
|||||||
lfree_if_defined (ico->related);
|
lfree_if_defined (ico->related);
|
||||||
lfree_if_defined (ico->attach);
|
lfree_if_defined (ico->attach);
|
||||||
|
|
||||||
|
/* Alarms */
|
||||||
|
g_free (ico->dalarm.data);
|
||||||
|
g_free (ico->palarm.data);
|
||||||
|
g_free (ico->malarm.data);
|
||||||
|
g_free (ico->aalarm.data);
|
||||||
|
|
||||||
g_free (ico);
|
g_free (ico);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,3 +676,13 @@ ical_object_to_vobject (iCalObject *ical)
|
|||||||
/* FIXME: alarms */
|
/* FIXME: alarms */
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ical_foreach (GList *events, iCalObjectFn fn, void *closure)
|
||||||
|
{
|
||||||
|
for (; events; events = events->next){
|
||||||
|
iCalObject *ical = events->data;
|
||||||
|
|
||||||
|
(*fn) (ical, ical->dtstart, ical->dtend, closure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -153,11 +153,15 @@ typedef struct {
|
|||||||
int new;
|
int new;
|
||||||
} iCalObject;
|
} iCalObject;
|
||||||
|
|
||||||
iCalObject *ical_new (char *comment, char *organizer, char *summary);
|
/* The callback for the recurrence generator */
|
||||||
iCalObject *ical_object_new (void);
|
typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *);
|
||||||
void ical_object_destroy (iCalObject *ico);
|
|
||||||
|
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);
|
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
|
||||||
VObject *ical_object_to_vobject (iCalObject *ical);
|
VObject *ical_object_to_vobject (iCalObject *ical);
|
||||||
|
void ical_foreach (GList *events, iCalObjectFn fn, void *closure);
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ calendar_add_object (Calendar *cal, iCalObject *obj)
|
|||||||
switch (obj->type){
|
switch (obj->type){
|
||||||
case ICAL_EVENT:
|
case ICAL_EVENT:
|
||||||
cal->events = g_list_prepend (cal->events, obj);
|
cal->events = g_list_prepend (cal->events, obj);
|
||||||
|
if (obj->recur)
|
||||||
|
cal->recur = g_list_prepend (cal->recur, obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICAL_TODO:
|
case ICAL_TODO:
|
||||||
@ -60,6 +62,8 @@ calendar_remove_object (Calendar *cal, iCalObject *obj)
|
|||||||
switch (obj->type){
|
switch (obj->type){
|
||||||
case ICAL_EVENT:
|
case ICAL_EVENT:
|
||||||
cal->events = g_list_remove (cal->events, obj);
|
cal->events = g_list_remove (cal->events, obj);
|
||||||
|
if (obj->recur)
|
||||||
|
cal->recur = g_list_remove (cal->recur, obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICAL_TODO:
|
case ICAL_TODO:
|
||||||
@ -107,7 +111,7 @@ ice (time_t t)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
GList *
|
||||||
calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
|
calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
|
||||||
{
|
{
|
||||||
GList *new_events = 0;
|
GList *new_events = 0;
|
||||||
|
@ -6,13 +6,24 @@
|
|||||||
BEGIN_GNOME_DECLS
|
BEGIN_GNOME_DECLS
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* This calendar's title */
|
||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
|
/* backing store for this calendar object */
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
/* The list of events; todo's and journal entries */
|
||||||
GList *events;
|
GList *events;
|
||||||
GList *todo;
|
GList *todo;
|
||||||
GList *journal;
|
GList *journal;
|
||||||
|
|
||||||
|
/* Events that have a recurrence field are also present here */
|
||||||
|
GList *recur;
|
||||||
|
|
||||||
|
/* Time at which the calendar was created */
|
||||||
time_t created;
|
time_t created;
|
||||||
|
|
||||||
|
/* If the calendar was last modified */
|
||||||
int modified;
|
int modified;
|
||||||
void *temp;
|
void *temp;
|
||||||
} Calendar;
|
} Calendar;
|
||||||
@ -23,6 +34,7 @@ void calendar_add_object (Calendar *cal, iCalObject *obj);
|
|||||||
void calendar_remove_object (Calendar *cal, iCalObject *obj);
|
void calendar_remove_object (Calendar *cal, iCalObject *obj);
|
||||||
void calendar_destroy (Calendar *cal);
|
void calendar_destroy (Calendar *cal);
|
||||||
GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
|
GList *calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
gint calendar_compare_by_dtstart (gpointer a, gpointer b);
|
gint calendar_compare_by_dtstart (gpointer a, gpointer b);
|
||||||
|
@ -100,6 +100,12 @@ ical_object_destroy (iCalObject *ico)
|
|||||||
lfree_if_defined (ico->related);
|
lfree_if_defined (ico->related);
|
||||||
lfree_if_defined (ico->attach);
|
lfree_if_defined (ico->attach);
|
||||||
|
|
||||||
|
/* Alarms */
|
||||||
|
g_free (ico->dalarm.data);
|
||||||
|
g_free (ico->palarm.data);
|
||||||
|
g_free (ico->malarm.data);
|
||||||
|
g_free (ico->aalarm.data);
|
||||||
|
|
||||||
g_free (ico);
|
g_free (ico);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,3 +676,13 @@ ical_object_to_vobject (iCalObject *ical)
|
|||||||
/* FIXME: alarms */
|
/* FIXME: alarms */
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ical_foreach (GList *events, iCalObjectFn fn, void *closure)
|
||||||
|
{
|
||||||
|
for (; events; events = events->next){
|
||||||
|
iCalObject *ical = events->data;
|
||||||
|
|
||||||
|
(*fn) (ical, ical->dtstart, ical->dtend, closure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -153,11 +153,15 @@ typedef struct {
|
|||||||
int new;
|
int new;
|
||||||
} iCalObject;
|
} iCalObject;
|
||||||
|
|
||||||
iCalObject *ical_new (char *comment, char *organizer, char *summary);
|
/* The callback for the recurrence generator */
|
||||||
iCalObject *ical_object_new (void);
|
typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *);
|
||||||
void ical_object_destroy (iCalObject *ico);
|
|
||||||
|
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);
|
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
|
||||||
VObject *ical_object_to_vobject (iCalObject *ical);
|
VObject *ical_object_to_vobject (iCalObject *ical);
|
||||||
|
void ical_foreach (GList *events, iCalObjectFn fn, void *closure);
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ setup_widgets (GnomeCalendar *gcal)
|
|||||||
|
|
||||||
gcal->notebook = gtk_notebook_new ();
|
gcal->notebook = gtk_notebook_new ();
|
||||||
gcal->week_view = gncal_week_view_new (gcal, now);
|
gcal->week_view = gncal_week_view_new (gcal, now);
|
||||||
gcal->year_view = gncal_year_view_new (now);
|
gcal->year_view = gncal_year_view_new (gcal, now);
|
||||||
gcal->task_view = tasks_create (gcal);
|
gcal->task_view = tasks_create (gcal);
|
||||||
|
|
||||||
setup_day_view (gcal);
|
setup_day_view (gcal);
|
||||||
@ -190,8 +190,9 @@ gnome_calendar_new (char *title)
|
|||||||
static void
|
static void
|
||||||
gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
|
gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
|
||||||
{
|
{
|
||||||
gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view), object, flags);
|
gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view), object, flags);
|
||||||
gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
|
gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
|
||||||
|
gncal_year_view_update (GNCAL_YEAR_VIEW (cal->year_view), object, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -36,6 +36,8 @@ calendar_add_object (Calendar *cal, iCalObject *obj)
|
|||||||
switch (obj->type){
|
switch (obj->type){
|
||||||
case ICAL_EVENT:
|
case ICAL_EVENT:
|
||||||
cal->events = g_list_prepend (cal->events, obj);
|
cal->events = g_list_prepend (cal->events, obj);
|
||||||
|
if (obj->recur)
|
||||||
|
cal->recur = g_list_prepend (cal->recur, obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICAL_TODO:
|
case ICAL_TODO:
|
||||||
@ -60,6 +62,8 @@ calendar_remove_object (Calendar *cal, iCalObject *obj)
|
|||||||
switch (obj->type){
|
switch (obj->type){
|
||||||
case ICAL_EVENT:
|
case ICAL_EVENT:
|
||||||
cal->events = g_list_remove (cal->events, obj);
|
cal->events = g_list_remove (cal->events, obj);
|
||||||
|
if (obj->recur)
|
||||||
|
cal->recur = g_list_remove (cal->recur, obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICAL_TODO:
|
case ICAL_TODO:
|
||||||
@ -107,7 +111,7 @@ ice (time_t t)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
GList *
|
||||||
calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
|
calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
|
||||||
{
|
{
|
||||||
GList *new_events = 0;
|
GList *new_events = 0;
|
||||||
|
@ -6,13 +6,24 @@
|
|||||||
BEGIN_GNOME_DECLS
|
BEGIN_GNOME_DECLS
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* This calendar's title */
|
||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
|
/* backing store for this calendar object */
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
/* The list of events; todo's and journal entries */
|
||||||
GList *events;
|
GList *events;
|
||||||
GList *todo;
|
GList *todo;
|
||||||
GList *journal;
|
GList *journal;
|
||||||
|
|
||||||
|
/* Events that have a recurrence field are also present here */
|
||||||
|
GList *recur;
|
||||||
|
|
||||||
|
/* Time at which the calendar was created */
|
||||||
time_t created;
|
time_t created;
|
||||||
|
|
||||||
|
/* If the calendar was last modified */
|
||||||
int modified;
|
int modified;
|
||||||
void *temp;
|
void *temp;
|
||||||
} Calendar;
|
} Calendar;
|
||||||
@ -23,6 +34,7 @@ void calendar_add_object (Calendar *cal, iCalObject *obj);
|
|||||||
void calendar_remove_object (Calendar *cal, iCalObject *obj);
|
void calendar_remove_object (Calendar *cal, iCalObject *obj);
|
||||||
void calendar_destroy (Calendar *cal);
|
void calendar_destroy (Calendar *cal);
|
||||||
GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
|
GList *calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
|
||||||
gint calendar_compare_by_dtstart (gpointer a, gpointer b);
|
gint calendar_compare_by_dtstart (gpointer a, gpointer b);
|
||||||
|
@ -83,7 +83,7 @@ setup_widgets (GnomeCalendar *gcal)
|
|||||||
|
|
||||||
gcal->notebook = gtk_notebook_new ();
|
gcal->notebook = gtk_notebook_new ();
|
||||||
gcal->week_view = gncal_week_view_new (gcal, now);
|
gcal->week_view = gncal_week_view_new (gcal, now);
|
||||||
gcal->year_view = gncal_year_view_new (now);
|
gcal->year_view = gncal_year_view_new (gcal, now);
|
||||||
gcal->task_view = tasks_create (gcal);
|
gcal->task_view = tasks_create (gcal);
|
||||||
|
|
||||||
setup_day_view (gcal);
|
setup_day_view (gcal);
|
||||||
@ -190,8 +190,9 @@ gnome_calendar_new (char *title)
|
|||||||
static void
|
static void
|
||||||
gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
|
gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
|
||||||
{
|
{
|
||||||
gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view), object, flags);
|
gncal_full_day_update (GNCAL_FULL_DAY (cal->day_view), object, flags);
|
||||||
gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
|
gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
|
||||||
|
gncal_year_view_update (GNCAL_YEAR_VIEW (cal->year_view), object, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -72,7 +72,7 @@ gncal_year_view_init (GncalYearView *yview)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gncal_year_view_new (time_t date)
|
gncal_year_view_new (GnomeCalendar *calendar, time_t date)
|
||||||
{
|
{
|
||||||
struct tm my_tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
struct tm my_tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
char monthbuff[40];
|
char monthbuff[40];
|
||||||
@ -85,7 +85,8 @@ gncal_year_view_new (time_t date)
|
|||||||
|
|
||||||
tmptm = localtime(&date);
|
tmptm = localtime(&date);
|
||||||
yview->year = tmptm->tm_year;
|
yview->year = tmptm->tm_year;
|
||||||
my_tm.tm_mon = tmptm->tm_year;
|
yview->gcal = calendar;
|
||||||
|
my_tm.tm_year = tmptm->tm_year;
|
||||||
yview->year_label = gtk_label_new("");
|
yview->year_label = gtk_label_new("");
|
||||||
gtk_table_attach (GTK_TABLE (yview),
|
gtk_table_attach (GTK_TABLE (yview),
|
||||||
GTK_WIDGET (yview->year_label),
|
GTK_WIDGET (yview->year_label),
|
||||||
@ -151,11 +152,51 @@ void gncal_year_view_set (GncalYearView *yview, time_t date)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void
|
static void
|
||||||
gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
|
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
||||||
{
|
{
|
||||||
g_return_if_fail (wview != NULL);
|
GncalYearView *yview = (GncalYearView *) closure;
|
||||||
g_return_if_fail (GNCAL_IS_YEAR_VIEW (wview));
|
struct tm *tm_s;
|
||||||
|
int days, day;
|
||||||
|
|
||||||
|
tm_s = localtime (&start);
|
||||||
|
days = difftime (end, start) / (60*60*24);
|
||||||
|
|
||||||
|
for (day = 0; day <= days; day++){
|
||||||
|
time_t new = mktime (tm_s);
|
||||||
|
struct tm *tm_day;
|
||||||
|
|
||||||
|
tm_day = localtime (&new);
|
||||||
|
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day->tm_mon]),
|
||||||
|
tm_day->tm_mday);
|
||||||
|
tm_s->tm_mday++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gncal_year_view_update (GncalYearView *yview, iCalObject *ico, int flags)
|
||||||
|
{
|
||||||
|
g_return_if_fail (yview != NULL);
|
||||||
|
g_return_if_fail (GNCAL_IS_YEAR_VIEW (yview));
|
||||||
|
|
||||||
|
/* If only the summary changed, we dont care */
|
||||||
|
if ((flags & CHANGE_SUMMARY) == flags)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (flags & CHANGE_NEW){
|
||||||
|
time_t year_begin, year_end;
|
||||||
|
GList *l, *nl;
|
||||||
|
|
||||||
|
year_begin = time_year_begin (yview->year);
|
||||||
|
year_end = time_year_end (yview->year);
|
||||||
|
|
||||||
|
l = g_list_append (NULL, ico);
|
||||||
|
nl = calendar_get_objects_in_range (l, year_begin, year_end, NULL);
|
||||||
|
if (nl){
|
||||||
|
ical_foreach (nl, year_view_mark_day, yview);
|
||||||
|
g_list_free (nl);
|
||||||
|
}
|
||||||
|
g_list_free (l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update (wview, TRUE, ico, flags);
|
|
||||||
}*/
|
|
||||||
|
@ -33,7 +33,8 @@ typedef struct _GncalYearViewClass GncalYearViewClass;
|
|||||||
struct _GncalYearView {
|
struct _GncalYearView {
|
||||||
GtkTable table;
|
GtkTable table;
|
||||||
|
|
||||||
GtkWidget *calendar[12]; /* one calendar per month */
|
GnomeCalendar *gcal; /* The calendar we are associated to */
|
||||||
|
GtkWidget *calendar[12]; /* one calendar per month */
|
||||||
guint handler[12]; /* for (un)blocking the calendars */
|
guint handler[12]; /* for (un)blocking the calendars */
|
||||||
|
|
||||||
GtkWidget *year_label;
|
GtkWidget *year_label;
|
||||||
@ -46,9 +47,8 @@ struct _GncalYearViewClass {
|
|||||||
|
|
||||||
|
|
||||||
guint gncal_year_view_get_type (void);
|
guint gncal_year_view_get_type (void);
|
||||||
GtkWidget *gncal_year_view_new (time_t date);
|
GtkWidget *gncal_year_view_new (GnomeCalendar *calendar, time_t date);
|
||||||
|
void gncal_year_view_set (GncalYearView *yview, time_t date);
|
||||||
void gncal_year_view_set (GncalYearView *yview, time_t date);
|
|
||||||
|
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
@ -100,6 +100,12 @@ ical_object_destroy (iCalObject *ico)
|
|||||||
lfree_if_defined (ico->related);
|
lfree_if_defined (ico->related);
|
||||||
lfree_if_defined (ico->attach);
|
lfree_if_defined (ico->attach);
|
||||||
|
|
||||||
|
/* Alarms */
|
||||||
|
g_free (ico->dalarm.data);
|
||||||
|
g_free (ico->palarm.data);
|
||||||
|
g_free (ico->malarm.data);
|
||||||
|
g_free (ico->aalarm.data);
|
||||||
|
|
||||||
g_free (ico);
|
g_free (ico);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,3 +676,13 @@ ical_object_to_vobject (iCalObject *ical)
|
|||||||
/* FIXME: alarms */
|
/* FIXME: alarms */
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ical_foreach (GList *events, iCalObjectFn fn, void *closure)
|
||||||
|
{
|
||||||
|
for (; events; events = events->next){
|
||||||
|
iCalObject *ical = events->data;
|
||||||
|
|
||||||
|
(*fn) (ical, ical->dtstart, ical->dtend, closure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -153,11 +153,15 @@ typedef struct {
|
|||||||
int new;
|
int new;
|
||||||
} iCalObject;
|
} iCalObject;
|
||||||
|
|
||||||
iCalObject *ical_new (char *comment, char *organizer, char *summary);
|
/* The callback for the recurrence generator */
|
||||||
iCalObject *ical_object_new (void);
|
typedef void (*iCalObjectFn)(iCalObject *, time_t, time_t, void *);
|
||||||
void ical_object_destroy (iCalObject *ico);
|
|
||||||
|
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);
|
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
|
||||||
VObject *ical_object_to_vobject (iCalObject *ical);
|
VObject *ical_object_to_vobject (iCalObject *ical);
|
||||||
|
void ical_foreach (GList *events, iCalObjectFn fn, void *closure);
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
|
||||||
|
@ -165,3 +165,38 @@ time_end_of_day (time_t t)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time_t
|
||||||
|
time_year_begin (int year)
|
||||||
|
{
|
||||||
|
struct tm tm;
|
||||||
|
time_t retval;
|
||||||
|
|
||||||
|
tm.tm_hour = 0;
|
||||||
|
tm.tm_min = 0;
|
||||||
|
tm.tm_sec = 0;
|
||||||
|
tm.tm_year = year;
|
||||||
|
tm.tm_mon = 0;
|
||||||
|
tm.tm_mday = 1;
|
||||||
|
tm.tm_isdst = -1;
|
||||||
|
|
||||||
|
retval = mktime (&tm);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t
|
||||||
|
time_year_end (int year)
|
||||||
|
{
|
||||||
|
struct tm tm;
|
||||||
|
time_t retval;
|
||||||
|
|
||||||
|
tm.tm_hour = 23;
|
||||||
|
tm.tm_min = 59;
|
||||||
|
tm.tm_sec = 59;
|
||||||
|
tm.tm_year = year;
|
||||||
|
tm.tm_mon = 11;
|
||||||
|
tm.tm_mday = 31;
|
||||||
|
tm.tm_isdst = -1;
|
||||||
|
|
||||||
|
retval = mktime (&tm);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
@ -72,7 +72,7 @@ gncal_year_view_init (GncalYearView *yview)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gncal_year_view_new (time_t date)
|
gncal_year_view_new (GnomeCalendar *calendar, time_t date)
|
||||||
{
|
{
|
||||||
struct tm my_tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
struct tm my_tm = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
char monthbuff[40];
|
char monthbuff[40];
|
||||||
@ -85,7 +85,8 @@ gncal_year_view_new (time_t date)
|
|||||||
|
|
||||||
tmptm = localtime(&date);
|
tmptm = localtime(&date);
|
||||||
yview->year = tmptm->tm_year;
|
yview->year = tmptm->tm_year;
|
||||||
my_tm.tm_mon = tmptm->tm_year;
|
yview->gcal = calendar;
|
||||||
|
my_tm.tm_year = tmptm->tm_year;
|
||||||
yview->year_label = gtk_label_new("");
|
yview->year_label = gtk_label_new("");
|
||||||
gtk_table_attach (GTK_TABLE (yview),
|
gtk_table_attach (GTK_TABLE (yview),
|
||||||
GTK_WIDGET (yview->year_label),
|
GTK_WIDGET (yview->year_label),
|
||||||
@ -151,11 +152,51 @@ void gncal_year_view_set (GncalYearView *yview, time_t date)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void
|
static void
|
||||||
gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
|
year_view_mark_day (iCalObject *ical, time_t start, time_t end, void *closure)
|
||||||
{
|
{
|
||||||
g_return_if_fail (wview != NULL);
|
GncalYearView *yview = (GncalYearView *) closure;
|
||||||
g_return_if_fail (GNCAL_IS_YEAR_VIEW (wview));
|
struct tm *tm_s;
|
||||||
|
int days, day;
|
||||||
|
|
||||||
|
tm_s = localtime (&start);
|
||||||
|
days = difftime (end, start) / (60*60*24);
|
||||||
|
|
||||||
|
for (day = 0; day <= days; day++){
|
||||||
|
time_t new = mktime (tm_s);
|
||||||
|
struct tm *tm_day;
|
||||||
|
|
||||||
|
tm_day = localtime (&new);
|
||||||
|
gtk_calendar_mark_day (GTK_CALENDAR (yview->calendar [tm_day->tm_mon]),
|
||||||
|
tm_day->tm_mday);
|
||||||
|
tm_s->tm_mday++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gncal_year_view_update (GncalYearView *yview, iCalObject *ico, int flags)
|
||||||
|
{
|
||||||
|
g_return_if_fail (yview != NULL);
|
||||||
|
g_return_if_fail (GNCAL_IS_YEAR_VIEW (yview));
|
||||||
|
|
||||||
|
/* If only the summary changed, we dont care */
|
||||||
|
if ((flags & CHANGE_SUMMARY) == flags)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (flags & CHANGE_NEW){
|
||||||
|
time_t year_begin, year_end;
|
||||||
|
GList *l, *nl;
|
||||||
|
|
||||||
|
year_begin = time_year_begin (yview->year);
|
||||||
|
year_end = time_year_end (yview->year);
|
||||||
|
|
||||||
|
l = g_list_append (NULL, ico);
|
||||||
|
nl = calendar_get_objects_in_range (l, year_begin, year_end, NULL);
|
||||||
|
if (nl){
|
||||||
|
ical_foreach (nl, year_view_mark_day, yview);
|
||||||
|
g_list_free (nl);
|
||||||
|
}
|
||||||
|
g_list_free (l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update (wview, TRUE, ico, flags);
|
|
||||||
}*/
|
|
||||||
|
@ -33,7 +33,8 @@ typedef struct _GncalYearViewClass GncalYearViewClass;
|
|||||||
struct _GncalYearView {
|
struct _GncalYearView {
|
||||||
GtkTable table;
|
GtkTable table;
|
||||||
|
|
||||||
GtkWidget *calendar[12]; /* one calendar per month */
|
GnomeCalendar *gcal; /* The calendar we are associated to */
|
||||||
|
GtkWidget *calendar[12]; /* one calendar per month */
|
||||||
guint handler[12]; /* for (un)blocking the calendars */
|
guint handler[12]; /* for (un)blocking the calendars */
|
||||||
|
|
||||||
GtkWidget *year_label;
|
GtkWidget *year_label;
|
||||||
@ -46,9 +47,8 @@ struct _GncalYearViewClass {
|
|||||||
|
|
||||||
|
|
||||||
guint gncal_year_view_get_type (void);
|
guint gncal_year_view_get_type (void);
|
||||||
GtkWidget *gncal_year_view_new (time_t date);
|
GtkWidget *gncal_year_view_new (GnomeCalendar *calendar, time_t date);
|
||||||
|
void gncal_year_view_set (GncalYearView *yview, time_t date);
|
||||||
void gncal_year_view_set (GncalYearView *yview, time_t date);
|
|
||||||
|
|
||||||
|
|
||||||
END_GNOME_DECLS
|
END_GNOME_DECLS
|
||||||
|
Reference in New Issue
Block a user