Commit b983d1c6 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Store builtin stock icons in an icon cache, instead of populating a hash

2005-11-04  Matthias Clasen  <mclasen@redhat.com>

        Store builtin stock icons in an icon cache, instead of
        populating a hash table with pixbufs at startup, to save both
        memory and startup time.

        * gtk/stock-icons/*: Reorganize the icons in a directory structure
        suitable for gtk-update-icon-cache, and rename them to match the
        stock ids.

        * gtk/gtkiconcache.[hc]: Support non-mmapped icon caches, and
        add _gtk_icon_cache_has_icon_in_directory().

        * gtk/updateiconcache.c: Support a --source <VARIABLE> argument
        to store the contents of the icon cache in a C header.

        * gtk/gtkbuiltincache.h: Generated private header which contains
        the icon cache for the builtin icons.

        * gtk/gtkicontheme.c: Create a GtkIconCache for the builtin
        icons, and use that in addition to the hash table whenever
        builtin icons are searched.

        * gtk/gtkiconfactory.c: Add GTK_ICON_SOURCE_STATIC_ICON_NAME and
        use it for static stock ids.
        (get_default_icons): Don't add the builtin
        icons to the icon theme, just register the stock ids.
        (render_fallback_image): Take the fallback image out of the
        builtin icon cache.

        * gtk/Makefile.am: Remove stock-icons from SUBDIRS and add
        the necessary machinery to rebuild gtkbuiltincache.h.
parent 99633ce5
2005-11-04 Matthias Clasen <mclasen@redhat.com>
Store builtin stock icons in an icon cache, instead of
populating a hash table with pixbufs at startup, to save both
memory and startup time.
* gtk/stock-icons/*: Reorganize the icons in a directory structure
suitable for gtk-update-icon-cache, and rename them to match the
stock ids.
* gtk/gtkiconcache.[hc]: Support non-mmapped icon caches, and
add _gtk_icon_cache_has_icon_in_directory().
* gtk/updateiconcache.c: Support a --source <VARIABLE> argument
to store the contents of the icon cache in a C header.
* gtk/gtkbuiltincache.h: Generated private header which contains
the icon cache for the builtin icons.
* gtk/gtkicontheme.c: Create a GtkIconCache for the builtin
icons, and use that in addition to the hash table whenever
builtin icons are searched.
* gtk/gtkiconfactory.c: Add GTK_ICON_SOURCE_STATIC_ICON_NAME and
use it for static stock ids.
(get_default_icons): Don't add the builtin
icons to the icon theme, just register the stock ids.
(render_fallback_image): Take the fallback image out of the
builtin icon cache.
* gtk/Makefile.am: Remove stock-icons from SUBDIRS and add
the necessary machinery to rebuild gtkbuiltincache.h.
2005-11-04 Michael Natterer <mitch@imendio.com>
* gtk/gtkrc.c (gtk_rc_reparse_all_for_settings): applied patch
......
2005-11-04 Matthias Clasen <mclasen@redhat.com>
Store builtin stock icons in an icon cache, instead of
populating a hash table with pixbufs at startup, to save both
memory and startup time.
* gtk/stock-icons/*: Reorganize the icons in a directory structure
suitable for gtk-update-icon-cache, and rename them to match the
stock ids.
* gtk/gtkiconcache.[hc]: Support non-mmapped icon caches, and
add _gtk_icon_cache_has_icon_in_directory().
* gtk/updateiconcache.c: Support a --source <VARIABLE> argument
to store the contents of the icon cache in a C header.
* gtk/gtkbuiltincache.h: Generated private header which contains
the icon cache for the builtin icons.
* gtk/gtkicontheme.c: Create a GtkIconCache for the builtin
icons, and use that in addition to the hash table whenever
builtin icons are searched.
* gtk/gtkiconfactory.c: Add GTK_ICON_SOURCE_STATIC_ICON_NAME and
use it for static stock ids.
(get_default_icons): Don't add the builtin
icons to the icon theme, just register the stock ids.
(render_fallback_image): Take the fallback image out of the
builtin icon cache.
* gtk/Makefile.am: Remove stock-icons from SUBDIRS and add
the necessary machinery to rebuild gtkbuiltincache.h.
2005-11-04 Michael Natterer <mitch@imendio.com>
* gtk/gtkrc.c (gtk_rc_reparse_all_for_settings): applied patch
......
# Makefile.am for gtk+/gtk
SUBDIRS=stock-icons theme-bits
SUBDIRS=theme-bits
if OS_UNIX
SUBDIRS += xdgmime
......@@ -568,7 +568,8 @@ gtk_built_public_sources = \
# built sources that don't get installed
gtk_built_private_headers = \
gtkalias.h \
gtkmarshalers.h
gtkmarshalers.h \
gtkbuiltincache.h
gtk_built_sources = \
gtkaliasdef.c \
......@@ -734,20 +735,243 @@ gtk_query_immodules_2_0_LDADD = $(LDADDS)
gtk_query_immodules_2_0_SOURCES = queryimmodules.c
gtk_update_icon_cache_DEPENDENCIES = $(DEPS)
gtk_update_icon_cache_LDADD = $(LDADDS)
gtk_update_icon_cache_LDADD = $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
gtk_update_icon_cache_SOURCES = updateiconcache.c
.PHONY: files test test-debug
.PHONY: files test test-debug icons
files:
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
echo $$p; \
done
STOCK_ICONS = \
stock-icons/16/gtk-about.png \
stock-icons/16/gtk-add.png \
stock-icons/16/gtk-cdrom.png \
stock-icons/16/gtk-connect.png \
stock-icons/16/gtk-convert.png \
stock-icons/16/gtk-copy.png \
stock-icons/16/gtk-cut.png \
stock-icons/16/gtk-delete.png \
stock-icons/16/gtk-directory.png \
stock-icons/16/gtk-disconnect.png \
stock-icons/16/gtk-edit.png \
stock-icons/16/gtk-execute.png \
stock-icons/16/gtk-file.png \
stock-icons/16/gtk-find-and-replace.png \
stock-icons/16/gtk-find.png \
stock-icons/16/gtk-floppy.png \
stock-icons/16/gtk-fullscreen.png \
stock-icons/16/gtk-go-back-ltr.png \
stock-icons/16/gtk-go-back-rtl.png \
stock-icons/16/gtk-go-down.png \
stock-icons/16/gtk-go-forward-ltr.png \
stock-icons/16/gtk-go-forward-rtl.png \
stock-icons/16/gtk-goto-bottom.png \
stock-icons/16/gtk-goto-first-ltr.png \
stock-icons/16/gtk-goto-first-rtl.png \
stock-icons/16/gtk-goto-last-ltr.png \
stock-icons/16/gtk-goto-last-rtl.png \
stock-icons/16/gtk-goto-top.png \
stock-icons/16/gtk-go-up.png \
stock-icons/16/gtk-harddisk.png \
stock-icons/16/gtk-help.png \
stock-icons/16/gtk-home.png \
stock-icons/16/gtk-indent.png \
stock-icons/16/gtk-index.png \
stock-icons/16/gtk-info.png \
stock-icons/16/gtk-jump-to-ltr.png \
stock-icons/16/gtk-jump-to-rtl.png \
stock-icons/16/gtk-justify-center.png \
stock-icons/16/gtk-justify-fill.png \
stock-icons/16/gtk-justify-left.png \
stock-icons/16/gtk-justify-right.png \
stock-icons/16/gtk-leave-fullscreen.png \
stock-icons/16/gtk-media-forward-ltr.png \
stock-icons/16/gtk-media-forward-rtl.png \
stock-icons/16/gtk-media-next-ltr.png \
stock-icons/16/gtk-media-next-rtl.png \
stock-icons/16/gtk-media-pause.png \
stock-icons/16/gtk-media-play-ltr.png \
stock-icons/16/gtk-media-play-rtl.png \
stock-icons/16/gtk-media-previous-ltr.png \
stock-icons/16/gtk-media-previous-rtl.png \
stock-icons/16/gtk-media-record.png \
stock-icons/16/gtk-media-rewind-ltr.png \
stock-icons/16/gtk-media-rewind-rtl.png \
stock-icons/16/gtk-media-stop.png \
stock-icons/16/gtk-missing-image.png \
stock-icons/16/gtk-network.png \
stock-icons/16/gtk-new.png \
stock-icons/16/gtk-open.png \
stock-icons/16/gtk-paste.png \
stock-icons/16/gtk-preferences.png \
stock-icons/16/gtk-print.png \
stock-icons/16/gtk-print-preview.png \
stock-icons/16/gtk-properties.png \
stock-icons/16/gtk-quit.png \
stock-icons/16/gtk-redo-ltr.png \
stock-icons/16/gtk-redo-rtl.png \
stock-icons/16/gtk-refresh.png \
stock-icons/16/gtk-remove.png \
stock-icons/16/gtk-revert-to-saved-ltr.png \
stock-icons/16/gtk-revert-to-saved-rtl.png \
stock-icons/16/gtk-save-as.png \
stock-icons/16/gtk-save.png \
stock-icons/16/gtk-select-all.png \
stock-icons/16/gtk-select-font.png \
stock-icons/16/gtk-sort-ascending.png \
stock-icons/16/gtk-sort-descending.png \
stock-icons/16/gtk-spell-check.png \
stock-icons/16/gtk-stop.png \
stock-icons/16/gtk-strikethrough.png \
stock-icons/16/gtk-font.png \
stock-icons/16/gtk-undelete-ltr.png \
stock-icons/16/gtk-undelete-rtl.png \
stock-icons/16/gtk-underline.png \
stock-icons/16/gtk-undo-ltr.png \
stock-icons/16/gtk-undo-rtl.png \
stock-icons/16/gtk-unindent.png \
stock-icons/16/gtk-zoom-100.png \
stock-icons/16/gtk-zoom-fit.png \
stock-icons/16/gtk-zoom-in.png \
stock-icons/16/gtk-zoom-out.png \
stock-icons/16/gtk-italic.png \
stock-icons/16/gtk-bold.png \
stock-icons/20/gtk-apply.png \
stock-icons/20/gtk-cancel.png \
stock-icons/20/gtk-close.png \
stock-icons/20/gtk-no.png \
stock-icons/20/gtk-ok.png \
stock-icons/20/gtk-yes.png \
stock-icons/24/gtk-about.png \
stock-icons/24/gtk-add.png \
stock-icons/24/gtk-bold.png \
stock-icons/24/gtk-cdrom.png \
stock-icons/24/gtk-clear.png \
stock-icons/24/gtk-close.png \
stock-icons/24/gtk-color-picker.png \
stock-icons/24/gtk-connect.png \
stock-icons/24/gtk-convert.png \
stock-icons/24/gtk-copy.png \
stock-icons/24/gtk-cut.png \
stock-icons/24/gtk-directory.png \
stock-icons/24/gtk-disconnect.png \
stock-icons/24/gtk-edit.png \
stock-icons/24/gtk-execute.png \
stock-icons/24/gtk-file.png \
stock-icons/24/gtk-find-and-replace.png \
stock-icons/24/gtk-find.png \
stock-icons/24/gtk-font.png \
stock-icons/24/gtk-fullscreen.png \
stock-icons/24/gtk-go-back-ltr.png \
stock-icons/24/gtk-goto-top.png \
stock-icons/24/gtk-go-down.png \
stock-icons/24/gtk-goto-bottom.png \
stock-icons/24/gtk-goto-first-ltr.png \
stock-icons/24/gtk-goto-first-rtl.png \
stock-icons/24/gtk-goto-last-ltr.png \
stock-icons/24/gtk-goto-last-rtl.png \
stock-icons/24/gtk-go-up.png \
stock-icons/24/gtk-harddisk.png \
stock-icons/24/gtk-help.png \
stock-icons/24/gtk-home.png \
stock-icons/24/gtk-indent.png \
stock-icons/24/gtk-index.png \
stock-icons/24/gtk-info.png \
stock-icons/24/gtk-italic.png \
stock-icons/24/gtk-jump-to-ltr.png \
stock-icons/24/gtk-jump-to-rtl.png \
stock-icons/24/gtk-justify-center.png \
stock-icons/24/gtk-justify-fill.png \
stock-icons/24/gtk-justify-left.png \
stock-icons/24/gtk-justify-right.png \
stock-icons/24/gtk-leave-fullscreen.png \
stock-icons/24/gtk-media-forward-ltr.png \
stock-icons/24/gtk-media-forward-rtl.png \
stock-icons/24/gtk-media-next-ltr.png \
stock-icons/24/gtk-media-next-rtl.png \
stock-icons/24/gtk-media-pause.png \
stock-icons/24/gtk-media-play-ltr.png \
stock-icons/24/gtk-media-play-rtl.png \
stock-icons/24/gtk-media-previous-ltr.png \
stock-icons/24/gtk-media-previous-rtl.png \
stock-icons/24/gtk-media-record.png \
stock-icons/24/gtk-media-rewind-ltr.png \
stock-icons/24/gtk-media-rewind-rtl.png \
stock-icons/24/gtk-media-stop.png \
stock-icons/24/gtk-missing-image.png \
stock-icons/24/gtk-network.png \
stock-icons/24/gtk-new.png \
stock-icons/24/gtk-open.png \
stock-icons/24/gtk-paste.png \
stock-icons/24/gtk-preferences.png \
stock-icons/24/gtk-print.png \
stock-icons/24/gtk-print-preview.png \
stock-icons/24/gtk-properties.png \
stock-icons/24/gtk-quit.png \
stock-icons/24/gtk-redo-ltr.png \
stock-icons/24/gtk-redo-rtl.png \
stock-icons/24/gtk-refresh.png \
stock-icons/24/gtk-remove.png \
stock-icons/24/gtk-revert-to-saved-ltr.png \
stock-icons/24/gtk-revert-to-saved-rtl.png \
stock-icons/24/gtk-select-font.png \
stock-icons/24/gtk-save-as.png \
stock-icons/24/gtk-floppy.png \
stock-icons/24/gtk-select-all.png \
stock-icons/24/gtk-select-color.png \
stock-icons/24/gtk-sort-ascending.png \
stock-icons/24/gtk-sort-descending.png \
stock-icons/24/gtk-spell-check.png \
stock-icons/24/gtk-stop.png \
stock-icons/24/gtk-strikethrough.png \
stock-icons/24/gtk-delete.png \
stock-icons/24/gtk-undelete-ltr.png \
stock-icons/24/gtk-undelete-rtl.png \
stock-icons/24/gtk-underline.png \
stock-icons/24/gtk-undo-ltr.png \
stock-icons/24/gtk-undo-rtl.png \
stock-icons/24/gtk-unindent.png \
stock-icons/24/gtk-zoom-100.png \
stock-icons/24/gtk-zoom-fit.png \
stock-icons/24/gtk-zoom-in.png \
stock-icons/24/gtk-zoom-out.png \
stock-icons/24/gtk-go-forward-ltr.png \
stock-icons/24/gtk-go-forward-rtl.png \
stock-icons/24/gtk-go-back-rtl.png \
stock-icons/24/gtk-save.png \
stock-icons/32/gtk-dnd-multiple.png \
stock-icons/32/gtk-dnd.png \
stock-icons/48/gtk-dialog-authentication.png \
stock-icons/48/gtk-dialog-error.png \
stock-icons/48/gtk-dialog-info.png \
stock-icons/48/gtk-dialog-question.png \
stock-icons/48/gtk-dialog-warning.png
icons:
for i in 16 24; do \
(cd stock-icons/$$i \
$(LN_S) gtk-go-forward-ltr.png gtk-go-back-rtl.png \
$(LN_S) gtk-go-back-ltr.png gtk-go-forward-rtl.png \
$(LN_S) gtk-goto-first-ltr.png gtk-goto-last-rtl.png \
$(LN_S) gtk-goto-last-ltr.png gtk-goto-first-rtl.png \
$(LN_S) gtk-media-forward-ltr.png gtk-media-rewind-rtl.png \
$(LN_S) gtk-media-rewind-ltr.png gtk-media-forward-rtl.png \
$(LN_S) gtk-media-next-ltr.png gtk-media-previous-rtl.png \
$(LN_S) gtk-media-previous-ltr.png gtk-media-next-rtl.png \
$(LN_S) gtk-floppy.png gtk-save.png \
cd ../..) \
done
gtkbuiltincache.h: @REBUILD@ gtk-update-icon-cache icons
./gtk-update-icon-cache --force --ignore-theme-index \
--source builtin_icons stock-icons > gtkbuiltincache.h
EXTRA_DIST += \
$(STOCK_ICONS) \
line-arrow.xbm \
line-wrap.xbm \
tree_plus.xbm \
......
......@@ -70,7 +70,8 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
GTK_NOTE (ICONTHEME,
g_print ("unmapping icon cache\n"));
g_mapped_file_free (cache->map);
if (cache->map)
g_mapped_file_free (cache->map);
g_free (cache);
}
}
......@@ -146,13 +147,26 @@ _gtk_icon_cache_new_for_path (const gchar *path)
return cache;
}
static int
GtkIconCache *
_gtk_icon_cache_new (const gchar *data)
{
GtkIconCache *cache;
cache = g_new0 (GtkIconCache, 1);
cache->ref_count = 1;
cache->map = NULL;
cache->buffer = (gchar *)data;
return cache;
}
static gint
get_directory_index (GtkIconCache *cache,
const gchar *directory)
{
guint32 dir_list_offset;
int n_dirs;
int i;
gint n_dirs;
gint i;
dir_list_offset = GET_UINT32 (cache->buffer, 8);
......@@ -327,6 +341,62 @@ _gtk_icon_cache_has_icon (GtkIconCache *cache,
return FALSE;
}
gboolean
_gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
const gchar *icon_name,
const gchar *directory)
{
guint32 hash_offset;
guint32 n_buckets;
guint32 chain_offset;
gint hash;
gboolean found_icon = FALSE;
gint directory_index;
directory_index = get_directory_index (cache, directory);
if (directory_index == -1)
return FALSE;
hash_offset = GET_UINT32 (cache->buffer, 4);
n_buckets = GET_UINT32 (cache->buffer, hash_offset);
hash = icon_name_hash (icon_name) % n_buckets;
chain_offset = GET_UINT32 (cache->buffer, hash_offset + 4 + 4 * hash);
while (chain_offset != 0xffffffff)
{
guint32 name_offset = GET_UINT32 (cache->buffer, chain_offset + 4);
gchar *name = cache->buffer + name_offset;
if (strcmp (name, icon_name) == 0)
{
found_icon = TRUE;
break;
}
chain_offset = GET_UINT32 (cache->buffer, chain_offset);
}
if (found_icon)
{
guint32 image_list_offset = GET_UINT32 (cache->buffer, chain_offset + 8);
guint32 n_images = GET_UINT32 (cache->buffer, image_list_offset);
guint32 image_offset = image_list_offset + 4;
gint i;
for (i = 0; i < n_images; i++)
{
guint16 index = GET_UINT16 (cache->buffer, image_offset);
if (index == directory_index)
return TRUE;
image_offset += 8;
}
}
return FALSE;
}
static void
pixbuf_destroy_cb (guchar *pixels,
gpointer data)
......
......@@ -36,11 +36,15 @@ struct _GtkIconData
gchar *display_name;
};
GtkIconCache *_gtk_icon_cache_new (const gchar *data);
GtkIconCache *_gtk_icon_cache_new_for_path (const gchar *path);
gboolean _gtk_icon_cache_has_directory (GtkIconCache *cache,
const gchar *directory);
gboolean _gtk_icon_cache_has_icon (GtkIconCache *cache,
const gchar *icon_name);
gboolean _gtk_icon_cache_has_icon_in_directory (GtkIconCache *cache,
const gchar *icon_name,
const gchar *directory);
void _gtk_icon_cache_add_icons (GtkIconCache *cache,
const gchar *directory,
GHashTable *hash_table);
......
This diff is collapsed.
......@@ -38,12 +38,12 @@
#include "gtkicontheme.h"
#include "gtkiconfactory.h"
#include "gtkiconcache.h"
#include "gtkbuiltincache.h"
#include "gtkintl.h"
#include "gtksettings.h"
#include "gtkprivate.h"
#include "gtkalias.h"
#define DEFAULT_THEME_NAME "hicolor"
typedef enum
......@@ -111,8 +111,6 @@ struct _GtkIconInfo
*/
gchar *cp_filename;
#endif
GdkPixbuf *builtin_pixbuf;
/* Cache pixbuf (if there is any) */
GdkPixbuf *cache_pixbuf;
......@@ -226,7 +224,7 @@ static GtkIconInfo *icon_info_new_builtin (BuiltinIcon *icon);
static IconSuffix suffix_from_name (const char *name);
static BuiltinIcon *find_builtin_icon (const gchar *icon_name,
gint size,
gint size,
gint *min_difference_p,
gboolean *has_larger_p);
......@@ -236,6 +234,11 @@ static guint signal_changed = 0;
static GHashTable *icon_theme_builtin_icons;
/* also used in gtkiconfactory.c */
GtkIconCache *_builtin_cache = NULL;
static GList *builtin_dirs = NULL;
GType
gtk_icon_theme_get_type (void)
{
......@@ -1231,16 +1234,8 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
l = l->next;
}
if (!found_default)
{
BuiltinIcon *builtin = find_builtin_icon (icon_name, size, NULL, NULL);
if (builtin)
{
icon_info = icon_info_new_builtin (builtin);
goto out;
}
}
g_assert (found_default);
unthemed_icon = g_hash_table_lookup (priv->unthemed_icons, icon_name);
if (unthemed_icon)
{
......@@ -1411,6 +1406,10 @@ gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
icon_name, NULL, NULL))
return TRUE;
if (_builtin_cache &&
_gtk_icon_cache_has_icon (_builtin_cache, icon_name))
return TRUE;
if (icon_theme_builtin_icons &&
g_hash_table_lookup_extended (icon_theme_builtin_icons,
icon_name, NULL, NULL))
......@@ -1812,6 +1811,40 @@ theme_dir_get_icon_suffix (IconThemeDir *dir,
return suffix;
}
static void
_gtk_icon_theme_ensure_builtin_cache (void)
{
static gboolean initialized = FALSE;
IconThemeDir *dir;
gint sizes[5] = { 16, 20, 24, 32, 48 };
gint n_sizes = G_N_ELEMENTS (sizes);
gint i;
if (!initialized)
{
initialized = TRUE;
_builtin_cache = _gtk_icon_cache_new ((gchar *)builtin_icons);
for (i = 0; i < n_sizes; i++)
{
dir = g_new (IconThemeDir, 1);
dir->type = ICON_THEME_DIR_THRESHOLD;
dir->context = 0;
dir->size = sizes[i];
dir->min_size = sizes[i];
dir->max_size = sizes[i];
dir->threshold = 2;
dir->dir = NULL;
dir->icon_data = NULL;
dir->subdir = g_strdup_printf ("%d", sizes[i]);
dir->cache = _gtk_icon_cache_ref (_builtin_cache);
builtin_dirs = g_list_append (builtin_dirs, dir);
}
}
}
static GtkIconInfo *
theme_lookup_icon (IconTheme *theme,
const char *icon_name,
......@@ -1819,7 +1852,7 @@ theme_lookup_icon (IconTheme *theme,
gboolean allow_svg,
gboolean use_builtin)
{
GList *l;
GList *dirs, *l;
IconThemeDir *dir, *min_dir;
char *file;
int min_difference, difference;
......@@ -1834,17 +1867,24 @@ theme_lookup_icon (IconTheme *theme,
/* Builtin icons are logically part of the default theme and
* are searched before other subdirectories of the default theme.
*/
_gtk_icon_theme_ensure_builtin_cache ();
if (strcmp (theme->name, DEFAULT_THEME_NAME) == 0 && use_builtin)
{
closest_builtin = find_builtin_icon (icon_name, size,
closest_builtin = find_builtin_icon (icon_name,
size,
&min_difference,
&has_larger);
if (min_difference == 0)
return icon_info_new_builtin (closest_builtin);
dirs = builtin_dirs;
}
else
dirs = theme->dirs;
l = theme->dirs;
l = dirs;
while (l != NULL)
{
dir = l->data;
......@@ -1885,6 +1925,12 @@ theme_lookup_icon (IconTheme *theme,
}
l = l->next;
if (l == NULL && dirs == builtin_dirs)
{
dirs = theme->dirs;
l = dirs;
}
}
if (closest_builtin)
......@@ -2287,7 +2333,7 @@ icon_info_new_builtin (BuiltinIcon *icon)
{
GtkIconInfo *icon_info = icon_info_new ();
icon_info->builtin_pixbuf = g_object_ref (icon->pixbuf);
icon_info->cache_pixbuf = g_object_ref (icon->pixbuf);
icon_info->dir_type = ICON_THEME_DIR_THRESHOLD;
icon_info->dir_size = icon->size;
icon_info->threshold = 2;
......@@ -2313,8 +2359,8 @@ gtk_icon_info_copy (GtkIconInfo *icon_info)
g_return_val_if_fail (icon_info != NULL, NULL);
copy = g_memdup (icon_info, sizeof (GtkIconInfo));
if (copy->builtin_pixbuf)
g_object_ref (copy->builtin_pixbuf);
if (copy->cache_pixbuf)
g_object_ref (copy->cache_pixbuf);
if (copy->pixbuf)
g_object_ref (copy->pixbuf);
if (copy->load_error)
......@@ -2348,8 +2394,6 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
if (icon_info->cp_filename)
g_free (icon_info->cp_filename);