diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/Makefile.am | 14 | ||||
-rw-r--r-- | calendar/gui/calendar.c | 31 | ||||
-rw-r--r-- | calendar/gui/calendar.h | 10 | ||||
-rw-r--r-- | calendar/gui/eventedit.c | 3 | ||||
-rw-r--r-- | calendar/gui/gncal-day-view.c | 17 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 4 | ||||
-rw-r--r-- | calendar/gui/main.c | 2 |
7 files changed, 67 insertions, 14 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 8fab42d57c..1762bc0bf7 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -20,11 +20,19 @@ endif bin_PROGRAMS = gnomecal tlacuache $(extra_pilot_bins) +#if HAVE_LIBICAL +ICAL_INCLUDEDIR = -I../libical/src/libical +ICAL_SOURCES = icalendar.c +ICAL_LINK_FLAGS = ../libical/src/libical/libical.a +#endif + + INCLUDES = \ -I$(includedir) \ $(GNOME_INCLUDEDIR) \ $(GNOME_CONDUIT_INCLUDEDIR) \ $(PISOCK_INCLUDEDIR) \ + $(ICAL_INCLUDEDIR) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" GNOMECAL_CORBA_GENERATED = \ @@ -110,7 +118,8 @@ gnomecal_SOURCES = \ view-utils.h \ view-utils.c \ year-view.c \ - year-view.h + year-view.h \ + $(ICAL_SOURCES) calendar_pilot_sync_SOURCES = \ GnomeCal-common.c \ @@ -148,7 +157,8 @@ tlacuache_SOURCES = \ LINK_FLAGS = \ $(BONOBO_VFS_GNOME_LIBS) \ $(INTLLIBS) \ - ../libversit/libversit.la + ../libversit/libversit.la \ + $(ICAL_LINK_FLAGS) tlacuache_INCLUDES = \ $(INCLUDES) \ diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index db31ba016b..0a690f344b 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -40,6 +40,10 @@ calendar_new (char *title,CalendarNewOptions options) cal = g_new0 (Calendar, 1); cal->title = g_strdup (title); + if (options & CALENDAR_USE_ICAL) + cal->format = CAL_ICAL; + else + cal->format = CAL_VCAL; if ((calendar_day_begin == 0) || (calendar_day_end == 0)) calendar_set_day (); @@ -315,18 +319,31 @@ calendar_load (Calendar *cal, char *fname) } cal->filename = g_strdup (fname); - vcal = Parse_MIME_FromFileName (fname); - if (!vcal) - return "Could not load the calendar"; stat (fname, &s); cal->file_time = s.st_mtime; calendar_set_day (); - - calendar_load_from_vobject (cal, vcal); - cleanVObject (vcal); - cleanStrTbl (); + + switch (cal->format) { + case CAL_VCAL: + vcal = Parse_MIME_FromFileName (fname); + if (!vcal) + return "Could not load the calendar"; + calendar_load_from_vobject (cal, vcal); + cleanVObject (vcal); + cleanStrTbl (); + break; +#ifdef HAVE_LIBICAL + hi; + case CAL_ICAL: + icalendar_calendar_load (cal, fname); + break; +#endif + default: + return "Unknown calendar format"; + } + return NULL; } diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h index 858f0151ca..452281ebd1 100644 --- a/calendar/gui/calendar.h +++ b/calendar/gui/calendar.h @@ -5,17 +5,24 @@ BEGIN_GNOME_DECLS +typedef enum { + CAL_VCAL, + CAL_ICAL +} CalendarFormat; + typedef struct { /* This calendar's title */ char *title; /* backing store for this calendar object */ char *filename; + CalendarFormat format; /* The list of events; todo's and journal entries */ GList *events; GList *todo; GList *journal; + GList *timezones; /* required for iCalendar */ GHashTable *event_hash; @@ -43,7 +50,8 @@ typedef struct { typedef enum { CALENDAR_INIT_NIL = 0, - CALENDAR_INIT_ALARMS = 1 << 0 + CALENDAR_INIT_ALARMS = 1 << 0, + CALENDAR_USE_ICAL = 1 << 1 } CalendarNewOptions; Calendar *calendar_new (char *title,CalendarNewOptions options); diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index 31fbf11225..a3ec95da07 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -826,7 +826,8 @@ ee_init_general_page (EventEditor *ee) l = gtk_label_new (_("Owner:")); gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0); - ee->general_owner = gtk_label_new (ee->ical->organizer ? ee->ical->organizer : _("?")); + ee->general_owner = gtk_label_new (ee->ical->organizer->addr ? + ee->ical->organizer->addr : _("?")); gtk_misc_set_alignment (GTK_MISC (ee->general_owner), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbox), ee->general_owner, TRUE, TRUE, 4); diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c index eafd237029..22a0859069 100644 --- a/calendar/gui/gncal-day-view.c +++ b/calendar/gui/gncal-day-view.c @@ -13,7 +13,7 @@ #include "main.h" #include "eventedit.h" #include "popup-menu.h" - +#include "quick-view.h" #define TEXT_BORDER 2 #define MIN_INFO_WIDTH 50 @@ -152,6 +152,21 @@ gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event) if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) gnome_calendar_dayjump (dayview->calendar, dayview->lower); +#if 0 + else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { + time_t day_begin_time, day_end_time; + GList *list; + GtkWidget *qv; + char date_str [256]; + + strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), + localtime (&dayview->lower)); + qv = quick_view_new (dayview->calendar, date_str, dayview->events); + quick_view_do_popup (QUICK_VIEW (qv), event); + gtk_widget_destroy (qv); + } +#endif + return TRUE; } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index d54c4e98df..0e3c475fdf 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -228,7 +228,7 @@ gnome_calendar_new (char *title) gtk_window_set_title(GTK_WINDOW(retval), title); gcal->current_display = time_day_begin (time (NULL)); - gcal->cal = calendar_new (title,CALENDAR_INIT_ALARMS); + gcal->cal = calendar_new (title, CALENDAR_INIT_ALARMS); setup_widgets (gcal); gnome_calendar_create_corba_server (gcal); @@ -450,6 +450,7 @@ calendar_notify (time_t activation_time, CalendarAlarm *which, void *data) gtk_object_set_data (GTK_OBJECT (w), "beep_tag", GINT_TO_POINTER (beep_tag)); gtk_widget_ref (w); + gtk_window_set_modal (GTK_WINDOW (w), FALSE); ret = gnome_dialog_run (GNOME_DIALOG (w)); switch (ret) { case 1: @@ -493,6 +494,7 @@ calendar_notify (time_t activation_time, CalendarAlarm *which, void *data) ico->summary, "'", NULL); w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, _("Ok"), snooze_button, NULL); + gtk_window_set_modal (GTK_WINDOW (w), FALSE); ret = gnome_dialog_run (GNOME_DIALOG (w)); switch (ret) { case 1: diff --git a/calendar/gui/main.c b/calendar/gui/main.c index ee4111b03e..eb1823fc6f 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -829,7 +829,7 @@ dump_todo (void) if (object->type != ICAL_TODO) continue; - printf ("[%s]: %s\n", object->organizer, object->summary); + printf ("[%s]: %s\n",object->organizer->addr, object->summary); } calendar_destroy (cal); exit (0); |