[Xfce4-commits] <thunar:master> Clear cached icon when trash changed (bug #9432).
Nick Schermer
noreply at xfce.org
Thu Nov 1 21:08:01 CET 2012
Updating branch refs/heads/master
to d6d82a7534f2e79043719c6d2d60f32c9317e1cb (commit)
from b0ddb08e2d4a68c5360662112bb71544dd6cf2e0 (commit)
commit d6d82a7534f2e79043719c6d2d60f32c9317e1cb
Author: Nick Schermer <nick at xfce.org>
Date: Thu Nov 1 21:02:34 2012 +0100
Clear cached icon when trash changed (bug #9432).
thunar/thunar-icon-factory.c | 17 +++++++++++++++++
thunar/thunar-icon-factory.h | 4 ++++
thunar/thunar-trash-action.c | 4 ++++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/thunar/thunar-icon-factory.c b/thunar/thunar-icon-factory.c
index 72cb529..2f66ce9 100644
--- a/thunar/thunar-icon-factory.c
+++ b/thunar/thunar-icon-factory.c
@@ -864,3 +864,20 @@ thunar_icon_factory_load_file_icon (ThunarIconFactory *factory,
return icon;
}
+
+
+
+/**
+ * thunar_icon_factory_clear_pixmap_cache:
+ * @file : a #ThunarFile.
+ *
+ * Unset the pixmap cache on a file to force a reload on the next request.
+ **/
+void
+thunar_icon_factory_clear_pixmap_cache (ThunarFile *file)
+{
+ _thunar_return_if_fail (THUNAR_IS_FILE (file));
+
+ /* unset the data */
+ g_object_set_qdata (G_OBJECT (file), thunar_icon_factory_store_quark, NULL);
+}
diff --git a/thunar/thunar-icon-factory.h b/thunar/thunar-icon-factory.h
index fde1d09..3ceefc6 100644
--- a/thunar/thunar-icon-factory.h
+++ b/thunar/thunar-icon-factory.h
@@ -41,6 +41,8 @@ typedef struct _ThunarIconFactory ThunarIconFactory;
**/
#define THUNAR_THUMBNAIL_SIZE (128)
+
+
GType thunar_icon_factory_get_type (void) G_GNUC_CONST;
ThunarIconFactory *thunar_icon_factory_get_default (void);
@@ -56,6 +58,8 @@ GdkPixbuf *thunar_icon_factory_load_file_icon (ThunarIconFactory
ThunarFileIconState icon_state,
gint icon_size);
+void thunar_icon_factory_clear_pixmap_cache (ThunarFile *file);
+
G_END_DECLS;
#endif /* !__THUNAR_ICON_FACTORY_H__ */
diff --git a/thunar/thunar-trash-action.c b/thunar/thunar-trash-action.c
index 90a15ee..ed97e78 100644
--- a/thunar/thunar-trash-action.c
+++ b/thunar/thunar-trash-action.c
@@ -26,6 +26,7 @@
#include <thunar/thunar-stock.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-trash-action.h>
+#include <thunar/thunar-icon-factory.h>
@@ -137,6 +138,9 @@ thunar_trash_action_changed (ThunarTrashAction *trash_action,
_thunar_return_if_fail (trash_action->trash_bin == trash_bin);
_thunar_return_if_fail (THUNAR_IS_FILE (trash_bin));
+ /* unset the pixmap cache on the file */
+ thunar_icon_factory_clear_pixmap_cache (trash_bin);
+
/* adjust the stock icon appropriately */
if (thunar_file_get_item_count (trash_bin) > 0)
g_object_set (G_OBJECT (trash_action), "stock-id", THUNAR_STOCK_TRASH_FULL, NULL);
More information about the Xfce4-commits
mailing list