From a9b1af2b26c0be96173149078b4e98b2b1d3aac2 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 9 May 1998 00:04:08 +0000 Subject: 1. Fix: `New Appointment' defaults to the current day. 2. Add `New 1. Fix: `New Appointment' defaults to the current day. 2. Add `New appointment today' entry. 3. Use the new freeze/thaw changes to avoid the extensive flicker. Miguel. svn path=/trunk/; revision=209 --- calendar/ChangeLog | 12 ++++++++++++ calendar/eventedit.c | 2 +- calendar/gnome-cal.c | 2 ++ calendar/gui/eventedit.c | 2 +- calendar/gui/gnome-cal.c | 2 ++ calendar/gui/main.c | 17 +++++++++++++++++ calendar/gui/year-view.c | 6 +++++- calendar/main.c | 17 +++++++++++++++++ calendar/year-view.c | 6 +++++- 9 files changed, 62 insertions(+), 4 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8f9bbe3e54..a921d7f813 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,15 @@ +1998-05-08 Miguel de Icaza + + * gncal-full-day.c (new_appointment): Use gtk_calendar freeze/thaw + + * gncal-year-view.c (gncal_year_view_set_year): Use gtkcalendar freeze/thaw. + + * eventedit.c (event_editor_init): Use gnome_dialog_set_close to + avoid the ugly warning. + + * main.c (display_objedit): Default to the day the user is looking + at. + 1998-05-05 Miguel de Icaza * gncal-day-panel.c (full_day_size_allocated): Do not emit a value diff --git a/calendar/eventedit.c b/calendar/eventedit.c index 30068867a3..b843ad049c 100644 --- a/calendar/eventedit.c +++ b/calendar/eventedit.c @@ -1437,7 +1437,7 @@ static void event_editor_init (EventEditor *ee) { ee->ical = 0; - gnome_dialog_set_destroy(GNOME_DIALOG(ee), TRUE); + gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE); } static void diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c index e4312e9341..5db24e9828 100644 --- a/calendar/gnome-cal.c +++ b/calendar/gnome-cal.c @@ -377,6 +377,8 @@ gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal) tm.tm_mon++; month_end = mktime (&tm); + gtk_calendar_freeze (gtk_cal); gtk_calendar_clear_marks (gtk_cal); calendar_iterate (cal->cal, month_begin, month_end, mark_gtk_calendar_day, gtk_cal); + gtk_calendar_thaw (gtk_cal); } diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index 30068867a3..b843ad049c 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -1437,7 +1437,7 @@ static void event_editor_init (EventEditor *ee) { ee->ical = 0; - gnome_dialog_set_destroy(GNOME_DIALOG(ee), TRUE); + gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE); } static void diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e4312e9341..5db24e9828 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -377,6 +377,8 @@ gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal) tm.tm_mon++; month_end = mktime (&tm); + gtk_calendar_freeze (gtk_cal); gtk_calendar_clear_marks (gtk_cal); calendar_iterate (cal->cal, month_begin, month_end, mark_gtk_calendar_day, gtk_cal); + gtk_calendar_thaw (gtk_cal); } diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 64b58cb1fc..dec25e737c 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -141,7 +141,23 @@ static void display_objedit (GtkWidget *widget, GnomeCalendar *gcal) { GtkWidget *ee; + iCalObject *ico; + + /* Default to the day the user is looking at */ + ico = ical_new ("", user_name, ""); + ico->new = 1; + ico->dtstart = time_add_minutes (gcal->current_display, day_begin * 60); + ico->dtend = time_add_minutes (ico->dtstart, day_begin * 60 + 30 ); + + ee = event_editor_new (gcal, ico); + gtk_widget_show (ee); +} +static void +display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal) +{ + GtkWidget *ee; + ee = event_editor_new (gcal, NULL); gtk_widget_show (ee); } @@ -330,6 +346,7 @@ static GnomeUIInfo gnome_cal_about_menu [] = { static GnomeUIInfo gnome_cal_edit_menu [] = { { GNOME_APP_UI_ITEM, N_("New appointment..."), NULL, display_objedit }, + { GNOME_APP_UI_ITEM, N_("New appointment for today..."), NULL, display_objedit_today }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Properties..."), NULL, properties, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP }, diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c index d28130bb6f..bc03b4f36e 100644 --- a/calendar/gui/year-view.c +++ b/calendar/gui/year-view.c @@ -198,8 +198,9 @@ gncal_year_view_set_year (GncalYearView *yview, int year) snprintf(buff, 20, "%d", yview->year + 1900); gtk_label_set(GTK_LABEL(yview->year_label), buff); - + for (i = 0; i < 12; i++) { + gtk_calendar_freeze (GTK_CALENDAR (yview->calendar [i])); gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year + 1900); gtk_calendar_clear_marks (GTK_CALENDAR (yview->calendar[i])); } @@ -213,6 +214,9 @@ gncal_year_view_set_year (GncalYearView *yview, int year) year_view_mark_day (co->ico, co->ev_start, co->ev_end, yview); } + for (i = 0; i < 12; i++) + gtk_calendar_thaw (GTK_CALENDAR (yview->calendar [i])); + calendar_destroy_event_list (l); } diff --git a/calendar/main.c b/calendar/main.c index 64b58cb1fc..dec25e737c 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -141,7 +141,23 @@ static void display_objedit (GtkWidget *widget, GnomeCalendar *gcal) { GtkWidget *ee; + iCalObject *ico; + + /* Default to the day the user is looking at */ + ico = ical_new ("", user_name, ""); + ico->new = 1; + ico->dtstart = time_add_minutes (gcal->current_display, day_begin * 60); + ico->dtend = time_add_minutes (ico->dtstart, day_begin * 60 + 30 ); + + ee = event_editor_new (gcal, ico); + gtk_widget_show (ee); +} +static void +display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal) +{ + GtkWidget *ee; + ee = event_editor_new (gcal, NULL); gtk_widget_show (ee); } @@ -330,6 +346,7 @@ static GnomeUIInfo gnome_cal_about_menu [] = { static GnomeUIInfo gnome_cal_edit_menu [] = { { GNOME_APP_UI_ITEM, N_("New appointment..."), NULL, display_objedit }, + { GNOME_APP_UI_ITEM, N_("New appointment for today..."), NULL, display_objedit_today }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Properties..."), NULL, properties, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP }, diff --git a/calendar/year-view.c b/calendar/year-view.c index d28130bb6f..bc03b4f36e 100644 --- a/calendar/year-view.c +++ b/calendar/year-view.c @@ -198,8 +198,9 @@ gncal_year_view_set_year (GncalYearView *yview, int year) snprintf(buff, 20, "%d", yview->year + 1900); gtk_label_set(GTK_LABEL(yview->year_label), buff); - + for (i = 0; i < 12; i++) { + gtk_calendar_freeze (GTK_CALENDAR (yview->calendar [i])); gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year + 1900); gtk_calendar_clear_marks (GTK_CALENDAR (yview->calendar[i])); } @@ -213,6 +214,9 @@ gncal_year_view_set_year (GncalYearView *yview, int year) year_view_mark_day (co->ico, co->ev_start, co->ev_end, yview); } + for (i = 0; i < 12; i++) + gtk_calendar_thaw (GTK_CALENDAR (yview->calendar [i])); + calendar_destroy_event_list (l); } -- cgit