[Xfce4-commits] <thunar:nick/on-demand-content-type> Special case handing for trash icons.
Nick Schermer
noreply at xfce.org
Sun Nov 18 21:34:01 CET 2012
Updating branch refs/heads/nick/on-demand-content-type
to c9d68a659fb9633c2456de8cddc65d873ce427ed (commit)
from 97f0ffcd69771383e79c324176d17815e89b399d (commit)
commit c9d68a659fb9633c2456de8cddc65d873ce427ed
Author: Nick Schermer <nick at xfce.org>
Date: Sun Nov 18 21:33:39 2012 +0100
Special case handing for trash icons.
thunar/thunar-file.c | 56 ++++++++++++++++++++++++++++---------------------
1 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 3325b30..07a983d 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3482,47 +3482,55 @@ thunar_file_get_icon_name (ThunarFile *file,
return thunar_file_get_icon_name_for_state (file->icon_name, icon_state);
/* the system root folder has a special icon */
- if (thunar_file_is_directory (file)
- && thunar_file_is_local (file))
+ if (thunar_file_is_directory (file))
{
- path = g_file_get_path (file->gfile);
- if (G_LIKELY (path != NULL))
+ if (G_LIKELY (thunar_file_is_local (file)))
{
- if (strcmp (path, G_DIR_SEPARATOR_S) == 0)
- *special_names = "drive-harddisk";
- else if (strcmp (path, xfce_get_homedir ()) == 0)
- *special_names = "user-home";
- else
+ path = g_file_get_path (file->gfile);
+ if (G_LIKELY (path != NULL))
{
- for (i = 0; i < G_N_ELEMENTS (thunar_file_dirs); i++)
+ if (strcmp (path, G_DIR_SEPARATOR_S) == 0)
+ *special_names = "drive-harddisk";
+ else if (strcmp (path, xfce_get_homedir ()) == 0)
+ *special_names = "user-home";
+ else
{
- special_dir = g_get_user_special_dir (thunar_file_dirs[i].type);
- if (special_dir != NULL
- && strcmp (path, special_dir) == 0)
+ for (i = 0; i < G_N_ELEMENTS (thunar_file_dirs); i++)
{
- *special_names = thunar_file_dirs[i].icon_name;
- break;
+ special_dir = g_get_user_special_dir (thunar_file_dirs[i].type);
+ if (special_dir != NULL
+ && strcmp (path, special_dir) == 0)
+ {
+ *special_names = thunar_file_dirs[i].icon_name;
+ break;
+ }
}
}
- }
- g_free (path);
-
- if (*special_names != NULL)
- {
- names = special_names;
- goto check_names;
+ g_free (path);
}
}
+ else if (g_file_has_uri_scheme (file->gfile, "trash")
+ && !thunar_file_has_parent (file))
+ {
+ special_names[0] = thunar_file_get_item_count (file) > 0 ? "user-trash-full" : "user-trash";
+ special_names[1] = "user-trash";
+ }
+
+ if (*special_names != NULL)
+ {
+ names = special_names;
+ goto check_names;
+ }
}
/* try again later */
if (file->info == NULL)
return NULL;
- /* lookup for content type, just like gio does*/
+ /* lookup for content type, just like gio does for local files */
icon = g_content_type_get_icon (thunar_file_get_content_type (file));
- if (icon != NULL)
+ if (G_LIKELY (icon != NULL))
{
if (G_IS_THEMED_ICON (icon))
{
More information about the Xfce4-commits
mailing list