Re: [PATCH] Use desktop icon from theme
- From: Luca Ferretti <elle uca libero it>
- To: Alexander Larsson <alexl redhat com>
- Cc: Nautilus <nautilus-list gnome org>
- Subject: Re: [PATCH] Use desktop icon from theme
- Date: Tue, 16 Sep 2003 13:32:34 +0200
On lun, 2003-10-13 at 15:42 +0200, Alexander Larsson wrote:
> On Sat, 2003-10-11 at 21:58, Luca Ferretti wrote:
> + icon_theme = gnome_icon_theme_new ();
>
> This creates a totally new icon theme, which is pretty slow. You should
> use nautilus_icon_factory_get_icon_theme() instead.
>
Here is a *_lookup_icon() too?
> + g_free (icon_theme);
>
> This isn't right, since it wasn't allocated with g_malloc. You need to
> use g_object_unref().
>
Good, I made a new one. Unfortunately the metacity window switcher
(Alt-Ctrl-Tab) don't use themed icons. I'll add a bug later.
Thanks to Danny Milosavljevic (free the icon_theme on error (path ==
NULL))
PS Sorry for the non-cvs diff
PPS Oh, before I forgot: it's based on files in gnome-2-4 branch
diff -Naur nautilus/src/nautilus-window-manage-views.c nautilus-new/src/nautilus-window-manage-views.c
--- nautilus/src/nautilus-window-manage-views.c 2003-09-16 13:24:25.000000000 +0200
+++ nautilus-new/src/nautilus-window-manage-views.c 2003-09-16 13:24:50.000000000 +0200
@@ -51,6 +51,7 @@
#include <gdk/gdkx.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-icon-theme.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -275,18 +276,25 @@
{
char *path;
GdkPixbuf *pixbuf;
+ GnomeIconTheme *icon_theme;
pixbuf = NULL;
/* Desktop window special icon */
if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- path = nautilus_pixmap_file ("nautilus-desktop.png");
+ icon_theme = nautilus_icon_factory_get_icon_theme();
+ path = gnome_icon_theme_lookup_icon (icon_theme,
+ "gnome-fs-desktop", 48,
+ NULL, NULL);
if (path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (path, NULL);
g_free (path);
}
+
+ g_object_unref(icon_theme);
+
} else {
pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
"open",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]