summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neumair <chris@gnome-de.org>2005-10-19 17:53:06 +0000
committerChristian Neumair <cneumair@src.gnome.org>2005-10-19 17:53:06 +0000
commit53c9c2a8762013c2b5d789f055ed3eb131fa0a1b (patch)
treee30bb2dc9836363bd55eaf1896e766a3e5d04a9e
parentde5d032d98d3284262bdd09454f1904ff56136ef (diff)
downloadnautilus-53c9c2a8762013c2b5d789f055ed3eb131fa0a1b.tar.gz
Use custom image for location button if available. Partially fixes #311394
2005-10-19 Christian Neumair <chris@gnome-de.org> * src/nautilus-spatial-window.c: (got_file_info_for_location_menu_callback): Use custom image for location button if available. Partially fixes #311394 and plugs a leak.
-rw-r--r--ChangeLog7
-rw-r--r--src/nautilus-spatial-window.c26
2 files changed, 28 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d19e7e534..297aa1a4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-10-19 Christian Neumair <chris@gnome-de.org>
+
+ * src/nautilus-spatial-window.c:
+ (got_file_info_for_location_menu_callback):
+ Use custom image for location button if available. Partially fixes
+ #311394 and plugs a leak.
+
2005-10-19 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-list-view.c (fm_list_view_start_renaming_file):
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 9beb1d56a..67610d79b 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -448,13 +448,22 @@ got_file_info_for_location_menu_callback (NautilusFile *file,
{
GtkWidget *icon;
GtkWidget *menu_item = callback_data;
+ GdkPixbuf *pixbuf;
char *icon_name;
g_return_if_fail (NAUTILUS_IS_FILE (file));
+ pixbuf = NULL;
+
icon_name = nautilus_icon_factory_get_icon_for_file (file, FALSE);
- if (icon_name) {
- icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+ if (icon_name != NULL) {
+ pixbuf = nautilus_icon_factory_get_pixbuf_from_name_with_stock_size (icon_name, NULL, GTK_ICON_SIZE_MENU, NULL);
+ g_free (icon_name);
+ }
+
+ if (pixbuf != NULL) {
+ icon = gtk_image_new_from_pixbuf (pixbuf);
+ gdk_pixbuf_unref (pixbuf);
} else {
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
}
@@ -680,12 +689,19 @@ nautilus_spatial_window_set_location_button (NautilusSpatialWindow *window,
vfs_result_code = nautilus_file_get_file_info_result (file);
if (vfs_result_code == GNOME_VFS_OK) {
char *icon_name;
+ GdkPixbuf *pixbuf;
+
+ pixbuf = NULL;
icon_name = nautilus_icon_factory_get_icon_for_file (file, FALSE);
- if (icon_name) {
- gtk_image_set_from_icon_name (GTK_IMAGE (window->details->location_icon),
- icon_name, GTK_ICON_SIZE_MENU);
+ if (icon_name != NULL) {
+ pixbuf = nautilus_icon_factory_get_pixbuf_from_name_with_stock_size (icon_name, NULL, GTK_ICON_SIZE_MENU, NULL);
g_free (icon_name);
+ }
+
+ if (pixbuf != NULL) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (window->details->location_icon), pixbuf);
+ gdk_pixbuf_unref (pixbuf);
} else {
gtk_image_set_from_stock (GTK_IMAGE (window->details->location_icon),
GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);