Author: kelnos
Date: 2007-10-20 23:58:47 +0000 (Sat, 20 Oct 2007)
New Revision: 26168
Modified:
xfdesktop/trunk/configure.ac.in
xfdesktop/trunk/src/xfdesktop-special-file-icon.c
xfdesktop/trunk/src/xfdesktop-volume-icon.c
Log:
mess with tooltips
Modified: xfdesktop/trunk/configure.ac.in
===================================================================
--- xfdesktop/trunk/configure.ac.in 2007-10-20 23:58:38 UTC (rev 26167)
+++ xfdesktop/trunk/configure.ac.in 2007-10-20 23:58:47 UTC (rev 26168)
@@ -41,7 +41,8 @@
dnl check for standard header files
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h errno.h fcntl.h math.h signal.h stddef.h \
- string.h sys/mman.h sys/stat.h sys/types.h sys/wait.h time.h
\
+ string.h sys/mman.h sys/stat.h sys/statvfs.h \
+ sys/types.h sys/wait.h time.h \
unistd.h])
AC_CHECK_FUNCS([mmap sigaction srandom])
Modified: xfdesktop/trunk/src/xfdesktop-special-file-icon.c
===================================================================
--- xfdesktop/trunk/src/xfdesktop-special-file-icon.c 2007-10-20 23:58:38 UTC
(rev 26167)
+++ xfdesktop/trunk/src/xfdesktop-special-file-icon.c 2007-10-20 23:58:47 UTC
(rev 26168)
@@ -476,23 +476,29 @@
{
XfdesktopSpecialFileIcon *special_file_icon =
XFDESKTOP_SPECIAL_FILE_ICON(icon);
- /* FIXME: implement trash stuff */
-
if(!special_file_icon->priv->tooltip) {
- gchar mod[64], *kind, sizebuf[64], *size;
- struct tm *tm = localtime(&special_file_icon->priv->info->mtime);
+ if(XFDESKTOP_SPECIAL_FILE_ICON_TRASH == special_file_icon->priv->type)
{
+ /* FIXME: also display # of items in trash */
+ special_file_icon->priv->tooltip = g_strdup(_("Kind: Trash"));
+ } else {
+ gchar mod[64], *kind, sizebuf[64], *size;
+ struct tm *tm = localtime(&special_file_icon->priv->info->mtime);
- strftime(mod, 64, "%Y-%m-%d %H:%M:%S", tm);
- kind =
xfdesktop_file_utils_get_file_kind(special_file_icon->priv->info, NULL);
- thunar_vfs_humanize_size(special_file_icon->priv->info->size, sizebuf,
64);
- size = g_strdup_printf(_("%s (%" G_GINT64_FORMAT " Bytes)"), sizebuf,
- (gint64)special_file_icon->priv->info->size);
-
- special_file_icon->priv->tooltip = g_strdup_printf(_("Kind:
%s\nModified:%s\nSize: %s"),
- kind, mod, size);
-
- g_free(kind);
- g_free(size);
+ strftime(mod, 64, "%Y-%m-%d %H:%M:%S", tm);
+ kind =
xfdesktop_file_utils_get_file_kind(special_file_icon->priv->info,
+ NULL);
+ thunar_vfs_humanize_size(special_file_icon->priv->info->size,
+ sizebuf, 64);
+ size = g_strdup_printf(_("%s (%" G_GINT64_FORMAT " Bytes)"),
+ sizebuf,
+ (gint64)special_file_icon->priv->info->size);
+
+ special_file_icon->priv->tooltip = g_strdup_printf(_("Kind:
%s\nModified:%s\nSize: %s"),
+ kind, mod,
size);
+
+ g_free(kind);
+ g_free(size);
+ }
}
return special_file_icon->priv->tooltip;
@@ -615,10 +621,13 @@
{
XfdesktopSpecialFileIcon *special_file_icon =
XFDESKTOP_SPECIAL_FILE_ICON(icon);
GtkWidget *mi, *img;
+ GtkIconTheme *icon_theme;
if(XFDESKTOP_SPECIAL_FILE_ICON_TRASH != special_file_icon->priv->type)
return FALSE;
+ icon_theme = gtk_icon_theme_get_default();
+
img = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
gtk_widget_show(img);
mi = gtk_image_menu_item_new_with_mnemonic(_("_Open"));
@@ -632,7 +641,16 @@
gtk_widget_show(mi);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+ if(gtk_icon_theme_has_icon(icon_theme, "user-trash"))
+ img = gtk_image_new_from_icon_name("user-trash", GTK_ICON_SIZE_MENU);
+ else if(gtk_icon_theme_has_icon(icon_theme, "gnome-fs-trash-empty"))
+ img = gtk_image_new_from_icon_name("gnome-fs-trash-empty",
GTK_ICON_SIZE_MENU);
+ else
+ img = NULL;
+
mi = gtk_image_menu_item_new_with_mnemonic(_("_Empty Trash"));
+ if(img)
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
gtk_widget_show(mi);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
if(special_file_icon->priv->trash_full) {
Modified: xfdesktop/trunk/src/xfdesktop-volume-icon.c
===================================================================
--- xfdesktop/trunk/src/xfdesktop-volume-icon.c 2007-10-20 23:58:38 UTC (rev
26167)
+++ xfdesktop/trunk/src/xfdesktop-volume-icon.c 2007-10-20 23:58:47 UTC (rev
26168)
@@ -35,6 +35,10 @@
#include <time.h>
#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
@@ -452,20 +456,33 @@
/* FIXME: something different? */
if(!volume_icon->priv->tooltip) {
- gchar mod[64], *kind, sizebuf[64], *size;
- struct tm *tm = localtime(&volume_icon->priv->info->mtime);
-
- strftime(mod, 64, "%Y-%m-%d %H:%M:%S", tm);
- kind = xfdesktop_file_utils_get_file_kind(volume_icon->priv->info,
NULL);
- thunar_vfs_humanize_size(volume_icon->priv->info->size, sizebuf, 64);
- size = g_strdup_printf(_("%s (%" G_GINT64_FORMAT " Bytes)"), sizebuf,
- (gint64)volume_icon->priv->info->size);
+ gchar freebuf[128], totbuf[128], *space;
+ ThunarVfsPath *path;
+ gchar mntpnt[THUNAR_VFS_PATH_MAXSTRLEN] = { 0, };
+ ThunarVfsFileSize size;
+ struct statvfs stfs;
- volume_icon->priv->tooltip = g_strdup_printf(_("Kind:
%s\nModified:%s\nSize: %s"),
- kind, mod, size);
+ path = thunar_vfs_volume_get_mount_point(volume_icon->priv->volume);
+ if(path
+ && thunar_vfs_path_to_string(path, mntpnt, sizeof(mntpnt), NULL) > 0
+ && thunar_vfs_info_get_free_space(volume_icon->priv->info, &size)
+ && !statvfs(mntpnt, &stfs))
+ {
+ thunar_vfs_humanize_size(size, freebuf, sizeof(freebuf));
+ thunar_vfs_humanize_size((ThunarVfsFileSize)(stfs.f_blocks *
stfs.f_bsize),
+ totbuf, sizeof(totbuf));
+ space = g_strdup_printf(_("%s (%s total)"), freebuf, totbuf);
+ } else
+ space = g_strdup(_("(unknown)"));
- g_free(kind);
- g_free(size);
+ volume_icon->priv->tooltip = g_strdup_printf(_("Kind: Removable
Volume\n"
+ "Mount Point: %s\n"
+ "Free Space: %s"),
+ *mntpnt ? mntpnt
+ : _("(unknown)"),
+ space);
+
+ g_free(space);
}
return volume_icon->priv->tooltip;
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits