generic-poky/meta/recipes-gnome/gtk+/gtk+-2.12.7/filesystem-volumes.patch

201 lines
4.7 KiB
Diff
Raw Normal View History

recipes: Add Upstream-Status to multiple recipes gtk+: Add Upstream-Status ed: Add Upstream-Status gnome-common: Add Upstream-Status libmatchbox: Add Upstream-Status matchbox-wm: Add Upstream-Status x11vnc: Add Upstream-Status xtscal: Add Upstream-Status eds-dbus: Add Upstream-Status matchbox-desktop: Add Upstream-Status matchbox-keyboard: Add Upstream-Status matchbox-stroke: Add Upstream-Status matchbox-theme-sato: Add Upstream-Status owl-video-widget: Add Upstream-Status beecrypt: Add Upstream-Status gnome-icon-theme: Add Upstream-Status tslib: Add Upstream-Status libowl-av: Add Upstream-Status sato-icon-theme: Add Upstream-Status web-webkit: Add Upstream-Status metacity: Add Upstream-Status apr: Add Upstream-Status gdk-pixbuf: Add Upstream-Status pcmanfm: Add Upstream-Status gpgme: Add Upstream-Status eee-acpi-scripts: Add Upstream-Status libgalago: Add Upstream-Status python-pygtk: Add Upstream-Status gnome-mime-data: Add Upstream-Status clutter: Add Upstream-Status clutter-gtk: Add Upstream-Status tidy: Add Upstream-Status mutter: Add Upstream-Status xcursor-transparent-theme: Add Upstream-Status leafpad: Add Upstream-Status matchbox-config-gtk: Add Upstream-Status contacts: Add Upstream-Status dates: Add Upstream-Status web: Add Upstream-Status webkit: Add Upstream-Status - Also removed empty fix_im.patch apr-util: Add Upstream-Status libcroco: Add Upstream-Status liboil: Add Upstream-Status libxslt: Add Upstream-Status libglade: Add Upstream-Status gnome-terminal: Add Upstream-Status xev: Add Upstream-Status claws-mail: Add Upstream-Status clipboard-manager: Add Upstream-Status epdfview: Add Upstream-Status kf: Add Upstream-Status qemu: Add Upstream-Status clutter-gst: Add Upstream-Status table: Add Upstream-Status matchbox-panel-2: Add Upstream-Status (From OE-Core rev: 10bdb737c2c4c6996fd035849109a1e07580a6b9) Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-12 00:08:05 +00:00
Upstream-Status: Inappropriate [enable feature]
Index: gtk+-2.12.3/gtk/gtkfilesystemunix.c
===================================================================
--- gtk+-2.12.3.orig/gtk/gtkfilesystemunix.c 2007-12-04 16:52:08.000000000 +0000
+++ gtk+-2.12.3/gtk/gtkfilesystemunix.c 2008-01-02 13:15:02.000000000 +0000
@@ -38,6 +38,7 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <sys/types.h>
#include <pwd.h>
#ifdef HAVE_UNISTD_H
@@ -474,7 +475,55 @@
static GSList *
gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
{
- return g_slist_append (NULL, get_root_volume ());
+ struct statvfs stv;
+ struct stat st;
+ GSList * l = g_slist_append (NULL, get_root_volume ());
+
+ if (!statvfs ("/.", &stv))
+ {
+ fsblkcnt_t root_blocks = stv.f_blocks;
+ fsfilcnt_t root_files = stv.f_files;
+
+ GDir * dir;
+ if ((dir = g_dir_open ("/media", 0, NULL)) != NULL)
+ {
+ const gchar * name;
+ while ((name = g_dir_read_name (dir)) != NULL)
+ {
+ gchar * abs_name;
+
+ /* Skip ram disks */
+ if (!strcmp (name, "ram"))
+ continue;
+
+ abs_name = g_strconcat ("/media/", name, NULL);
+
+ if (!stat (abs_name, &st) && S_ISDIR (st.st_mode))
+ {
+ gchar * dot = g_strconcat (abs_name, "/.", NULL);
+ if (!statvfs (dot, &stv) &&
+ (stv.f_blocks != root_blocks ||
+ stv.f_files != root_files))
+ {
+ GtkFilePath * path =
+ gtk_file_system_filename_to_path (file_system,
+ abs_name);
+
+ if (path)
+ l = g_slist_append (l, path);
+ }
+
+ g_free (dot);
+ }
+
+ g_free (abs_name);
+ }
+
+ g_dir_close (dir);
+ }
+ }
+
+ return l;
}
static GtkFileSystemVolume *
@@ -488,13 +537,18 @@
remove_trailing_slash (const char *filename)
{
int len;
-
+
len = strlen (filename);
- if (len > 1 && filename[len - 1] == '/')
- return g_strndup (filename, len - 1);
- else
- return g_memdup (filename, len + 1);
+ if (len > 1)
+ {
+ gchar *c = g_utf8_prev_char (filename + len);
+
+ if (c && *c == '/')
+ return g_strndup (filename, len - 1);
+ }
+
+ return g_memdup (filename, len + 1);
}
/* Delay callback dispatching
@@ -1128,7 +1182,7 @@
gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system,
GtkFileSystemVolume *volume)
{
- return gtk_file_path_new_dup ("/");
+ return gtk_file_path_copy ((GtkFilePath*)volume);
}
static gboolean
@@ -1162,7 +1216,32 @@
gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system,
GtkFileSystemVolume *volume)
{
- return g_strdup (_("File System")); /* Same as Nautilus */
+ gchar * slash;
+ gchar * path;
+ gchar * c;
+
+ g_return_val_if_fail (file_system && volume, NULL);
+
+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
+
+ g_return_val_if_fail (path && *path, NULL);
+
+ if (path[0] == '/' && !path[1])
+ return g_strdup (_("Filesystem")); /* Same as Nautilus */
+
+ /* Now the media volumes */
+ /* strip trailing / if any */
+ c = g_utf8_prev_char (path + strlen(path));
+
+ if (*c == '/')
+ *c = 0;
+
+ slash = g_utf8_strrchr (path, -1, '/');
+
+ if (!slash)
+ return g_strdup (path);
+
+ return g_strdup (slash + 1);
}
static IconType
@@ -1250,10 +1329,57 @@
GtkFileSystemVolume *volume,
GError **error)
{
- /* FIXME: maybe we just always want to return GTK_STOCK_HARDDISK here?
- * or the new tango icon name?
- */
- return g_strdup ("gnome-dev-harddisk");
+ gchar * c;
+ gchar * slash;
+ gchar * path = NULL;
+ GtkFilePath * fpath;
+ const gchar * id = NULL;
+
+ g_return_val_if_fail (file_system && volume, NULL);
+
+ fpath = gtk_file_system_volume_get_base_path (file_system, volume);
+
+ if (!fpath)
+ goto out;
+
+ path = gtk_file_system_path_to_filename (file_system, fpath);
+ gtk_file_path_free (fpath);
+
+ if (!path || !*path || (*path == '/' && !path[1]))
+ goto out;
+
+ /* Now the media volumes */
+ /* strip trailing / if any */
+ c = g_utf8_prev_char (path + strlen(path));
+
+ if (*c == '/')
+ *c = 0;
+
+ slash = g_utf8_strrchr (path, -1, '/');
+
+ if (slash)
+ {
+ slash++;
+
+ if (!strcmp (slash, "card"))
+ id = "gnome-dev-media-sdmmc";
+ else if (!strcmp (slash, "cf"))
+ id = "gnome-dev-media-cf";
+ else if (!strncmp (slash, "mmc", 3))
+ id = "gnome-dev-media-sdmmc";
+ else if (!strcmp (slash, "usbhdd"))
+ id = "gnome-dev-removable-usb";
+ else
+ id = "gnome-dev-removable";
+ }
+
+ out:
+ g_free (path);
+
+ if (!id)
+ id = "gnome-fs-blockdev";
+
+ return g_strdup (id);
}
static char *