/* gtksizerequest.c * Copyright (C) 2007-2010 Openismus GmbH * * Authors: * Mathias Hasselmann * Tristan Van Berkom * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library. If not, see . */ #include #include "gtksizerequestcacheprivate.h" #include void _gtk_size_request_cache_init (SizeRequestCache *cache) { memset (cache, 0, sizeof (SizeRequestCache)); } void _gtk_size_request_cache_free (SizeRequestCache *cache) { _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_HORIZONTAL); _gtk_size_request_cache_clear (cache, GTK_SIZE_GROUP_VERTICAL); } void _gtk_size_request_cache_clear (SizeRequestCache *cache, GtkSizeGroupMode orientation) { SizeRequest **sizes; gint i; if (orientation == GTK_SIZE_GROUP_HORIZONTAL) { sizes = cache->widths; cache->widths = NULL; cache->cached_widths = 0; cache->last_cached_width = 0; cache->cached_base_width = FALSE; } else { sizes = cache->heights; cache->heights = NULL; cache->cached_heights = 0; cache->last_cached_height = 0; cache->cached_base_height = FALSE; } if (sizes) { for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++) g_slice_free (SizeRequest, sizes[i]); g_slice_free1 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes); } }