From c150a409d44428073347bf5da033d0290cda4d4d Mon Sep 17 00:00:00 2001 From: Nat Friedman Date: Tue, 25 May 1999 17:09:56 +0000 Subject: This is the fix Miguel and I hacked in the car at Expo to make the year view work in low-resolution displays. This isn't the proper fix, but it's better than the way things were. 1999-05-25 Nat Friedman * doc/C/gnomecal.sgml: Fixed a typo. * gnome-cal.c (setup_widgets): Added a scrolled window widget into which the year view is placed. * year-view.c (CALENDAR_HEIGHT): The height of the total year view inside the scrolled window. (idle_handler): Set the height of the year view to CALENDAR_HEIGHT. (year_view_size_allocate): Set the scroll region of the year view canvas to allocation->width, CALENDAR_HEIGHT. svn path=/trunk/; revision=938 --- calendar/ChangeLog | 14 ++++++++++++++ calendar/doc/C/gnomecal.sgml | 2 +- calendar/gnome-cal.c | 6 +++++- calendar/gui/gnome-cal.c | 6 +++++- calendar/gui/main.c | 10 ++++++++-- calendar/gui/year-view.c | 8 +++++--- calendar/main.c | 10 ++++++++-- calendar/year-view.c | 8 +++++--- 8 files changed, 51 insertions(+), 13 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 32aa1ba745..5bcc64c231 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +1999-05-25 Nat Friedman + + * doc/C/gnomecal.sgml: Fixed a typo. + + * gnome-cal.c (setup_widgets): Added a scrolled window widget into + which the year view is placed. + + * year-view.c (CALENDAR_HEIGHT): The height of the total year view + inside the scrolled window. + (idle_handler): Set the height of the year view to + CALENDAR_HEIGHT. + (year_view_size_allocate): Set the scroll region of the year view + canvas to allocation->width, CALENDAR_HEIGHT. + 1999-04-25 Miguel de Icaza * main.c (dump_todo): Add --todo flag to dump the todo contents. diff --git a/calendar/doc/C/gnomecal.sgml b/calendar/doc/C/gnomecal.sgml index 92783cc06a..d083e6fb26 100644 --- a/calendar/doc/C/gnomecal.sgml +++ b/calendar/doc/C/gnomecal.sgml @@ -50,7 +50,7 @@ gnomecal program. You can use these options to alter the behaviour of the program or to quickly query the program for appointments, and to do items from the - command line without requiring an X display. These are usefu + command line without requiring an X display. These are useful for example to include in scripts. diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c index 89d6998e3e..3558f58347 100644 --- a/calendar/gnome-cal.c +++ b/calendar/gnome-cal.c @@ -44,6 +44,7 @@ gnome_calendar_get_type (void) static void setup_widgets (GnomeCalendar *gcal) { + GtkWidget *sw; time_t now; now = time (NULL); @@ -54,10 +55,13 @@ setup_widgets (GnomeCalendar *gcal) gcal->month_view = month_view_new (gcal, now); gcal->year_view = year_view_new (gcal, now); + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (sw), gcal->year_view); + 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->month_view, gtk_label_new (_("Month 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), sw, gtk_label_new (_("Year View"))); gtk_widget_show_all (gcal->notebook); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 89d6998e3e..3558f58347 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -44,6 +44,7 @@ gnome_calendar_get_type (void) static void setup_widgets (GnomeCalendar *gcal) { + GtkWidget *sw; time_t now; now = time (NULL); @@ -54,10 +55,13 @@ setup_widgets (GnomeCalendar *gcal) gcal->month_view = month_view_new (gcal, now); gcal->year_view = year_view_new (gcal, now); + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (sw), gcal->year_view); + 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->month_view, gtk_label_new (_("Month 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), sw, gtk_label_new (_("Year View"))); gtk_widget_show_all (gcal->notebook); diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 9462a3a531..db0000365c 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -566,9 +566,15 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){ if (xpos != -1) gtk_widget_set_uposition (toplevel, xpos, ypos); - if (width != -1) - gtk_widget_set_usize (toplevel, width, height); +#if 0 + if (width != -1) + gtk_widget_set_usize (toplevel, width, 600); +#endif } +#if 0 + gtk_widget_set_usize (toplevel, width, 600); +#endif + setup_appbar (toplevel); setup_menu (toplevel); diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c index efd22a475f..ebfc6d2e44 100644 --- a/calendar/gui/year-view.c +++ b/calendar/gui/year-view.c @@ -21,6 +21,8 @@ #define TITLE_SPACING 1 /* Spacing between title and calendar */ #define SPACING 4 /* Spacing between months */ +#define CALENDAR_HEIGHT 600 /* Height of the entire year view. */ + static void year_view_class_init (YearViewClass *class); static void year_view_init (YearView *yv); @@ -105,9 +107,8 @@ idle_handler (gpointer data) title_height = GTK_VALUE_DOUBLE (arg); /* Space for the titles and months */ - width = GTK_WIDGET (yv)->allocation.width; - height = GTK_WIDGET (yv)->allocation.height - head_height; + height = CALENDAR_HEIGHT; /* Offsets */ @@ -569,6 +570,7 @@ year_view_new (GnomeCalendar *calendar, time_t year) year_view_colors_changed (yv); year_view_set (yv, year); compute_min_size (yv); + return GTK_WIDGET (yv); } @@ -601,7 +603,7 @@ year_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) if (GTK_WIDGET_CLASS (parent_class)->size_allocate) (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); - gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, allocation->width, allocation->height); + gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, allocation->width, CALENDAR_HEIGHT); need_resize (yv); } diff --git a/calendar/main.c b/calendar/main.c index 9462a3a531..db0000365c 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -566,9 +566,15 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){ if (xpos != -1) gtk_widget_set_uposition (toplevel, xpos, ypos); - if (width != -1) - gtk_widget_set_usize (toplevel, width, height); +#if 0 + if (width != -1) + gtk_widget_set_usize (toplevel, width, 600); +#endif } +#if 0 + gtk_widget_set_usize (toplevel, width, 600); +#endif + setup_appbar (toplevel); setup_menu (toplevel); diff --git a/calendar/year-view.c b/calendar/year-view.c index efd22a475f..ebfc6d2e44 100644 --- a/calendar/year-view.c +++ b/calendar/year-view.c @@ -21,6 +21,8 @@ #define TITLE_SPACING 1 /* Spacing between title and calendar */ #define SPACING 4 /* Spacing between months */ +#define CALENDAR_HEIGHT 600 /* Height of the entire year view. */ + static void year_view_class_init (YearViewClass *class); static void year_view_init (YearView *yv); @@ -105,9 +107,8 @@ idle_handler (gpointer data) title_height = GTK_VALUE_DOUBLE (arg); /* Space for the titles and months */ - width = GTK_WIDGET (yv)->allocation.width; - height = GTK_WIDGET (yv)->allocation.height - head_height; + height = CALENDAR_HEIGHT; /* Offsets */ @@ -569,6 +570,7 @@ year_view_new (GnomeCalendar *calendar, time_t year) year_view_colors_changed (yv); year_view_set (yv, year); compute_min_size (yv); + return GTK_WIDGET (yv); } @@ -601,7 +603,7 @@ year_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) if (GTK_WIDGET_CLASS (parent_class)->size_allocate) (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); - gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, allocation->width, allocation->height); + gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, allocation->width, CALENDAR_HEIGHT); need_resize (yv); } -- cgit v1.2.3