From ede0790b5c953edf0a14dae1f75fa449d5c3286a Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 25 May 1999 19:28:28 +0000 Subject: Set the canvas scroll region here, not in size_allocate(). Also, use the 1999-05-25 Federico Mena Quintero * year-view.c (idle_handler): Set the canvas scroll region here, not in size_allocate(). Also, use the correct width and height based on the allocation and the precomputed minimum width/height values. * gnome-cal.c (setup_widgets): Set the scrollbar policy of the scrolled window. * main.c (setup_appbar): Use the correct type for the appbar. * gncal-day-view.c: Removed unused function switch_to_day(). * gncal-day-panel.c (calendar_day_selected): Removed unused variable. 1999-05-25 Federico Mena Quintero * configure.in: Added the gncal/doc/* Makefiles to AC_OUTPUT. svn path=/trunk/; revision=939 --- calendar/ChangeLog | 16 ++++++++++++++++ calendar/gncal-day-panel.c | 1 - calendar/gncal-day-view.c | 5 ----- calendar/gnome-cal.c | 3 +++ calendar/gui/gncal-day-panel.c | 1 - calendar/gui/gncal-day-view.c | 5 ----- calendar/gui/gnome-cal.c | 3 +++ calendar/gui/main.c | 6 +++--- calendar/gui/year-view.c | 21 +++++++++++++-------- calendar/main.c | 6 +++--- calendar/year-view.c | 21 +++++++++++++-------- 11 files changed, 54 insertions(+), 34 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5bcc64c231..cb0e6fe97c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,19 @@ +1999-05-25 Federico Mena Quintero + + * year-view.c (idle_handler): Set the canvas scroll region here, + not in size_allocate(). Also, use the correct width and height + based on the allocation and the precomputed minimum width/height + values. + + * gnome-cal.c (setup_widgets): Set the scrollbar policy of the + scrolled window. + + * main.c (setup_appbar): Use the correct type for the appbar. + + * gncal-day-view.c: Removed unused function switch_to_day(). + + * gncal-day-panel.c (calendar_day_selected): Removed unused variable. + 1999-05-25 Nat Friedman * doc/C/gnomecal.sgml: Fixed a typo. diff --git a/calendar/gncal-day-panel.c b/calendar/gncal-day-panel.c index 1eb8941019..bd91a18346 100644 --- a/calendar/gncal-day-panel.c +++ b/calendar/gncal-day-panel.c @@ -71,7 +71,6 @@ calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel) { gint y, m, d; struct tm tm; - time_t time; gtk_calendar_get_date (calendar, &y, &m, &d); diff --git a/calendar/gncal-day-view.c b/calendar/gncal-day-view.c index 76cd00e90f..eafd237029 100644 --- a/calendar/gncal-day-view.c +++ b/calendar/gncal-day-view.c @@ -139,11 +139,6 @@ context_menu (GncalDayView *dayview, GdkEventButton *event) popup_menu (main_items, 1, event); } -static void -switch_to_day (GncalDayView *dayview) -{ -} - static gint gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event) { diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c index 3558f58347..72a411777c 100644 --- a/calendar/gnome-cal.c +++ b/calendar/gnome-cal.c @@ -56,6 +56,9 @@ setup_widgets (GnomeCalendar *gcal) gcal->year_view = year_view_new (gcal, now); sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); 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"))); diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c index 1eb8941019..bd91a18346 100644 --- a/calendar/gui/gncal-day-panel.c +++ b/calendar/gui/gncal-day-panel.c @@ -71,7 +71,6 @@ calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel) { gint y, m, d; struct tm tm; - time_t time; gtk_calendar_get_date (calendar, &y, &m, &d); diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c index 76cd00e90f..eafd237029 100644 --- a/calendar/gui/gncal-day-view.c +++ b/calendar/gui/gncal-day-view.c @@ -139,11 +139,6 @@ context_menu (GncalDayView *dayview, GdkEventButton *event) popup_menu (main_items, 1, event); } -static void -switch_to_day (GncalDayView *dayview) -{ -} - static gint gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event) { diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 3558f58347..72a411777c 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -56,6 +56,9 @@ setup_widgets (GnomeCalendar *gcal) gcal->year_view = year_view_new (gcal, now); sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); 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"))); diff --git a/calendar/gui/main.c b/calendar/gui/main.c index db0000365c..0961c87b4b 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -537,10 +537,10 @@ setup_menu (GtkWidget *gcal) static void setup_appbar (GtkWidget *gcal) { - GnomeAppBar *appbar; - + GtkWidget *appbar; + appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER); - gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET(appbar)); + gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar)); } static gint diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c index ebfc6d2e44..ac4313e6ed 100644 --- a/calendar/gui/year-view.c +++ b/calendar/gui/year-view.c @@ -76,8 +76,8 @@ year_view_class_init (YearViewClass *class) widget_class->size_allocate = year_view_size_allocate; } -/* Resizes the year view's child items. This is done in the idle loop for performance (we avoid - * resizing on every size allocation). +/* Resizes the year view's child items. This is done in the idle loop for + * performance (we avoid resizing on every size allocation). */ static gint idle_handler (gpointer data) @@ -96,6 +96,16 @@ idle_handler (gpointer data) yv = data; + /* Compute the size we can use */ + + width = MAX (GTK_WIDGET (yv)->allocation.width, yv->min_width); + height = MAX (GTK_WIDGET (yv)->allocation.height, yv->min_height); + + gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, width, height); + + width--; + height--; + /* Get the heights of the heading and the titles */ arg.name = "text_height"; @@ -106,14 +116,10 @@ idle_handler (gpointer data) gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &arg); title_height = GTK_VALUE_DOUBLE (arg); - /* Space for the titles and months */ - width = GTK_WIDGET (yv)->allocation.width; - height = CALENDAR_HEIGHT; - /* Offsets */ xofs = (width + SPACING) / 3.0; - yofs = (height + SPACING) / 4.0; + yofs = (height - head_height + SPACING) / 4.0; /* Month item vertical offset */ @@ -603,7 +609,6 @@ 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, CALENDAR_HEIGHT); need_resize (yv); } diff --git a/calendar/main.c b/calendar/main.c index db0000365c..0961c87b4b 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -537,10 +537,10 @@ setup_menu (GtkWidget *gcal) static void setup_appbar (GtkWidget *gcal) { - GnomeAppBar *appbar; - + GtkWidget *appbar; + appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER); - gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET(appbar)); + gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar)); } static gint diff --git a/calendar/year-view.c b/calendar/year-view.c index ebfc6d2e44..ac4313e6ed 100644 --- a/calendar/year-view.c +++ b/calendar/year-view.c @@ -76,8 +76,8 @@ year_view_class_init (YearViewClass *class) widget_class->size_allocate = year_view_size_allocate; } -/* Resizes the year view's child items. This is done in the idle loop for performance (we avoid - * resizing on every size allocation). +/* Resizes the year view's child items. This is done in the idle loop for + * performance (we avoid resizing on every size allocation). */ static gint idle_handler (gpointer data) @@ -96,6 +96,16 @@ idle_handler (gpointer data) yv = data; + /* Compute the size we can use */ + + width = MAX (GTK_WIDGET (yv)->allocation.width, yv->min_width); + height = MAX (GTK_WIDGET (yv)->allocation.height, yv->min_height); + + gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, width, height); + + width--; + height--; + /* Get the heights of the heading and the titles */ arg.name = "text_height"; @@ -106,14 +116,10 @@ idle_handler (gpointer data) gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &arg); title_height = GTK_VALUE_DOUBLE (arg); - /* Space for the titles and months */ - width = GTK_WIDGET (yv)->allocation.width; - height = CALENDAR_HEIGHT; - /* Offsets */ xofs = (width + SPACING) / 3.0; - yofs = (height + SPACING) / 4.0; + yofs = (height - head_height + SPACING) / 4.0; /* Month item vertical offset */ @@ -603,7 +609,6 @@ 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, CALENDAR_HEIGHT); need_resize (yv); } -- cgit