diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-04 10:44:29 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-04 10:44:29 +0800 |
commit | f4295ffe09c2994a93eff4d4c73505f2bc291a59 (patch) | |
tree | ea15367750bae25c44a3fa79d241f5fb43ebad54 /calendar/gui/gnome-cal.c | |
parent | 1be7718e7d14edf3b4501de53fd600af1a53a156 (diff) | |
download | gsoc2013-evolution-f4295ffe09c2994a93eff4d4c73505f2bc291a59.tar.gz gsoc2013-evolution-f4295ffe09c2994a93eff4d4c73505f2bc291a59.tar.zst gsoc2013-evolution-f4295ffe09c2994a93eff4d4c73505f2bc291a59.zip |
Lots -mig
svn path=/trunk/; revision=103
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r-- | calendar/gui/gnome-cal.c | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 7fa7a5e40d..4c0806357d 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -39,18 +39,17 @@ gnome_calendar_get_type (void) static void setup_widgets (GnomeCalendar *gcal) { - GtkWidget *notebook; - GtkWidget *day_view, *year_view, *task_view; time_t now; now = time (NULL); - notebook = gtk_notebook_new (); - day_view = day_view_create (gcal); + gcal->notebook = gtk_notebook_new (); + gcal->day_view = day_view_create (gcal); gcal->week_view = gncal_week_view_new (gcal, now); - year_view = year_view_create (gcal); - task_view = tasks_create (gcal); + gcal->year_view = year_view_create (gcal); + gcal->task_view = tasks_create (gcal); + if (0) { struct tm tm; time_t a, b; @@ -66,17 +65,17 @@ setup_widgets (GnomeCalendar *gcal) b = mktime (&tm); - day_view = gncal_full_day_new (gcal, a, b); + gcal->day_view = gncal_full_day_new (gcal, a, b); } - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), day_view, gtk_label_new (_("Day View"))); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gcal->week_view, gtk_label_new (_("Week View"))); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), year_view, gtk_label_new (_("Year View"))); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), task_view, gtk_label_new (_("Todo"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view, gtk_label_new (_("Day View"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view, gtk_label_new (_("Year View"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->task_view, gtk_label_new (_("Todo"))); - gtk_widget_show_all (notebook); + gtk_widget_show_all (gcal->notebook); - gnome_app_set_contents (GNOME_APP (gcal), notebook); + gnome_app_set_contents (GNOME_APP (gcal), gcal->notebook); } @@ -88,6 +87,29 @@ gnome_calendar_init(GnomeCalendar *gcal) setup_widgets (gcal); } +static GtkWidget * +get_current_page (GnomeCalendar *gcal) +{ + return GTK_NOTEBOOK (gcal->notebook)->cur_page->child; +} + +GtkWidget * +gnome_calendar_next (GnomeCalendar *gcal) +{ + GtkWidget *cp = get_current_page (gcal); + time_t new_time; + + if (cp == gcal->week_view) + new_time = time_add_week (gcal->current_display, 1); + else if (cp == gcal->day_view) + new_time = time_add_day (gcal->current_display, 1); + else if (cp == gcal->year_view) + new_time = time_add_year (gcal->current_display, 1); + else + g_warning ("Weee! Where did the penguin go?"); + +} + GtkWidget * gnome_calendar_new (char *title) { @@ -104,13 +126,27 @@ gnome_calendar_new (char *title) gtk_window_set_title(GTK_WINDOW(retval), title); + gcal->current_display = time (NULL); gcal->cal = calendar_new (title); return retval; } void +gnome_calendar_update_all (GnomeCalendar *cal) +{ + gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view)); +} + +void gnome_calendar_load (GnomeCalendar *gcal, char *file) { calendar_load (gcal->cal, file); - gncal_week_view_update (GNCAL_WEEK_VIEW (gcal->week_view)); + gnome_calendar_update_all (gcal); +} + +void +gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj) +{ + calendar_add_object (gcal->cal, obj); + gnome_calendar_update_all (gcal); } |