Nautilus Volume Icon Fallbacks
- From: Rodney Dawes <dobey gnome org>
- To: nautilus-list gnome org
- Subject: Nautilus Volume Icon Fallbacks
- Date: Thu, 18 Dec 2008 14:08:44 -0500
Hi,
In some places, nautilus is falling back to the incorrect icons in some
places, such as using a folder icon instead of a disk icon, or in some
cases is not falling back to appropriate icons at all, where it should
be. I've made a patch to correct this, and submitted it to bugzilla, but
there has been virtually no feedback. The patch is attached here as
well, but the bug is http://bugzilla.gnome.org/show_bug.cgi?id=550704
for reference.
I would like to get this in asap, as it makes the icon usage much more
consistent throughout the entire nautilus UI (computer, path bar, places
sidebar, etc...).
Thanks,
Rodney
Index: src/nautilus-pathbar.c
===================================================================
--- src/nautilus-pathbar.c (revision 14576)
+++ src/nautilus-pathbar.c (working copy)
@@ -1365,8 +1365,24 @@ is_file_path_mounted_mount (GFile *locat
/* set mount specific details in button_data */
if (button_data) {
icon = g_mount_get_icon (mount);
+ if (G_IS_THEMED_ICON (icon)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (icon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (icon);
+ icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
if (icon == NULL) {
- icon = g_themed_icon_new (NAUTILUS_ICON_FOLDER);
+ icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
}
info = nautilus_icon_info_lookup (icon, NAUTILUS_PATH_BAR_ICON_SIZE);
g_object_unref (icon);
Index: src/file-manager/fm-tree-view.c
===================================================================
--- src/file-manager/fm-tree-view.c (revision 14576)
+++ src/file-manager/fm-tree-view.c (working copy)
@@ -594,6 +594,22 @@ add_root_for_mount (FMTreeView *view,
g_object_unref (root);
name = g_mount_get_name (mount);
+ if (G_IS_THEMED_ICON (icon)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (icon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (icon);
+ icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
fm_tree_model_add_root_uri(view->details->child_model,
mount_uri, name, icon, mount);
Index: src/nautilus-places-sidebar.c
===================================================================
--- src/nautilus-places-sidebar.c (revision 14576)
+++ src/nautilus-places-sidebar.c (working copy)
@@ -355,6 +355,22 @@ update_places (NautilusPlacesSidebar *si
mount_uri = g_file_get_uri (root);
g_object_unref (root);
name = g_mount_get_name (mount);
+ if (G_IS_THEMED_ICON (icon)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (icon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (icon);
+ icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
name, icon, mount_uri,
drive, volume, mount, 0);
Index: libnautilus-private/nautilus-desktop-link.c
===================================================================
--- libnautilus-private/nautilus-desktop-link.c (revision 14576)
+++ libnautilus-private/nautilus-desktop-link.c (working copy)
@@ -82,7 +82,23 @@ mount_changed_callback (GMount *mount, N
link->details->display_name = g_mount_get_name (mount);
link->details->activation_location = g_mount_get_root (mount);
link->details->icon = g_mount_get_icon (mount);
-
+ if (G_IS_THEMED_ICON (link->details->icon)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (link->details->icon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (link->details->icon);
+ link->details->icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
+
nautilus_desktop_link_changed (link);
}
@@ -263,6 +279,22 @@ nautilus_desktop_link_new_from_mount (GM
link->details->activation_location = g_mount_get_root (mount);
link->details->icon = g_mount_get_icon (mount);
+ if (G_IS_THEMED_ICON (link->details->icon)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (link->details->icon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (link->details->icon);
+ link->details->icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
link->details->signal_handler_obj = G_OBJECT (mount);
link->details->signal_handler =
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c (revision 14576)
+++ libnautilus-private/nautilus-file.c (working copy)
@@ -37,6 +37,7 @@
#include "nautilus-file-operations.h"
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
+#include "nautilus-icon-names.h"
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-link.h"
#include "nautilus-metadata.h"
@@ -3555,6 +3556,23 @@ nautilus_file_get_icon (NautilusFile *fi
gicon = g_themed_icon_new (ICON_NAME_THUMBNAIL_LOADING);
else
gicon = nautilus_file_get_gicon (file, flags);
+
+ if (G_IS_THEMED_ICON (gicon) && nautilus_file_can_unmount (file)) {
+ const char * const *icons;
+ int i;
+
+ icons = g_themed_icon_get_names (G_THEMED_ICON (gicon));
+ for (i = 0; icons[i] != NULL; i++) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ icons[i])) {
+ break;
+ }
+ }
+ if (icons[i] == NULL) {
+ g_object_unref (gicon);
+ gicon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
+ }
+ }
if (gicon) {
icon = nautilus_icon_info_lookup (gicon, size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]