rpms/gtk2/F-7 gtk+-2.10.13-dont-cache-icon-pixbufs.patch, NONE, 1.1 gtk2.spec, 1.227, 1.228
Ray Strode (rstrode)
fedora-extras-commits at redhat.com
Sun Jul 8 12:32:47 UTC 2007
- Previous message (by thread): rpms/coco-coq/devel coco-coq-LICENSE.fedora, NONE, 1.1 coco-coq-wrapper.sh, NONE, 1.1 coco-coq.desktop, NONE, 1.1 coco-coq.spec, NONE, 1.1 coco-coq.xpm, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/gtk2/devel gtk2.spec, 1.241, 1.242 gtk+-2.10.13-dont-cache-icon-pixbufs.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: rstrode
Update of /cvs/pkgs/rpms/gtk2/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29621
Modified Files:
gtk2.spec
Added Files:
gtk+-2.10.13-dont-cache-icon-pixbufs.patch
Log Message:
- don't cache icon pixbufs in recentmanager code,
Patch by Emmanuele Bassi <ebassi at gnome.org>,
gnome bug 426987
gtk+-2.10.13-dont-cache-icon-pixbufs.patch:
--- NEW FILE gtk+-2.10.13-dont-cache-icon-pixbufs.patch ---
--- gtk-2.10.13/gtk/gtkrecentmanager.c (revision 18287)
+++ gtk-2.10.13/gtk/gtkrecentmanager.c (revision 18288)
@@ -1847,106 +1847,56 @@
return g_strdup (name);
}
-typedef struct
-{
- gint size;
- GdkPixbuf *pixbuf;
-} IconCacheElement;
-
-static void
-icon_cache_element_free (IconCacheElement *element)
-{
- if (element->pixbuf)
- g_object_unref (element->pixbuf);
- g_free (element);
-}
-
-static void
-icon_theme_changed (GtkIconTheme *icon_theme)
-{
- GHashTable *cache;
-
- /* Difference from the initial creation is that we don't
- * reconnect the signal
- */
- cache = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify)g_free,
- (GDestroyNotify)icon_cache_element_free);
- g_object_set_data_full (G_OBJECT (icon_theme), "gtk-recent-icon-cache",
- cache, (GDestroyNotify)g_hash_table_destroy);
-}
-
-/* TODO: use the GtkFileChooser's icon cache instead of our own to reduce
- * the memory footprint
- */
static GdkPixbuf *
-get_cached_icon (const gchar *name,
- gint pixel_size)
-{
- GtkIconTheme *icon_theme;
- GHashTable *cache;
- IconCacheElement *element;
-
- icon_theme = gtk_icon_theme_get_default ();
- cache = g_object_get_data (G_OBJECT (icon_theme), "gtk-recent-icon-cache");
-
- if (!cache)
- {
- cache = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify)g_free,
- (GDestroyNotify)icon_cache_element_free);
-
- g_object_set_data_full (G_OBJECT (icon_theme), "gtk-recent-icon-cache",
- cache, (GDestroyNotify)g_hash_table_destroy);
- g_signal_connect (icon_theme, "changed",
- G_CALLBACK (icon_theme_changed), NULL);
- }
-
- element = g_hash_table_lookup (cache, name);
- if (!element)
- {
- element = g_new0 (IconCacheElement, 1);
- g_hash_table_insert (cache, g_strdup (name), element);
- }
-
- if (element->size != pixel_size)
- {
- if (element->pixbuf)
- g_object_unref (element->pixbuf);
-
- element->size = pixel_size;
- element->pixbuf = gtk_icon_theme_load_icon (icon_theme, name,
- pixel_size, 0, NULL);
- }
-
- return element->pixbuf ? g_object_ref (element->pixbuf) : NULL;
-}
-
-
-static GdkPixbuf *
get_icon_for_mime_type (const char *mime_type,
gint pixel_size)
{
+ GtkIconTheme *icon_theme;
const char *separator;
GString *icon_name;
GdkPixbuf *pixbuf;
separator = strchr (mime_type, '/');
if (!separator)
- return NULL; /* maybe we should return a GError with "invalid MIME-type" */
+ return NULL;
+ icon_theme = gtk_icon_theme_get_default ();
+
+ /* try with the three icon name variants for MIME types */
+
+ /* canonicalize MIME type: foo/x-bar -> foo-x-bar */
+ icon_name = g_string_new (NULL);
+ g_string_append_len (icon_name, mime_type, separator - mime_type);
+ g_string_append_c (icon_name, '-');
+ g_string_append (icon_name, separator + 1);
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str,
+ pixel_size,
+ 0,
+ NULL);
+ g_string_free (icon_name, TRUE);
+ if (pixbuf)
+ return pixbuf;
+
+ /* canonicalize MIME type, and prepend "gnome-mime-" */
icon_name = g_string_new ("gnome-mime-");
g_string_append_len (icon_name, mime_type, separator - mime_type);
g_string_append_c (icon_name, '-');
g_string_append (icon_name, separator + 1);
- pixbuf = get_cached_icon (icon_name->str, pixel_size);
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str,
+ pixel_size,
+ 0,
+ NULL);
g_string_free (icon_name, TRUE);
if (pixbuf)
return pixbuf;
+ /* try the MIME family icon */
icon_name = g_string_new ("gnome-mime-");
g_string_append_len (icon_name, mime_type, separator - mime_type);
- pixbuf = get_cached_icon (icon_name->str, pixel_size);
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str,
+ pixel_size,
+ 0,
+ NULL);
g_string_free (icon_name, TRUE);
return pixbuf;
@@ -1995,7 +1945,8 @@
/* this function should never fail */
if (!retval)
{
- if (info->mime_type && strcmp (info->mime_type, "x-directory/normal") == 0)
+ if (info->mime_type &&
+ strcmp (info->mime_type, "x-directory/normal") == 0)
retval = get_icon_fallback (GTK_STOCK_DIRECTORY, size);
else
retval = get_icon_fallback (GTK_STOCK_FILE, size);
Index: gtk2.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gtk2/F-7/gtk2.spec,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -r1.227 -r1.228
--- gtk2.spec 13 Jun 2007 05:48:32 -0000 1.227
+++ gtk2.spec 8 Jul 2007 12:32:13 -0000 1.228
@@ -16,7 +16,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2
Version: %{base_version}
-Release: 1%{?dist}
+Release: 2%{?dist}
License: LGPL
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gtk+/2.10/gtk+-%{version}.tar.bz2
@@ -36,6 +36,9 @@
# fixed in upstream cvs
Patch10: gtk+-2.10.4-im-reset.patch
Patch12: gtk+-2.10.11-user-dirs.patch
+# http://bugzilla.gnome.org/show_bug.cgi?id=446183
+# http://bugzilla.gnome.org/show_bug.cgi?id=426987
+Patch13: gtk+-2.10.13-dont-cache-icon-pixbufs.patch
BuildRequires: atk-devel >= %{atk_version}
BuildRequires: pango-devel >= %{pango_version}
@@ -122,6 +125,7 @@
%patch7 -p1 -b .cursor-blink
%patch10 -p1 -b .im-reset
%patch12 -p1 -b .user-dirs
+%patch13 -p1 -b .dont-cache-icon-pixbufs
for i in config.guess config.sub ; do
test -f %{_datadir}/libtool/$i && cp %{_datadir}/libtool/$i .
@@ -288,6 +292,11 @@
%doc tmpdocs/examples
%changelog
+* Sun Jul 8 2007 Ray Strode <rstrode at redhat.com> - 2.10.13-2
+- don't cache icon pixbufs in recentmanager code,
+ Patch by Emmanuele Bassi <ebassi at gnome.org>,
+ gnome bug 426987
+
* Wed Jun 13 2007 Matthias Clasen <mclasen at redhat.com> - 2.10.13-1
- Update to 2.10.13
- Previous message (by thread): rpms/coco-coq/devel coco-coq-LICENSE.fedora, NONE, 1.1 coco-coq-wrapper.sh, NONE, 1.1 coco-coq.desktop, NONE, 1.1 coco-coq.spec, NONE, 1.1 coco-coq.xpm, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/gtk2/devel gtk2.spec, 1.241, 1.242 gtk+-2.10.13-dont-cache-icon-pixbufs.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list