2 * Copyright (C) 2007-2010 Openismus GmbH
5 * Mathias Hasselmann <mathias@openismus.com>
6 * Tristan Van Berkom <tristan.van.berkom@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 #include "gtksizerequestcacheprivate.h"
29 _gtk_size_request_cache_init (SizeRequestCache *cache)
31 memset (cache, 0, sizeof (SizeRequestCache));
35 _gtk_size_request_cache_free (SizeRequestCache *cache)
37 _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_HORIZONTAL);
38 _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_VERTICAL);
42 _gtk_size_request_cache_clear (SizeRequestCache *cache,
43 GtkSizeGroupMode orientation)
49 if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
51 sizes = cache->widths;
54 cache->cached_widths = 0;
55 cache->last_cached_width = 0;
56 cache->cached_base_width = FALSE;
60 sizes = cache->heights;
62 cache->heights = NULL;
63 cache->cached_heights = 0;
64 cache->last_cached_height = 0;
65 cache->cached_base_height = FALSE;
70 for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++)
71 g_slice_free (SizeRequest, sizes[i]);
73 g_slice_free1 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes);