[maemo-commits] [maemo-commits] r8200 - in projects/haf/tags/hildon-libs/0.12.24-1: . hildon-widgets
From: mdk at stage.maemo.org mdk at stage.maemo.orgDate: Tue Nov 21 12:48:49 EET 2006
- Previous message: [maemo-commits] r8199 - projects/haf/tags/hildon-libs
- Next message: [maemo-commits] r8201 - projects/haf/tags/hildon-libs/0.12.24-1/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2006-11-21 12:48:48 +0200 (Tue, 21 Nov 2006) New Revision: 8200 Modified: projects/haf/tags/hildon-libs/0.12.24-1/ChangeLog projects/haf/tags/hildon-libs/0.12.24-1/configure.ac projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.c projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.h Log: 2006-11-21 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * configure.ac: * debian/changelog: 0.12.24 * hildon-widgets/hildon-scroll-area.c: * hildon-widgets/hildon-scroll-area.h: Backporing a fix for NB#20219. Modified: projects/haf/tags/hildon-libs/0.12.24-1/ChangeLog =================================================================== --- projects/haf/tags/hildon-libs/0.12.24-1/ChangeLog 2006-11-21 10:47:48 UTC (rev 8199) +++ projects/haf/tags/hildon-libs/0.12.24-1/ChangeLog 2006-11-21 10:48:48 UTC (rev 8200) @@ -1,3 +1,11 @@ +2006-11-21 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + + * configure.ac: + * debian/changelog: 0.12.24 + + * hildon-widgets/hildon-scroll-area.c: + * hildon-widgets/hildon-scroll-area.h: Backporing a fix for NB#20219. + 2006-09-22 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * configure.ac: Modified: projects/haf/tags/hildon-libs/0.12.24-1/configure.ac =================================================================== --- projects/haf/tags/hildon-libs/0.12.24-1/configure.ac 2006-11-21 10:47:48 UTC (rev 8199) +++ projects/haf/tags/hildon-libs/0.12.24-1/configure.ac 2006-11-21 10:48:48 UTC (rev 8200) @@ -1,5 +1,5 @@ AC_INIT(Makefile.am) -AM_INIT_AUTOMAKE(hildon-libs, 0.12.23) +AM_INIT_AUTOMAKE(hildon-libs, 0.12.24) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST Modified: projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.c =================================================================== --- projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.c 2006-11-21 10:47:48 UTC (rev 8199) +++ projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.c 2006-11-21 10:48:48 UTC (rev 8200) @@ -1,14 +1,14 @@ /* * This file is part of hildon-libs * - * Copyright (C) 2005 Nokia Corporation. + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. * - * Contact: Luc Pionchon <luc.pionchon at nokia.com> + * Contact: Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * as published by the Free Software Foundation; version 2.1 of + * the License. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -72,6 +72,8 @@ GtkAllocation *allocation, HildonScrollArea *sc); +static int calculate_size (GtkWidget *widget); + /** * hildon_scroll_area_new: * @sw: #GtkWidget - #GtkScrolledWindow @@ -150,16 +152,46 @@ MIN (sc->outadj->page_size, allocation->height)); } + +static int calculate_size (GtkWidget *widget) +{ + int size = 0; + + if (GTK_IS_TEXT_VIEW (widget)) + return 0; + + if (GTK_IS_CONTAINER (widget)) { + GList *children = gtk_container_get_children (GTK_CONTAINER (widget)); + while (children != NULL) { + GtkWidget *wid = GTK_WIDGET (children->data); + gint sz = calculate_size (wid); + if ((GTK_WIDGET_VISIBLE (wid))) { + size += sz; + } + + children = g_list_next (children); + } + } else { + size = widget->allocation.height; + } + + return size; +} + static void hildon_scroll_area_child_requisition (GtkWidget *widget, GtkRequisition *req, HildonScrollArea *sc) { /* Limit height to fixed height */ gint new_req = MAX (req->height, sc->fixed->allocation.height); + gint adjust_factor = calculate_size (sc->swouter) * 0.7; + + adjust_factor = MAX (0, adjust_factor - sc->outadj->value); + new_req = MIN (sc->outadj->page_size - adjust_factor, new_req); + gtk_widget_set_size_request (sc->fixed, -1, req->height); /* Request inner scrolled window at most page size */ - gtk_widget_set_size_request (sc->swinner, -1, - MIN (sc->outadj->page_size, new_req)); + gtk_widget_set_size_request (sc->swinner, -1, new_req); } static void hildon_scroll_area_outer_value_changed (GtkAdjustment *adjustment, Modified: projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.h =================================================================== --- projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.h 2006-11-21 10:47:48 UTC (rev 8199) +++ projects/haf/tags/hildon-libs/0.12.24-1/hildon-widgets/hildon-scroll-area.h 2006-11-21 10:48:48 UTC (rev 8200) @@ -1,14 +1,14 @@ /* * This file is part of hildon-libs * - * Copyright (C) 2005 Nokia Corporation. + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. * - * Contact: Luc Pionchon <luc.pionchon at nokia.com> + * Contact: Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * as published by the Free Software Foundation; version 2.1 of + * the License. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,13 +28,13 @@ * (ie. by gtk_bin_get_child) */ -#ifndef HILDON_SCROLL_AREA_H -#define HILDON_SCROLL_AREA_H +#ifndef __HILDON_SCROLL_AREA_H__ +#define __HILDON_SCROLL_AREA_H__ -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> G_BEGIN_DECLS GtkWidget * hildon_scroll_area_new(GtkWidget * sw, GtkWidget * child); G_END_DECLS -#endif /* HILDON_SCROLL_AREA_H */ +#endif /* __HILDON_SCROLL_AREA_H__ */
- Previous message: [maemo-commits] r8199 - projects/haf/tags/hildon-libs
- Next message: [maemo-commits] r8201 - projects/haf/tags/hildon-libs/0.12.24-1/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]