[Goodies-commits] r2805 - xfce4-places-plugin/trunk/panel-plugin
Diego Ongaro
ongardie at xfce.org
Sun Jun 3 08:39:06 CEST 2007
Author: ongardie
Date: 2007-06-03 06:39:06 +0000 (Sun, 03 Jun 2007)
New Revision: 2805
Modified:
xfce4-places-plugin/trunk/panel-plugin/model_system.c
Log:
2007-06-03 Diego Ongaro <ongardie at gmail.com>
* Use thunar-vfs to get and update trash icon (empty/full)
Modified: xfce4-places-plugin/trunk/panel-plugin/model_system.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model_system.c 2007-06-03 05:09:43 UTC (rev 2804)
+++ xfce4-places-plugin/trunk/panel-plugin/model_system.c 2007-06-03 06:39:06 UTC (rev 2805)
@@ -24,19 +24,23 @@
#include "model_system.h"
#include "model.h"
#include <libxfce4util/libxfce4util.h>
-#include <string.h>
+#include <thunar-vfs/thunar-vfs.h>
+#include <string.h> // for strcmp()
#define bookmarks_system_check_existence data
struct _BookmarksSystem
{
GPtrArray *bookmarks;
+ ThunarVfsPath *trash_path;
};
BookmarksSystem*
places_bookmarks_system_init()
{
+ thunar_vfs_init();
+
BookmarksSystem *b = g_new0(BookmarksSystem, 1);
BookmarkInfo *bookmark;
@@ -57,9 +61,18 @@
// Trash
bookmark = g_new0(BookmarkInfo, 1);
+
bookmark->label = g_strdup(_("Trash"));
bookmark->uri = g_strdup("trash:///");
- bookmark->icon = g_strdup("gnome-fs-trash-full");
+
+ b->trash_path = thunar_vfs_path_get_for_trash();
+
+ ThunarVfsInfo *trash_info = thunar_vfs_info_new_for_path(b->trash_path, NULL);
+ bookmark->icon = g_strdup(trash_info->custom_icon);
+ if(bookmark->icon == NULL)
+ bookmark->icon = g_strdup("gnome-fs-trash-full");
+ thunar_vfs_info_unref(trash_info);
+
bookmark->show = TRUE;
bookmark->bookmarks_system_check_existence = NULL;
g_ptr_array_add(b->bookmarks, bookmark);
@@ -99,7 +112,17 @@
ret = TRUE;
}
}
-
+
+ // see if trash gets a different icon (e.g., was empty, now full)
+ bi = g_ptr_array_index(b->bookmarks, 1);
+ ThunarVfsInfo *trash_info = thunar_vfs_info_new_for_path(b->trash_path, NULL);
+ if(trash_info->custom_icon != NULL && strcmp(trash_info->custom_icon, bi->icon) != 0){
+ g_free(bi->icon);
+ bi->icon = g_strdup(trash_info->custom_icon);
+ ret = TRUE;
+ }
+ thunar_vfs_info_unref(trash_info);
+
return ret;
}
@@ -121,7 +144,9 @@
places_bookmarks_system_finalize(BookmarksSystem *b)
{
g_ptr_array_free(b->bookmarks, TRUE);
+ thunar_vfs_path_unref(b->trash_path);
g_free(b);
+ thunar_vfs_shutdown();
}
/*
More information about the Goodies-commits
mailing list