[Xfce4-commits] <thunar:jannis/new-shortcuts-pane> Minor adjustments to use the right icon, drop thunar_file_get_icon().
Jannis Pohlmann
noreply at xfce.org
Tue Jan 24 02:52:01 CET 2012
Updating branch refs/heads/jannis/new-shortcuts-pane
to 0941a545ebea71dd0b6c6272bd188760b5b87827 (commit)
from d82316d6863147902a61d65e3bfe7537f60055bb (commit)
commit 0941a545ebea71dd0b6c6272bd188760b5b87827
Author: Jannis Pohlmann <jannis.pohlmann at codethink.co.uk>
Date: Tue Dec 27 12:44:24 2011 +0100
Minor adjustments to use the right icon, drop thunar_file_get_icon().
thunar/thunar-file.c | 22 ----------------------
thunar/thunar-file.h | 1 -
thunar/thunar-shortcut-group.c | 2 +-
thunar/thunar-shortcut.c | 32 ++++++++++++++++++++++++--------
4 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 4441ece..c321ec5 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2980,28 +2980,6 @@ thunar_file_get_custom_icon (const ThunarFile *file)
/**
- * thunar_file_get_icon:
- * @file : a #ThunarFile instance.
- *
- * Returns the icon for @file if any, else %NULL is returned.
- *
- * Return value: the icon for @file or %NULL, the GIcon is owner
- * by the file, so do not unref it.
- **/
-GIcon *
-thunar_file_get_icon (const ThunarFile *file)
-{
- _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
-
- if (file->info == NULL)
- return NULL;
-
- return g_file_info_get_icon (file->info);
-}
-
-
-
-/**
* thunar_file_get_preview_icon:
* @file : a #ThunarFile instance.
*
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index ff424ce..ea94a95 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -242,7 +242,6 @@ const gchar *thunar_file_get_thumbnail_path (const ThunarFile *fil
gboolean thunar_file_is_thumbnail (const ThunarFile *file);
void thunar_file_set_thumb_state (ThunarFile *file,
ThunarFileThumbState state);
-GIcon *thunar_file_get_icon (const ThunarFile *file);
GIcon *thunar_file_get_preview_icon (const ThunarFile *file);
gchar *thunar_file_get_icon_name (const ThunarFile *file,
ThunarFileIconState icon_state,
diff --git a/thunar/thunar-shortcut-group.c b/thunar/thunar-shortcut-group.c
index 7e58847..c00d15e 100644
--- a/thunar/thunar-shortcut-group.c
+++ b/thunar/thunar-shortcut-group.c
@@ -37,7 +37,7 @@
#define THUNAR_SHORTCUT_GROUP_FLASH_TIMES 3
#define THUNAR_SHORTCUT_GROUP_MARKUP \
- "<span size='medium' weight='bold' color='#353535'>%s</span>"
+ "<span size='medium' weight='bold'>%s</span>"
diff --git a/thunar/thunar-shortcut.c b/thunar/thunar-shortcut.c
index 8beca47..5417b36 100644
--- a/thunar/thunar-shortcut.c
+++ b/thunar/thunar-shortcut.c
@@ -1316,11 +1316,13 @@ thunar_shortcut_matches_types (ThunarShortcut *shortcut,
static void
thunar_shortcut_update (ThunarShortcut *shortcut)
{
- const gchar *display_name;
- GIcon *icon;
- gchar *base_name;
- gchar *name;
- gchar *uri;
+ GtkIconTheme *icon_theme;
+ const gchar *display_name;
+ GIcon *icon = NULL;
+ gchar *base_name;
+ gchar *icon_name;
+ gchar *name;
+ gchar *uri;
_thunar_return_if_fail (THUNAR_IS_SHORTCUT (shortcut));
@@ -1339,13 +1341,23 @@ thunar_shortcut_update (ThunarShortcut *shortcut)
thunar_shortcut_set_name (shortcut, display_name);
/* update the icon of the shortcut */
- icon = thunar_file_get_icon (shortcut->file);
+ icon_theme = gtk_icon_theme_get_default ();
+ icon_name = thunar_file_get_icon_name (shortcut->file,
+ THUNAR_FILE_ICON_STATE_DEFAULT,
+ icon_theme);
+ g_debug ("%30s has icon name %s and custom icon %p",
+ thunar_shortcut_get_display_name (shortcut),
+ icon_name,
+ shortcut->custom_icon);
+ if (icon_name != NULL)
+ icon = g_themed_icon_new (icon_name);
thunar_shortcut_set_icon (shortcut, icon);
+ g_object_unref (icon);
+ g_free (icon_name);
if (thunar_file_get_kind (shortcut->file) == G_FILE_TYPE_MOUNTABLE)
{
- g_debug ("%s is mountable",
- display_name);
+ g_debug ("%s is mountable", display_name);
}
}
else if (shortcut->location != NULL)
@@ -2112,6 +2124,10 @@ thunar_shortcut_set_icon (ThunarShortcut *shortcut,
_thunar_return_if_fail (THUNAR_IS_SHORTCUT (shortcut));
_thunar_return_if_fail (icon == NULL || G_IS_ICON (icon));
+ g_debug ("%30s set icon to %s",
+ thunar_shortcut_get_display_name (shortcut),
+ icon ? g_icon_to_string (icon) : NULL);
+
if (icon == NULL && !shortcut->constructed)
return;
More information about the Xfce4-commits
mailing list