summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+
diff options
context:
space:
mode:
authorTomas Frydrych <tf@openedhand.com>2007-02-08 09:59:44 +0000
committerTomas Frydrych <tf@openedhand.com>2007-02-08 09:59:44 +0000
commitc179a53fec6fd41d554570739d57f9bbaa55078c (patch)
tree4ad454b735d666219b6b2cd265a1a71ef87beb3f /meta/packages/gtk+
parent890f796ef7944dcba32dcc25d1e11e73ccf7f1cc (diff)
downloadpoky-c179a53fec6fd41d554570739d57f9bbaa55078c.tar.gz
patch gtkfilesystemunix.c to provide rudimentary support for volumes
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1263 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gtk+')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch156
-rw-r--r--meta/packages/gtk+/gtk+_2.6.8.bb3
2 files changed, 158 insertions, 1 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch b/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch
new file mode 100644
index 0000000000..f0d25390b5
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch
@@ -0,0 +1,156 @@
1--- gtk+-2.6.8/gtk/gtkfilesystemunix.c.orig 2007-02-08 10:05:19.000000000 +0000
2+++ gtk+-2.6.8/gtk/gtkfilesystemunix.c 2007-02-08 10:05:19.000000000 +0000
3@@ -33,6 +33,7 @@
4 #include <errno.h>
5 #include <string.h>
6 #include <sys/stat.h>
7+#include <sys/statvfs.h>
8 #include <sys/types.h>
9 #include <pwd.h>
10 #ifdef HAVE_UNISTD_H
11@@ -358,7 +359,49 @@
12 static GSList *
13 gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
14 {
15- return g_slist_append (NULL, get_root_volume ());
16+ struct statvfs stv;
17+ struct stat st;
18+ GSList * l = g_slist_append (NULL, get_root_volume ());
19+
20+ if (!statvfs ("/.", &stv))
21+ {
22+ fsblkcnt_t root_blocks = stv.f_blocks;
23+ fsfilcnt_t root_files = stv.f_files;
24+
25+ GDir * dir;
26+ if ((dir = g_dir_open ("/media", 0, NULL)) != NULL)
27+ {
28+ const gchar * name;
29+ while ((name = g_dir_read_name (dir)) != NULL)
30+ {
31+ gchar * abs_name = g_strconcat ("/media/", name, NULL);
32+
33+ if (!stat (abs_name, &st) && S_ISDIR (st.st_mode))
34+ {
35+ gchar * dot = g_strconcat (abs_name, "/.", NULL);
36+ if (!statvfs (dot, &stv) &&
37+ (stv.f_blocks != root_blocks ||
38+ stv.f_files != root_files))
39+ {
40+ GtkFilePath * path =
41+ gtk_file_system_filename_to_path (file_system,
42+ abs_name);
43+
44+ if (path)
45+ l = g_slist_append (l, path);
46+ }
47+
48+ g_free (dot);
49+ }
50+
51+ g_free (abs_name);
52+ }
53+
54+ g_dir_close (dir);
55+ }
56+ }
57+
58+ return l;
59 }
60
61 static GtkFileSystemVolume *
62@@ -590,7 +633,7 @@
63 gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system,
64 GtkFileSystemVolume *volume)
65 {
66- return gtk_file_path_new_dup ("/");
67+ return gtk_file_path_copy ((GtkFilePath*)volume);
68 }
69
70 static gboolean
71@@ -616,7 +659,29 @@
72 gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system,
73 GtkFileSystemVolume *volume)
74 {
75- return g_strdup (_("Filesystem")); /* Same as Nautilus */
76+ gchar * slash;
77+ gchar * path;
78+
79+ g_return_val_if_fail (file_system && volume, NULL);
80+
81+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
82+
83+ g_return_val_if_fail (path && *path, NULL);
84+
85+ if (path[0] == '/' && !path[1])
86+ return g_strdup (_("Filesystem")); /* Same as Nautilus */
87+
88+ /* Now the media volumes */
89+ /* strip trailing / if any */
90+ if (path[strlen(path)-1] == '/')
91+ path[strlen(path)-1] = 0;
92+
93+ slash = strrchr (path, '/');
94+
95+ if (!slash)
96+ return g_strdup (path);
97+
98+ return g_strdup (slash + 1);
99 }
100
101 static IconType
102@@ -787,11 +852,51 @@
103 GError **error)
104 {
105 GdkPixbuf *pixbuf;
106+ gchar * slash;
107+ gchar * path;
108+ const gchar * id = NULL;
109+
110+ g_return_val_if_fail (file_system && volume, NULL);
111+
112+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
113
114- pixbuf = get_cached_icon (widget, "gnome-fs-blockdev", pixel_size);
115- if (pixbuf)
116- return pixbuf;
117+ g_return_val_if_fail (path && *path, NULL);
118+
119+ if (path[0] == '/' && !path[1])
120+ id = "gnome-fs-blockdev";
121+ else
122+ {
123+ /* Now the media volumes */
124+ /* strip trailing / if any */
125+ if (path[strlen(path)-1] == '/')
126+ path[strlen(path)-1] = 0;
127+
128+ slash = strrchr (path, '/');
129+
130+ if (slash)
131+ {
132+ slash++;
133+
134+ if (!strcmp (slash, "card"))
135+ id = "gnome-dev-media-sdmmc";
136+ else if (!strcmp (slash, "cf"))
137+ id = "gnome-dev-media-cf";
138+ else if (!strncmp (slash, "mmc", 3))
139+ id = "gnome-dev-media-sdmmc";
140+ else if (!strcmp (slash, "usbhdd"))
141+ id = "gnome-dev-removable-usb";
142+ else
143+ id = "gnome-dev-removable";
144+ }
145+ }
146
147+ if (id)
148+ {
149+ pixbuf = get_cached_icon (widget, id, pixel_size);
150+ if (pixbuf)
151+ return pixbuf;
152+ }
153+
154 pixbuf = get_fallback_icon (widget, ICON_BLOCK_DEVICE, error);
155 g_assert (pixbuf != NULL);
156
diff --git a/meta/packages/gtk+/gtk+_2.6.8.bb b/meta/packages/gtk+/gtk+_2.6.8.bb
index 0b7ab6b313..7b407c0f3c 100644
--- a/meta/packages/gtk+/gtk+_2.6.8.bb
+++ b/meta/packages/gtk+/gtk+_2.6.8.bb
@@ -5,7 +5,7 @@ HOMEPAGE = "http://www.gtk.org"
5SECTION = "libs" 5SECTION = "libs"
6PRIORITY = "optional" 6PRIORITY = "optional"
7DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt" 7DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt"
8PR = "r1" 8PR = "r2"
9 9
10SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ 10SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
11 file://no-demos.patch;patch=1 \ 11 file://no-demos.patch;patch=1 \
@@ -18,6 +18,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
18 file://menu-deactivate.patch;patch=1 \ 18 file://menu-deactivate.patch;patch=1 \
19 file://scroll-timings.patch;patch=1 \ 19 file://scroll-timings.patch;patch=1 \
20 file://no-deprecation.patch;patch=1 \ 20 file://no-deprecation.patch;patch=1 \
21 file://filesystem-volumes.patch;patch=1 \
21 file://smaller-filechooser.patch;patch=1" 22 file://smaller-filechooser.patch;patch=1"
22 23
23inherit autotools pkgconfig 24inherit autotools pkgconfig