1 |
ssuominen 09/08/23 17:43:26 |
2 |
|
3 |
Added: exo-0.3.102-eject.patch exo-0.3.101-iocharset.patch |
4 |
Log: |
5 |
Move from xfce-extra category. |
6 |
(Portage version: 2.2_rc39/cvs/Linux x86_64, RepoMan options: --force) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 xfce-base/exo/files/exo-0.3.102-eject.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/xfce-base/exo/files/exo-0.3.102-eject.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/xfce-base/exo/files/exo-0.3.102-eject.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: exo-0.3.102-eject.patch |
15 |
=================================================================== |
16 |
diff --git a/exo-mount/exo-mount-hal.c b/exo-mount/exo-mount-hal.c |
17 |
index 791a536..4084719 100644 |
18 |
--- a/exo-mount/exo-mount-hal.c |
19 |
+++ b/exo-mount/exo-mount-hal.c |
20 |
@@ -145,6 +145,42 @@ exo_mount_hal_propagate_error (GError **error, |
21 |
} |
22 |
|
23 |
|
24 |
+static gboolean |
25 |
+string_in_list(gchar * const *haystack, const gchar *needle) |
26 |
+{ |
27 |
+ gint n; |
28 |
+ |
29 |
+ if (!haystack) |
30 |
+ return FALSE; |
31 |
+ |
32 |
+ for (n=0; haystack[n]; ++n) { |
33 |
+ if (!strcmp (haystack[n], needle)) |
34 |
+ return TRUE; |
35 |
+ } |
36 |
+ return FALSE; |
37 |
+} |
38 |
+ |
39 |
+ |
40 |
+static gboolean |
41 |
+device_has_interface(const gchar *udi, const gchar *iface, |
42 |
+ DBusError *derror) |
43 |
+{ |
44 |
+ gboolean result; |
45 |
+ gchar **interfaces; |
46 |
+ |
47 |
+ /* determine the info.interfaces property of the device */ |
48 |
+ interfaces = libhal_device_get_property_strlist (hal_context, udi, |
49 |
+ "info.interfaces", derror); |
50 |
+ |
51 |
+ /* check for the interface we need */ |
52 |
+ result = string_in_list(interfaces, iface); |
53 |
+ libhal_free_string_array(interfaces); |
54 |
+ |
55 |
+ return result; |
56 |
+} |
57 |
+ |
58 |
+ |
59 |
+ |
60 |
|
61 |
/** |
62 |
* exo_mount_hal_device_from_udi: |
63 |
@@ -158,18 +194,15 @@ exo_mount_hal_propagate_error (GError **error, |
64 |
* or %NULL in case of an error. |
65 |
**/ |
66 |
ExoMountHalDevice* |
67 |
-exo_mount_hal_device_from_udi (const gchar *udi, |
68 |
+exo_mount_hal_device_from_udi (const gchar *in_udi, |
69 |
GError **error) |
70 |
{ |
71 |
ExoMountHalDevice *device = NULL; |
72 |
DBusError derror; |
73 |
- gchar **interfaces; |
74 |
- gchar **volume_udis; |
75 |
- gchar *volume_udi = NULL; |
76 |
gint n_volume_udis; |
77 |
- gint n; |
78 |
+ gchar *udi; |
79 |
|
80 |
- g_return_val_if_fail (udi != NULL, NULL); |
81 |
+ g_return_val_if_fail (in_udi != NULL, NULL); |
82 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
83 |
|
84 |
/* make sure the HAL support is initialized */ |
85 |
@@ -179,55 +212,60 @@ exo_mount_hal_device_from_udi (const gchar *udi, |
86 |
/* initialize D-Bus error */ |
87 |
dbus_error_init (&derror); |
88 |
|
89 |
-again: |
90 |
- /* determine the info.interfaces property of the device */ |
91 |
- interfaces = libhal_device_get_property_strlist (hal_context, udi, "info.interfaces", &derror); |
92 |
- if (G_UNLIKELY (interfaces == NULL)) |
93 |
+ udi = g_strdup (in_udi); |
94 |
+ /* at this point, we own udi */ |
95 |
+ |
96 |
+ /* maybe we have a mountable device here */ |
97 |
+ while(G_UNLIKELY (!device_has_interface (udi, |
98 |
+ "org.freedesktop.Hal.Device.Volume", &derror))) |
99 |
{ |
100 |
- /* reset D-Bus error */ |
101 |
- dbus_error_free (&derror); |
102 |
+ gchar **volume_udis; |
103 |
|
104 |
- /* release any previous volume UDI */ |
105 |
- g_free (volume_udi); |
106 |
- volume_udi = NULL; |
107 |
+ /* maybe there was a D-Bus error? gotta check */ |
108 |
+ if (G_UNLIKELY (dbus_error_is_set (&derror))) |
109 |
+ { |
110 |
+ exo_mount_hal_propagate_error (error, &derror); |
111 |
+ g_free (udi); |
112 |
+ return NULL; |
113 |
+ } |
114 |
+ |
115 |
+ /* maybe we have a volume whose parent is identified by the udi */ |
116 |
+ volume_udis = libhal_manager_find_device_string_match (hal_context, |
117 |
+ "info.parent", udi, &n_volume_udis, &derror); |
118 |
|
119 |
- /* ok, but maybe we have a volume whose parent is identified by the udi */ |
120 |
- volume_udis = libhal_manager_find_device_string_match (hal_context, "info.parent", udi, &n_volume_udis, &derror); |
121 |
if (G_UNLIKELY (volume_udis == NULL)) |
122 |
{ |
123 |
-err0: exo_mount_hal_propagate_error (error, &derror); |
124 |
- goto out; |
125 |
+ exo_mount_hal_propagate_error (error, &derror); |
126 |
+ g_free (udi); |
127 |
+ return NULL; |
128 |
} |
129 |
else if (G_UNLIKELY (n_volume_udis < 1)) |
130 |
{ |
131 |
- /* no match, we cannot handle that device */ |
132 |
libhal_free_string_array (volume_udis); |
133 |
- goto err1; |
134 |
+ dbus_error_free (&derror); |
135 |
+ /* definitely not a device that we're able to |
136 |
+ * mount, eject or unmount */ |
137 |
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, |
138 |
+ _("Given device \"%s\" is not a volume or drive"), udi); |
139 |
+ g_free (udi); |
140 |
+ return NULL; |
141 |
} |
142 |
|
143 |
+ g_free (udi); |
144 |
+ |
145 |
/* use the first volume UDI... */ |
146 |
- volume_udi = g_strdup (volume_udis[0]); |
147 |
+ udi = g_strdup (volume_udis[0]); |
148 |
libhal_free_string_array (volume_udis); |
149 |
- |
150 |
/* ..and try again using that UDI */ |
151 |
- udi = (const gchar *) volume_udi; |
152 |
- goto again; |
153 |
} |
154 |
|
155 |
- /* verify that we have a mountable device here */ |
156 |
- for (n = 0; interfaces[n] != NULL; ++n) |
157 |
- if (strcmp (interfaces[n], "org.freedesktop.Hal.Device.Volume") == 0) |
158 |
- break; |
159 |
- if (G_UNLIKELY (interfaces[n] == NULL)) |
160 |
- { |
161 |
- /* definitely not a device that we're able to mount, eject or unmount */ |
162 |
-err1: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"%s\" is not a volume or drive"), udi); |
163 |
- goto out; |
164 |
- } |
165 |
+ /* at this point, udi contains the UDI of something |
166 |
+ * that implements Hal.Device.Volume. |
167 |
+ * udi is the only resource that we hold here. */ |
168 |
|
169 |
/* setup the device struct */ |
170 |
device = g_new0 (ExoMountHalDevice, 1); |
171 |
- device->udi = g_strdup (udi); |
172 |
+ device->udi = udi; |
173 |
|
174 |
/* check if we have a volume here */ |
175 |
device->volume = libhal_volume_from_udi (hal_context, udi); |
176 |
@@ -269,8 +307,8 @@ err1: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"% |
177 |
if (G_UNLIKELY (device->file == NULL || device->name == NULL)) |
178 |
{ |
179 |
exo_mount_hal_device_free (device); |
180 |
- device = NULL; |
181 |
- goto err0; |
182 |
+ exo_mount_hal_propagate_error(error, &derror); |
183 |
+ return NULL; |
184 |
} |
185 |
|
186 |
/* check if we failed */ |
187 |
@@ -282,11 +320,7 @@ err1: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Given device \"% |
188 |
device = NULL; |
189 |
} |
190 |
|
191 |
-out: |
192 |
- /* cleanup */ |
193 |
- libhal_free_string_array (interfaces); |
194 |
- g_free (volume_udi); |
195 |
- |
196 |
+ dbus_error_free (&derror); |
197 |
return device; |
198 |
} |
199 |
|
200 |
@@ -313,7 +347,7 @@ exo_mount_hal_device_from_file (const gchar *file, |
201 |
gchar **interfaces; |
202 |
gchar **udis; |
203 |
gint n_udis; |
204 |
- gint n, m; |
205 |
+ gint n; |
206 |
|
207 |
g_return_val_if_fail (g_path_is_absolute (file), NULL); |
208 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
209 |
@@ -347,12 +381,7 @@ exo_mount_hal_device_from_file (const gchar *file, |
210 |
continue; |
211 |
|
212 |
/* check if we have a mountable device here */ |
213 |
- for (m = 0; interfaces[m] != NULL; ++m) |
214 |
- if (strcmp (interfaces[m], "org.freedesktop.Hal.Device.Volume") == 0) |
215 |
- break; |
216 |
- |
217 |
- /* check if it's a usable device */ |
218 |
- if (interfaces[m] != NULL) |
219 |
+ if (string_in_list (interfaces, "org.freedesktop.Hal.Device.Volume")) |
220 |
{ |
221 |
libhal_free_string_array (interfaces); |
222 |
break; |
223 |
|
224 |
|
225 |
|
226 |
1.1 xfce-base/exo/files/exo-0.3.101-iocharset.patch |
227 |
|
228 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/xfce-base/exo/files/exo-0.3.101-iocharset.patch?rev=1.1&view=markup |
229 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/xfce-base/exo/files/exo-0.3.101-iocharset.patch?rev=1.1&content-type=text/plain |
230 |
|
231 |
Index: exo-0.3.101-iocharset.patch |
232 |
=================================================================== |
233 |
diff --git a/exo-mount/exo-mount-hal.c b/exo-mount/exo-mount-hal.c |
234 |
index 791a536..4b130c3 100644 |
235 |
--- a/exo-mount/exo-mount-hal.c |
236 |
+++ b/exo-mount/exo-mount-hal.c |
237 |
@@ -34,6 +34,8 @@ |
238 |
#include <unistd.h> |
239 |
#endif |
240 |
|
241 |
+#include <langinfo.h> |
242 |
+ |
243 |
#include <libhal-storage.h> |
244 |
|
245 |
#include <exo-hal/exo-hal.h> |
246 |
@@ -616,6 +618,30 @@ oom: g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, g_strerror (ENOMEM)) |
247 |
|
248 |
|
249 |
/** |
250 |
+ * exo_mount_hal_iocharset: |
251 |
+ * |
252 |
+ * Determines the preferred iocharset for filesystems |
253 |
+ * that support it. |
254 |
+ * |
255 |
+ * Return value: iocharset string or %NULL if none. |
256 |
+ **/ |
257 |
+static const gchar* |
258 |
+exo_mount_hal_iocharset () |
259 |
+{ |
260 |
+ const gchar* cs = g_getenv("EXO_MOUNT_IOCHARSET"); |
261 |
+ if (cs != NULL) |
262 |
+ return cs; |
263 |
+ |
264 |
+ const char* codeset = nl_langinfo (CODESET); |
265 |
+ if (codeset && !strcmp (codeset, "UTF-8")) |
266 |
+ return "utf8"; |
267 |
+ |
268 |
+ return NULL; |
269 |
+} |
270 |
+ |
271 |
+ |
272 |
+ |
273 |
+/** |
274 |
* exo_mount_hal_device_mount: |
275 |
* @device : an #ExoMountHalDevice. |
276 |
* @error : return location for errors or %NULL. |
277 |
@@ -676,6 +702,12 @@ exo_mount_hal_device_mount (ExoMountHalDevice *device, |
278 |
/* however this one is FreeBSD specific */ |
279 |
options[n++] = g_strdup ("longnames"); |
280 |
} |
281 |
+ else if (strcmp (device->fsoptions[m], "iocharset=") == 0) |
282 |
+ { |
283 |
+ const gchar* iocharset = exo_mount_hal_iocharset(); |
284 |
+ if (iocharset != NULL) |
285 |
+ options[n++] = g_strdup_printf ("iocharset=%s", iocharset); |
286 |
+ } |
287 |
} |
288 |
} |
289 |
|
290 |
diff --git a/exo-mount/main.c b/exo-mount/main.c |
291 |
index 80eae1d..f442019 100644 |
292 |
--- a/exo-mount/main.c |
293 |
+++ b/exo-mount/main.c |
294 |
@@ -39,6 +39,8 @@ |
295 |
#include <string.h> |
296 |
#endif |
297 |
|
298 |
+#include <locale.h> |
299 |
+ |
300 |
#include <glib/gstdio.h> |
301 |
|
302 |
#include <exo-hal/exo-hal.h> |
303 |
@@ -97,6 +99,8 @@ main (int argc, char **argv) |
304 |
/* initialize the i18n support */ |
305 |
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); |
306 |
|
307 |
+ setlocale(LC_CTYPE, ""); |
308 |
+ |
309 |
/* initialize GTK+ */ |
310 |
if (!gtk_init_with_args (&argc, &argv, "Xfce mount", entries, GETTEXT_PACKAGE, &err)) |
311 |
{ |