Merge lp:~bcurtiswx/ubuntu/quantal/gvfs/1.13.3-0ubuntu1 into lp:ubuntu/quantal/gvfs

Proposed by Brian Curtis on 2012-07-20
Status: Merged
Merge reported by: Iain Lane
Merged at revision: not available
Proposed branch: lp:~bcurtiswx/ubuntu/quantal/gvfs/1.13.3-0ubuntu1
Merge into: lp:ubuntu/quantal/gvfs
Diff against target: 46566 lines (+9413/-27783)
135 files modified
.pc/.quilt_patches (+0/-1)
.pc/.quilt_series (+0/-1)
.pc/.version (+0/-1)
.pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2mount.c (+0/-1303)
.pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2volume.c (+0/-1613)
.pc/01_modules_dir.patch/configure.ac (+0/-826)
.pc/03_xdg-mount.patch/monitor/hal/ghaldrive.c (+0/-959)
.pc/03_xdg-mount.patch/monitor/hal/ghalmount.c (+0/-1192)
.pc/03_xdg-mount.patch/monitor/hal/ghalvolume.c (+0/-1007)
.pc/04_hurd_path_max.patch/monitor/gdu/ggduvolumemonitor.c (+0/-1799)
.pc/04_hurd_path_max.patch/monitor/hal/ghalvolumemonitor.c (+0/-1360)
.pc/05_shared_libdaemon.patch/common/Makefile.am (+0/-48)
.pc/06_music-player-mimetype.patch/monitor/gdu/ggdumount.c (+0/-1471)
.pc/applied-patches (+0/-12)
.pc/check-gdu-pool.patch/monitor/gdu/ggduvolumemonitor.c (+0/-1824)
.pc/dont-crash-on-null-job.patch/daemon/gvfschannel.c (+0/-781)
.pc/handle-inactive-vfs.patch/client/gdaemonvfs.c (+0/-1633)
.pc/metadata-dont-flush-null-tree.patch/metadata/metatree.c (+0/-3342)
.pc/metadata-nuke-junk-data.patch/metadata/metatree.c (+0/-3345)
.pc/ref-jobs-in-thread.patch/daemon/gvfschannel.c (+0/-782)
.pc/ref-jobs-in-thread.patch/daemon/gvfsdaemon.c (+0/-1132)
ChangeLog (+429/-1)
Makefile.am (+4/-0)
Makefile.in (+8/-12)
NEWS (+11/-0)
client/Makefile.in (+3/-0)
client/gdaemonvfs.c (+1/-1)
common/Makefile.am (+3/-7)
common/Makefile.in (+3/-0)
common/gmountoperationdbus.c (+49/-0)
common/gmountsource.c (+61/-0)
common/gmountsource.h (+5/-0)
common/gvfsdaemonprotocol.h (+1/-0)
config.h.in (+6/-0)
configure (+289/-23)
configure.ac (+46/-6)
daemon/Makefile.am (+20/-0)
daemon/Makefile.in (+143/-61)
daemon/gvfsbackend.c (+4/-4)
daemon/gvfsbackendrecent.c (+686/-0)
daemon/gvfsbackendrecent.h (+25/-0)
daemon/gvfsbackendsftp.c (+2/-2)
daemon/gvfsbackendtrash.c (+14/-1)
daemon/gvfschannel.c (+4/-6)
daemon/gvfsdaemon.c (+2/-5)
daemon/gvfsjobunmount.c (+58/-0)
daemon/gvfsjobunmount.h (+3/-0)
daemon/pty_open.c (+127/-5)
daemon/recent.mount.in (+5/-0)
daemon/trashlib/Makefile.in (+3/-0)
debian/changelog (+17/-0)
debian/control (+3/-2)
debian/gvfs-backends.install (+2/-0)
debian/gvfs-common.install (+1/-0)
debian/patches/00git_compile_error.patch (+0/-40)
debian/patches/01_modules_dir.patch (+4/-4)
debian/patches/06_music-player-mimetype.patch (+4/-4)
debian/patches/series (+0/-1)
man/Makefile.am (+27/-0)
man/Makefile.in (+555/-0)
man/gvfs-cat.xml (+83/-0)
man/gvfs-copy.xml (+117/-0)
man/gvfs-info.xml (+116/-0)
man/gvfs-ls.xml (+119/-0)
man/gvfs-mime.xml (+101/-0)
man/gvfs-mkdir.xml (+85/-0)
man/gvfs-monitor-dir.xml (+81/-0)
man/gvfs-monitor-file.xml (+81/-0)
man/gvfs-mount.xml (+142/-0)
man/gvfs-move.xml (+111/-0)
man/gvfs-open.xml (+80/-0)
man/gvfs-rename.xml (+81/-0)
man/gvfs-rm.xml (+91/-0)
man/gvfs-save.xml (+106/-0)
man/gvfs-set-attribute.xml (+95/-0)
man/gvfs-trash.xml (+99/-0)
man/gvfs-tree.xml (+94/-0)
metadata/Makefile.in (+3/-0)
metadata/metadata-dbus.c (+44/-38)
metadata/metadata-dbus.h (+1/-1)
metadata/metatree.c (+2/-15)
monitor/Makefile.in (+3/-0)
monitor/afc/Makefile.in (+3/-0)
monitor/gdu/Makefile.in (+3/-0)
monitor/gdu/ggdumount.c (+0/-13)
monitor/gdu/ggduvolumemonitor.c (+23/-61)
monitor/gphoto2/Makefile.in (+3/-0)
monitor/hal/Makefile.in (+3/-0)
monitor/hal/ghaldrive.c (+6/-16)
monitor/hal/ghalmount.c (+14/-15)
monitor/hal/ghalvolume.c (+6/-16)
monitor/hal/ghalvolumemonitor.c (+1/-13)
monitor/proxy/Makefile.am (+1/-1)
monitor/proxy/Makefile.in (+4/-1)
monitor/proxy/dbus-interfaces.xml (+7/-0)
monitor/proxy/gproxymountoperation.c (+29/-0)
monitor/proxy/gproxymountoperation.h (+5/-0)
monitor/proxy/gproxyvolumemonitor.c (+29/-0)
monitor/proxy/gvfsproxyvolumemonitordaemon.c (+56/-0)
monitor/proxy/gvfsvolumemonitordbus.c (+370/-207)
monitor/proxy/gvfsvolumemonitordbus.h (+17/-1)
monitor/udisks2/Makefile.in (+3/-0)
monitor/udisks2/gvfsudisks2drive.c (+26/-14)
monitor/udisks2/gvfsudisks2mount.c (+41/-37)
monitor/udisks2/gvfsudisks2utils.c (+228/-0)
monitor/udisks2/gvfsudisks2utils.h (+5/-0)
monitor/udisks2/gvfsudisks2volume.c (+3/-0)
po/POTFILES.in (+1/-0)
po/as.po (+648/-475)
po/be.po (+488/-335)
po/el.po (+415/-248)
po/es.po (+428/-286)
po/gl.po (+413/-283)
po/nb.po (+320/-244)
po/zh_HK.po (+524/-338)
po/zh_TW.po (+524/-343)
programs/Makefile.in (+3/-0)
programs/gvfs-cat.c (+54/-56)
programs/gvfs-copy.c (+20/-10)
programs/gvfs-info.c (+16/-6)
programs/gvfs-ls.c (+23/-7)
programs/gvfs-mime.c (+18/-11)
programs/gvfs-mkdir.c (+15/-5)
programs/gvfs-monitor-dir.c (+23/-2)
programs/gvfs-monitor-file.c (+23/-2)
programs/gvfs-mount.c (+26/-5)
programs/gvfs-move.c (+18/-8)
programs/gvfs-open.c (+9/-13)
programs/gvfs-rename.c (+37/-9)
programs/gvfs-rm.c (+23/-3)
programs/gvfs-save.c (+19/-10)
programs/gvfs-set-attribute.c (+35/-10)
programs/gvfs-trash.c (+23/-3)
programs/gvfs-tree.c (+15/-5)
test/Makefile.in (+3/-0)
To merge this branch: bzr merge lp:~bcurtiswx/ubuntu/quantal/gvfs/1.13.3-0ubuntu1
Reviewer Review Type Date Requested Status
Ubuntu branches 2012-07-20 Pending
Review via email: mp+116046@code.launchpad.net

Description of the Change

gvfs (1.13.3-0ubuntu1) UNRELEASED; urgency=low

  * New upstream release (LP #1025542).
  * debian/patches debian/patches/series
    - removed 00git_compile_error.patch as it's in upstream
    - refreshed patches
  * debian/control
    - bumped libglib2.0-dev dep to 2.33.4
    - added dep on libgtk-3-dev

 -- Brian Curtis <email address hidden> Fri, 20 Jul 2012 12:29:15 -0400

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

Thanks for your work, you need to update the .install to list the new gvfsd-recent and recent.mount files, they should probably go to gvfs-backends

195. By Brian Curtis on 2012-07-22

* debian/empathy-common.install
  - added man pages install

196. By Brian Curtis on 2012-07-23

* debian/gvfs-common.install
  - added usr/share/man/man1/
* debian/gvfs-backends
  - added usr/lib/gvfs/gvfsd-recent
  - added usr/share/gvfs/mounts/recent.mount

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc'
2=== removed file '.pc/.quilt_patches'
3--- .pc/.quilt_patches 2012-04-02 14:18:16 +0000
4+++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000
5@@ -1,1 +0,0 @@
6-debian/patches
7
8=== removed file '.pc/.quilt_series'
9--- .pc/.quilt_series 2012-04-02 14:18:16 +0000
10+++ .pc/.quilt_series 1970-01-01 00:00:00 +0000
11@@ -1,1 +0,0 @@
12-series
13
14=== removed file '.pc/.version'
15--- .pc/.version 2011-04-13 17:17:02 +0000
16+++ .pc/.version 1970-01-01 00:00:00 +0000
17@@ -1,1 +0,0 @@
18-2
19
20=== removed directory '.pc/00git_compile_error.patch'
21=== removed directory '.pc/00git_compile_error.patch/monitor'
22=== removed directory '.pc/00git_compile_error.patch/monitor/udisks2'
23=== removed file '.pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2mount.c'
24--- .pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2mount.c 2012-06-06 13:48:26 +0000
25+++ .pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2mount.c 1970-01-01 00:00:00 +0000
26@@ -1,1303 +0,0 @@
27-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
28-/* gvfs - extensions for gio
29- *
30- * Copyright (C) 2006-2012 Red Hat, Inc.
31- *
32- * This library is free software; you can redistribute it and/or
33- * modify it under the terms of the GNU Lesser General Public
34- * License as published by the Free Software Foundation; either
35- * version 2 of the License, or (at your option) any later version.
36- *
37- * This library is distributed in the hope that it will be useful,
38- * but WITHOUT ANY WARRANTY; without even the implied warranty of
39- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40- * Lesser General Public License for more details.
41- *
42- * You should have received a copy of the GNU Lesser General
43- * Public License along with this library; if not, write to the
44- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
45- * Boston, MA 02111-1307, USA.
46- *
47- * Author: David Zeuthen <davidz@redhat.com>
48- */
49-
50-#include <config.h>
51-
52-#include <string.h>
53-#include <sys/wait.h>
54-#include <unistd.h>
55-#include <stdio.h>
56-#include <stdlib.h>
57-
58-#include <glib.h>
59-#include <glib/gi18n-lib.h>
60-#include <gio/gio.h>
61-
62-#include <gvfsmountinfo.h>
63-
64-#include <gudev/gudev.h>
65-
66-#include "gvfsudisks2volumemonitor.h"
67-#include "gvfsudisks2mount.h"
68-#include "gvfsudisks2volume.h"
69-#include "gvfsudisks2drive.h"
70-#include "gvfsudisks2utils.h"
71-
72-#define BUSY_UNMOUNT_NUM_ATTEMPTS 5
73-#define BUSY_UNMOUNT_MS_DELAY_BETWEEN_ATTEMPTS 100
74-
75-typedef struct _GVfsUDisks2MountClass GVfsUDisks2MountClass;
76-struct _GVfsUDisks2MountClass
77-{
78- GObjectClass parent_class;
79-};
80-
81-struct _GVfsUDisks2Mount
82-{
83- GObject parent;
84-
85- GVfsUDisks2VolumeMonitor *monitor; /* owned by volume monitor */
86-
87- /* may be NULL */
88- GVfsUDisks2Volume *volume; /* owned by volume monitor */
89-
90- /* may be NULL */
91- GUnixMountEntry *mount_entry;
92-
93- /* the following members are set in update_mount() */
94- GFile *root;
95- GIcon *icon;
96- gchar *name;
97- gchar *sort_key;
98- gchar *uuid;
99- gchar *device_file;
100- gchar *mount_path;
101- gboolean can_unmount;
102- gchar *mount_entry_name;
103- gchar *mount_entry_fs_type;
104-
105- gboolean is_burn_mount;
106-
107- GIcon *autorun_icon;
108- gboolean searched_for_autorun;
109-
110- gchar *xdg_volume_info_name;
111- GIcon *xdg_volume_info_icon;
112- gboolean searched_for_xdg_volume_info;
113-
114- gchar *bdmv_volume_info_name;
115- GIcon *bdmv_volume_info_icon;
116- gboolean searched_for_bdmv_volume_info;
117-};
118-
119-static gboolean update_mount (GVfsUDisks2Mount *mount);
120-
121-static void gvfs_udisks2_mount_mount_iface_init (GMountIface *iface);
122-
123-G_DEFINE_TYPE_EXTENDED (GVfsUDisks2Mount, gvfs_udisks2_mount, G_TYPE_OBJECT, 0,
124- G_IMPLEMENT_INTERFACE (G_TYPE_MOUNT,
125- gvfs_udisks2_mount_mount_iface_init))
126-
127-static void on_volume_changed (GVolume *volume, gpointer user_data);
128-
129-static void
130-gvfs_udisks2_mount_finalize (GObject *object)
131-{
132- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (object);
133-
134- if (mount->volume != NULL)
135- {
136- g_signal_handlers_disconnect_by_func (mount->volume, on_volume_changed, mount);
137- gvfs_udisks2_volume_unset_mount (mount->volume, mount);
138- }
139-
140- if (mount->root != NULL)
141- g_object_unref (mount->root);
142- if (mount->icon != NULL)
143- g_object_unref (mount->icon);
144- g_free (mount->name);
145- g_free (mount->sort_key);
146- g_free (mount->uuid);
147- g_free (mount->device_file);
148- g_free (mount->mount_path);
149-
150- g_free (mount->mount_entry_name);
151-
152- if (mount->autorun_icon != NULL)
153- g_object_unref (mount->autorun_icon);
154-
155- g_free (mount->xdg_volume_info_name);
156- if (mount->xdg_volume_info_icon != NULL)
157- g_object_unref (mount->xdg_volume_info_icon);
158-
159- G_OBJECT_CLASS (gvfs_udisks2_mount_parent_class)->finalize (object);
160-}
161-
162-static void
163-gvfs_udisks2_mount_class_init (GVfsUDisks2MountClass *klass)
164-{
165- GObjectClass *gobject_class;
166-
167- gobject_class = G_OBJECT_CLASS (klass);
168- gobject_class->finalize = gvfs_udisks2_mount_finalize;
169-}
170-
171-static void
172-gvfs_udisks2_mount_init (GVfsUDisks2Mount *mount)
173-{
174-}
175-
176-static void
177-emit_changed (GVfsUDisks2Mount *mount)
178-{
179- g_signal_emit_by_name (mount, "changed");
180- g_signal_emit_by_name (mount->monitor, "mount-changed", mount);
181-}
182-
183-static void
184-got_autorun_info_cb (GObject *source_object,
185- GAsyncResult *res,
186- gpointer user_data)
187-{
188- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (user_data);
189- mount->autorun_icon = g_vfs_mount_info_query_autorun_info_finish (G_FILE (source_object), res, NULL);
190- if (update_mount (mount))
191- emit_changed (mount);
192- g_object_unref (mount);
193-}
194-
195-static void
196-got_xdg_volume_info_cb (GObject *source_object,
197- GAsyncResult *res,
198- gpointer user_data)
199-{
200- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (user_data);
201- mount->xdg_volume_info_icon = g_vfs_mount_info_query_xdg_volume_info_finish (G_FILE (source_object),
202- res,
203- &(mount->xdg_volume_info_name),
204- NULL);
205- if (update_mount (mount))
206- emit_changed (mount);
207- g_object_unref (mount);
208-}
209-
210-static void
211-got_bdmv_volume_info_cb (GObject *source_object,
212- GAsyncResult *res,
213- gpointer user_data)
214-{
215- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (user_data);
216- mount->bdmv_volume_info_icon = g_vfs_mount_info_query_bdmv_volume_info_finish (G_FILE (source_object),
217- res,
218- &(mount->bdmv_volume_info_name),
219- NULL);
220- if (update_mount (mount))
221- emit_changed (mount);
222- g_object_unref (mount);
223-}
224-
225-static gboolean
226-update_mount (GVfsUDisks2Mount *mount)
227-{
228- gboolean changed;
229- gboolean old_can_unmount;
230- gchar *old_name;
231- GIcon *old_icon;
232-
233- /* save old values */
234- old_can_unmount = mount->can_unmount;
235- old_name = g_strdup (mount->name);
236- old_icon = mount->icon != NULL ? g_object_ref (mount->icon) : NULL;
237-
238- /* reset */
239- mount->can_unmount = FALSE;
240- g_clear_object (&mount->icon);
241- g_free (mount->name); mount->name = NULL;
242-
243- /* in with the new */
244- if (mount->volume != NULL)
245- {
246- mount->can_unmount = TRUE;
247-
248- /* icon order of preference: bdmv, xdg, autorun, probed */
249- if (mount->bdmv_volume_info_icon != NULL)
250- mount->icon = g_object_ref (mount->bdmv_volume_info_icon);
251- else if (mount->xdg_volume_info_icon != NULL)
252- mount->icon = g_object_ref (mount->xdg_volume_info_icon);
253- else if (mount->autorun_icon != NULL)
254- mount->icon = g_object_ref (mount->autorun_icon);
255- else
256- mount->icon = g_volume_get_icon (G_VOLUME (mount->volume));
257-
258- /* name order of preference : bdmv, xdg, probed */
259- if (mount->bdmv_volume_info_name != NULL)
260- mount->name = g_strdup (mount->bdmv_volume_info_name);
261- else if (mount->xdg_volume_info_name != NULL)
262- mount->name = g_strdup (mount->xdg_volume_info_name);
263- else
264- mount->name = g_volume_get_name (G_VOLUME (mount->volume));
265- }
266- else
267- {
268- mount->can_unmount = TRUE;
269-
270- if (mount->icon != NULL)
271- g_object_unref (mount->icon);
272-
273- /* icon order of preference: bdmv, xdg, autorun, probed */
274- if (mount->bdmv_volume_info_icon != NULL)
275- mount->icon = g_object_ref (mount->bdmv_volume_info_icon);
276- else if (mount->xdg_volume_info_icon != NULL)
277- mount->icon = g_object_ref (mount->xdg_volume_info_icon);
278- else if (mount->autorun_icon != NULL)
279- mount->icon = g_object_ref (mount->autorun_icon);
280- else
281- {
282- mount->icon = gvfs_udisks2_utils_icon_from_fs_type (g_unix_mount_get_fs_type (mount->mount_entry));
283- }
284-
285- g_free (mount->name);
286-
287- /* name order of preference: bdmv, xdg, probed */
288- if (mount->bdmv_volume_info_name != NULL)
289- mount->name = g_strdup (mount->bdmv_volume_info_name);
290- else if (mount->xdg_volume_info_name != NULL)
291- mount->name = g_strdup (mount->xdg_volume_info_name);
292- else
293- mount->name = g_strdup (mount->mount_entry_name);
294- }
295-
296- /* compute whether something changed */
297- changed = !((old_can_unmount == mount->can_unmount) &&
298- (g_strcmp0 (old_name, mount->name) == 0) &&
299- g_icon_equal (old_icon, mount->icon));
300-
301- /* free old values */
302- g_free (old_name);
303- if (old_icon != NULL)
304- g_object_unref (old_icon);
305-
306- /*g_debug ("in update_mount(), changed=%d", changed);*/
307-
308- /* search for BDMV */
309- if (!mount->searched_for_bdmv_volume_info)
310- {
311- mount->searched_for_bdmv_volume_info = TRUE;
312- g_vfs_mount_info_query_bdmv_volume_info (mount->root,
313- NULL,
314- got_bdmv_volume_info_cb,
315- g_object_ref (mount));
316- }
317-
318- /* search for .xdg-volume-info */
319- if (!mount->searched_for_xdg_volume_info)
320- {
321- mount->searched_for_xdg_volume_info = TRUE;
322- g_vfs_mount_info_query_xdg_volume_info (mount->root,
323- NULL,
324- got_xdg_volume_info_cb,
325- g_object_ref (mount));
326- }
327-
328- /* search for autorun.inf */
329- if (!mount->searched_for_autorun)
330- {
331- mount->searched_for_autorun = TRUE;
332- g_vfs_mount_info_query_autorun_info (mount->root,
333- NULL,
334- got_autorun_info_cb,
335- g_object_ref (mount));
336- }
337-
338- return changed;
339-}
340-
341-static void
342-on_volume_changed (GVolume *volume,
343- gpointer user_data)
344-{
345- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (user_data);
346- if (update_mount (mount))
347- emit_changed (mount);
348-}
349-
350-GVfsUDisks2Mount *
351-gvfs_udisks2_mount_new (GVfsUDisks2VolumeMonitor *monitor,
352- GUnixMountEntry *mount_entry, /* takes ownership */
353- GVfsUDisks2Volume *volume)
354-{
355- GVfsUDisks2Mount *mount = NULL;
356-
357- /* Ignore internal mounts unless there's a volume */
358- if (volume == NULL && (mount_entry != NULL && !g_unix_mount_guess_should_display (mount_entry)))
359- goto out;
360-
361- mount = g_object_new (GVFS_TYPE_UDISKS2_MOUNT, NULL);
362- mount->monitor = monitor;
363- mount->sort_key = g_strdup_printf ("gvfs.time_detected_usec.%" G_GINT64_FORMAT, g_get_real_time ());
364-
365- if (mount_entry != NULL)
366- {
367- mount->mount_entry = mount_entry; /* takes ownership */
368- mount->mount_entry_name = g_unix_mount_guess_name (mount_entry);
369- mount->device_file = g_strdup (g_unix_mount_get_device_path (mount_entry));
370- mount->mount_path = g_strdup (g_unix_mount_get_mount_path (mount_entry));
371- mount->root = g_file_new_for_path (mount->mount_path);
372- }
373- else
374- {
375- /* burn:/// mount (the only mounts we support with mount_entry == NULL) */
376- mount->device_file = NULL;
377- mount->mount_path = NULL;
378- mount->root = g_file_new_for_uri ("burn:///");
379- mount->is_burn_mount = TRUE;
380- }
381-
382- /* need to set the volume only when the mount is fully constructed */
383- mount->volume = volume;
384- if (mount->volume != NULL)
385- {
386- gvfs_udisks2_volume_set_mount (volume, mount);
387- /* this is for piggy backing on the name and icon of the associated volume */
388- g_signal_connect (mount->volume, "changed", G_CALLBACK (on_volume_changed), mount);
389- }
390-
391- update_mount (mount);
392-
393- out:
394-
395- return mount;
396-}
397-
398-void
399-gvfs_udisks2_mount_unmounted (GVfsUDisks2Mount *mount)
400-{
401- if (mount->volume != NULL)
402- {
403- gvfs_udisks2_volume_unset_mount (mount->volume, mount);
404- g_signal_handlers_disconnect_by_func (mount->volume, on_volume_changed, mount);
405- mount->volume = NULL;
406- emit_changed (mount);
407- }
408-}
409-
410-void
411-gvfs_udisks2_mount_unset_volume (GVfsUDisks2Mount *mount,
412- GVfsUDisks2Volume *volume)
413-{
414- if (mount->volume == volume)
415- {
416- g_signal_handlers_disconnect_by_func (mount->volume, on_volume_changed, mount);
417- mount->volume = NULL;
418- emit_changed (mount);
419- }
420-}
421-
422-void
423-gvfs_udisks2_mount_set_volume (GVfsUDisks2Mount *mount,
424- GVfsUDisks2Volume *volume)
425-{
426- if (mount->volume != volume)
427- {
428- if (mount->volume != NULL)
429- gvfs_udisks2_mount_unset_volume (mount, mount->volume);
430- mount->volume = volume;
431- if (mount->volume != NULL)
432- {
433- gvfs_udisks2_volume_set_mount (volume, mount);
434- /* this is for piggy backing on the name and icon of the associated volume */
435- g_signal_connect (mount->volume, "changed", G_CALLBACK (on_volume_changed), mount);
436- }
437- update_mount (mount);
438- emit_changed (mount);
439- }
440-}
441-
442-static GFile *
443-gvfs_udisks2_mount_get_root (GMount *_mount)
444-{
445- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
446- return mount->root != NULL ? g_object_ref (mount->root) : NULL;
447-}
448-
449-static GIcon *
450-gvfs_udisks2_mount_get_icon (GMount *_mount)
451-{
452- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
453- return mount->icon != NULL ? g_object_ref (mount->icon) : NULL;
454-}
455-
456-static gchar *
457-gvfs_udisks2_mount_get_uuid (GMount *_mount)
458-{
459- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
460- return g_strdup (mount->uuid);
461-}
462-
463-static gchar *
464-gvfs_udisks2_mount_get_name (GMount *_mount)
465-{
466- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
467- return g_strdup (mount->name);
468-}
469-
470-gboolean
471-gvfs_udisks2_mount_has_uuid (GVfsUDisks2Mount *_mount,
472- const gchar *uuid)
473-{
474- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
475- return g_strcmp0 (mount->uuid, uuid) == 0;
476-}
477-
478-const gchar *
479-gvfs_udisks2_mount_get_mount_path (GVfsUDisks2Mount *mount)
480-{
481- return mount->mount_path;
482-}
483-
484-GUnixMountEntry *
485-gvfs_udisks2_mount_get_mount_entry (GVfsUDisks2Mount *_mount)
486-{
487- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
488- return mount->mount_entry;
489-}
490-
491-static GDrive *
492-gvfs_udisks2_mount_get_drive (GMount *_mount)
493-{
494- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
495- GDrive *drive = NULL;
496-
497- if (mount->volume != NULL)
498- drive = g_volume_get_drive (G_VOLUME (mount->volume));
499- return drive;
500-}
501-
502-static GVolume *
503-gvfs_udisks2_mount_get_volume_ (GMount *_mount)
504-{
505- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
506- GVolume *volume = NULL;
507-
508- if (mount->volume != NULL)
509- volume = G_VOLUME (g_object_ref (mount->volume));
510- return volume;
511-}
512-
513-static gboolean
514-gvfs_udisks2_mount_can_unmount (GMount *_mount)
515-{
516- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
517- return mount->can_unmount;
518-}
519-
520-static gboolean
521-gvfs_udisks2_mount_can_eject (GMount *_mount)
522-{
523- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
524- GDrive *drive;
525- gboolean can_eject;
526-
527- can_eject = FALSE;
528- if (mount->volume != NULL)
529- {
530- drive = g_volume_get_drive (G_VOLUME (mount->volume));
531- if (drive != NULL)
532- can_eject = g_drive_can_eject (drive);
533- }
534-
535- return can_eject;
536-}
537-
538-/* ---------------------------------------------------------------------------------------------------- */
539-
540-typedef struct
541-{
542- volatile gint ref_count;
543- GSimpleAsyncResult *simple;
544- gboolean completed;
545-
546- GVfsUDisks2Mount *mount;
547-
548- UDisksEncrypted *encrypted;
549- UDisksFilesystem *filesystem;
550-
551- GCancellable *cancellable;
552-
553- GMountOperation *mount_operation;
554- GMountUnmountFlags flags;
555-
556- gulong mount_op_reply_handler_id;
557- guint retry_unmount_timer_id;
558-} UnmountData;
559-
560-static UnmountData *
561-unmount_data_ref (UnmountData *data)
562-{
563- g_atomic_int_inc (&data->ref_count);
564- return data;
565-}
566-
567-static void
568-unmount_data_unref (UnmountData *data)
569-{
570- if (g_atomic_int_dec_and_test (&data->ref_count))
571- {
572- g_object_unref (data->simple);
573-
574- if (data->mount_op_reply_handler_id > 0)
575- {
576- /* make the operation dialog go away */
577- g_signal_emit_by_name (data->mount_operation, "aborted");
578- g_signal_handler_disconnect (data->mount_operation, data->mount_op_reply_handler_id);
579- }
580- if (data->retry_unmount_timer_id > 0)
581- {
582- g_source_remove (data->retry_unmount_timer_id);
583- data->retry_unmount_timer_id = 0;
584- }
585-
586- g_clear_object (&data->mount);
587- g_clear_object (&data->cancellable);
588- g_clear_object (&data->mount_operation);
589- g_clear_object (&data->encrypted);
590- g_clear_object (&data->filesystem);
591- g_free (data);
592- }
593-}
594-
595-static void unmount_do (UnmountData *data, gboolean force);
596-
597-static gboolean
598-on_retry_timer_cb (gpointer user_data)
599-{
600- UnmountData *data = user_data;
601-
602- if (data->retry_unmount_timer_id == 0)
603- goto out;
604-
605- /* we're removing the timeout */
606- data->retry_unmount_timer_id = 0;
607-
608- /* timeout expired => try again */
609- unmount_do (data, FALSE);
610-
611- out:
612- return FALSE; /* remove timeout */
613-}
614-
615-static void
616-on_mount_op_reply (GMountOperation *mount_operation,
617- GMountOperationResult result,
618- gpointer user_data)
619-{
620- UnmountData *data = user_data;
621- gint choice;
622-
623- /* disconnect the signal handler */
624- g_warn_if_fail (data->mount_op_reply_handler_id != 0);
625- g_signal_handler_disconnect (data->mount_operation,
626- data->mount_op_reply_handler_id);
627- data->mount_op_reply_handler_id = 0;
628-
629- choice = g_mount_operation_get_choice (mount_operation);
630-
631- if (result == G_MOUNT_OPERATION_ABORTED ||
632- (result == G_MOUNT_OPERATION_HANDLED && choice == 1))
633- {
634- /* don't show an error dialog here */
635- g_simple_async_result_set_error (data->simple,
636- G_IO_ERROR,
637- G_IO_ERROR_FAILED_HANDLED,
638- "GMountOperation aborted (user should never see this "
639- "error since it is G_IO_ERROR_FAILED_HANDLED)");
640- g_simple_async_result_complete_in_idle (data->simple);
641- data->completed = TRUE;
642- unmount_data_unref (data);
643- }
644- else if (result == G_MOUNT_OPERATION_HANDLED)
645- {
646- /* user chose force unmount => try again with force_unmount==TRUE */
647- unmount_do (data, TRUE);
648- }
649- else
650- {
651- /* result == G_MOUNT_OPERATION_UNHANDLED => GMountOperation instance doesn't
652- * support :show-processes signal
653- */
654- g_simple_async_result_set_error (data->simple,
655- G_IO_ERROR,
656- G_IO_ERROR_BUSY,
657- _("One or more programs are preventing the unmount operation."));
658- g_simple_async_result_complete_in_idle (data->simple);
659- data->completed = TRUE;
660- unmount_data_unref (data);
661- }
662-}
663-
664-static void
665-lsof_command_cb (GObject *source_object,
666- GAsyncResult *res,
667- gpointer user_data)
668-{
669- UnmountData *data = user_data;
670- GError *error;
671- gint exit_status;
672- GArray *processes;
673- const gchar *choices[3] = {NULL, NULL, NULL};
674- const gchar *message;
675- gchar *standard_output = NULL;
676- const gchar *p;
677-
678- processes = g_array_new (FALSE, FALSE, sizeof (GPid));
679-
680- error = NULL;
681- if (!gvfs_udisks2_utils_spawn_finish (res,
682- &exit_status,
683- &standard_output,
684- NULL, /* gchar **out_standard_error */
685- &error))
686- {
687- g_printerr ("Error launching lsof(1): %s (%s, %d)\n",
688- error->message, g_quark_to_string (error->domain), error->code);
689- g_error_free (error);
690- goto out;
691- }
692-
693- if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0))
694- {
695- g_printerr ("lsof(1) did not exit normally\n");
696- goto out;
697- }
698-
699- p = standard_output;
700- while (TRUE)
701- {
702- GPid pid;
703- gchar *endp;
704-
705- if (*p == '\0')
706- break;
707-
708- pid = strtol (p, &endp, 10);
709- if (pid == 0 && p == endp)
710- break;
711-
712- g_array_append_val (processes, pid);
713-
714- p = endp;
715- }
716-
717- out:
718- if (!data->completed)
719- {
720- gboolean is_eject;
721-
722- is_eject = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->mount_operation), "x-udisks2-is-eject"));
723-
724- /* We want to emit the 'show-processes' signal even if launching
725- * lsof(1) failed or if it didn't return any PIDs. This is because
726- * it won't show e.g. root-owned processes operating on files
727- * on the mount point.
728- *
729- * (unfortunately there's no way to convey that it failed)
730- */
731- if (data->mount_op_reply_handler_id == 0)
732- {
733- data->mount_op_reply_handler_id = g_signal_connect (data->mount_operation,
734- "reply",
735- G_CALLBACK (on_mount_op_reply),
736- data);
737- }
738- if (is_eject)
739- {
740- choices[0] = _("Eject Anyway");
741- }
742- else
743- {
744- choices[0] = _("Unmount Anyway");
745- }
746- choices[1] = _("Cancel");
747- message = _("Volume is busy\n"
748- "One or more applications are keeping the volume busy.");
749- g_signal_emit_by_name (data->mount_operation,
750- "show-processes",
751- message,
752- processes,
753- choices);
754- /* set up a timer to try unmounting every two seconds - this will also
755- * update the list of busy processes
756- */
757- if (data->retry_unmount_timer_id == 0)
758- {
759- data->retry_unmount_timer_id = g_timeout_add_seconds (2,
760- on_retry_timer_cb,
761- data);
762- }
763- g_array_free (processes, TRUE);
764- g_free (standard_output);
765- }
766- unmount_data_unref (data); /* return ref */
767-}
768-
769-
770-static void
771-unmount_show_busy (UnmountData *data,
772- const gchar *mount_point)
773-{
774- gchar *escaped_mount_point;
775- escaped_mount_point = g_strescape (mount_point, NULL);
776- gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
777- data->cancellable,
778- lsof_command_cb,
779- unmount_data_ref (data),
780- "lsof -t \"%s\"",
781- escaped_mount_point);
782- g_free (escaped_mount_point);
783-}
784-
785-static void
786-lock_cb (GObject *source_object,
787- GAsyncResult *res,
788- gpointer user_data)
789-{
790- UDisksEncrypted *encrypted = UDISKS_ENCRYPTED (source_object);
791- UnmountData *data = user_data;
792- GError *error;
793-
794- error = NULL;
795- if (!udisks_encrypted_call_lock_finish (encrypted,
796- res,
797- &error))
798- g_simple_async_result_take_error (data->simple, error);
799- g_simple_async_result_complete (data->simple);
800- data->completed = TRUE;
801- unmount_data_unref (data);
802-}
803-
804-static void
805-unmount_cb (GObject *source_object,
806- GAsyncResult *res,
807- gpointer user_data)
808-{
809- UDisksFilesystem *filesystem = UDISKS_FILESYSTEM (source_object);
810- UnmountData *data = user_data;
811- GError *error;
812-
813- error = NULL;
814- if (!udisks_filesystem_call_unmount_finish (filesystem,
815- res,
816- &error))
817- {
818- gvfs_udisks2_utils_udisks_error_to_gio_error (error);
819-
820- /* if the user passed in a GMountOperation, then do the GMountOperation::show-processes dance ... */
821- if (error->code == G_IO_ERROR_BUSY && data->mount_operation != NULL)
822- {
823- unmount_show_busy (data, udisks_filesystem_get_mount_points (filesystem)[0]);
824- goto out;
825- }
826- g_simple_async_result_take_error (data->simple, error);
827- }
828- else
829- {
830- gvfs_udisks2_volume_monitor_update (data->mount->monitor);
831- if (data->encrypted != NULL)
832- {
833- udisks_encrypted_call_lock (data->encrypted,
834- g_variant_new ("a{sv}", NULL), /* options */
835- data->cancellable,
836- lock_cb,
837- data);
838- goto out;
839- }
840- }
841-
842- g_simple_async_result_complete (data->simple);
843- data->completed = TRUE;
844- unmount_data_unref (data);
845- out:
846- ;
847-}
848-
849-
850-/* ------------------------------ */
851-
852-static void
853-umount_command_cb (GObject *source_object,
854- GAsyncResult *res,
855- gpointer user_data)
856-{
857- UnmountData *data = user_data;
858- GError *error;
859- gint exit_status;
860- gchar *standard_error = NULL;
861-
862- error = NULL;
863- if (!gvfs_udisks2_utils_spawn_finish (res,
864- &exit_status,
865- NULL, /* gchar **out_standard_output */
866- &standard_error,
867- &error))
868- {
869- g_simple_async_result_take_error (data->simple, error);
870- g_simple_async_result_complete (data->simple);
871- data->completed = TRUE;
872- unmount_data_unref (data);
873- goto out;
874- }
875-
876- if (WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0)
877- {
878- gvfs_udisks2_volume_monitor_update (data->mount->monitor);
879- g_simple_async_result_complete (data->simple);
880- data->completed = TRUE;
881- unmount_data_unref (data);
882- goto out;
883- }
884-
885- if (standard_error != NULL &&
886- (strstr (standard_error, "device is busy") != NULL ||
887- strstr (standard_error, "target is busy") != NULL))
888- {
889- unmount_show_busy (data, data->mount->mount_path);
890- goto out;
891- }
892-
893- g_simple_async_result_set_error (data->simple,
894- G_IO_ERROR,
895- G_IO_ERROR_FAILED,
896- standard_error);
897- g_simple_async_result_complete (data->simple);
898- data->completed = TRUE;
899- unmount_data_unref (data);
900-
901- out:
902- g_free (standard_error);
903-}
904-
905-static void
906-unmount_do (UnmountData *data,
907- gboolean force)
908-{
909- GVariantBuilder builder;
910-
911- /* Use the umount(8) command if there is no block device / filesystem */
912- if (data->filesystem == NULL)
913- {
914- gchar *escaped_mount_path;
915- escaped_mount_path = g_strescape (data->mount->mount_path, NULL);
916- gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
917- data->cancellable,
918- umount_command_cb,
919- data,
920- "umount %s \"%s\"",
921- force ? "-l " : "",
922- escaped_mount_path);
923- g_free (escaped_mount_path);
924- goto out;
925- }
926-
927- g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
928- if (data->mount_operation == NULL)
929- {
930- g_variant_builder_add (&builder,
931- "{sv}",
932- "auth.no_user_interaction", g_variant_new_boolean (TRUE));
933- }
934- if (force || data->flags & G_MOUNT_UNMOUNT_FORCE)
935- {
936- g_variant_builder_add (&builder,
937- "{sv}",
938- "force", g_variant_new_boolean (TRUE));
939- }
940- g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (data->filesystem), G_MAXINT);
941- udisks_filesystem_call_unmount (data->filesystem,
942- g_variant_builder_end (&builder),
943- data->cancellable,
944- unmount_cb,
945- data);
946-
947- out:
948- ;
949-}
950-
951-static void
952-gvfs_udisks2_mount_unmount_with_operation (GMount *_mount,
953- GMountUnmountFlags flags,
954- GMountOperation *mount_operation,
955- GCancellable *cancellable,
956- GAsyncReadyCallback callback,
957- gpointer user_data)
958-{
959- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
960- UnmountData *data;
961- UDisksBlock *block;
962-
963- /* first emit the ::mount-pre-unmount signal */
964- g_signal_emit_by_name (mount->monitor, "mount-pre-unmount", mount);
965-
966- data = g_new0 (UnmountData, 1);
967- data->ref_count = 1;
968- data->simple = g_simple_async_result_new (G_OBJECT (mount),
969- callback,
970- user_data,
971- gvfs_udisks2_mount_unmount_with_operation);
972- data->mount = g_object_ref (mount);
973- data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
974- data->mount_operation = mount_operation != NULL ? g_object_ref (mount_operation) : NULL;
975- data->flags = flags;
976-
977- if (mount->is_burn_mount)
978- {
979- /* burn mounts are really never mounted so complete successfully immediately */
980- g_simple_async_result_complete_in_idle (data->simple);
981- data->completed = TRUE;
982- unmount_data_unref (data);
983- goto out;
984- }
985-
986- block = NULL;
987- if (mount->volume != NULL)
988- block = gvfs_udisks2_volume_get_block (data->mount->volume);
989- if (block != NULL)
990- {
991- GDBusObject *object;
992- object = g_dbus_interface_get_object (G_DBUS_INTERFACE (block));
993- if (object == NULL)
994- {
995- g_simple_async_result_set_error (data->simple,
996- G_IO_ERROR,
997- G_IO_ERROR_FAILED,
998- "No object for D-Bus interface");
999- g_simple_async_result_complete (data->simple);
1000- data->completed = TRUE;
1001- unmount_data_unref (data);
1002- goto out;
1003- }
1004- data->filesystem = udisks_object_get_filesystem (UDISKS_OBJECT (object));
1005- if (data->filesystem == NULL)
1006- {
1007- UDisksBlock *cleartext_block;
1008-
1009- data->encrypted = udisks_object_get_encrypted (UDISKS_OBJECT (object));
1010- if (data->encrypted == NULL)
1011- {
1012- g_simple_async_result_set_error (data->simple,
1013- G_IO_ERROR,
1014- G_IO_ERROR_FAILED,
1015- "No filesystem or encrypted interface on D-Bus object");
1016- g_simple_async_result_complete (data->simple);
1017- data->completed = TRUE;
1018- unmount_data_unref (data);
1019- goto out;
1020- }
1021-
1022- cleartext_block = udisks_client_get_cleartext_block (gvfs_udisks2_volume_monitor_get_udisks_client (mount->monitor),
1023- block);
1024- if (cleartext_block != NULL)
1025- {
1026- data->filesystem = udisks_object_get_filesystem (UDISKS_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (cleartext_block))));
1027- g_object_unref (cleartext_block);
1028- if (data->filesystem == NULL)
1029- {
1030- g_simple_async_result_set_error (data->simple,
1031- G_IO_ERROR,
1032- G_IO_ERROR_FAILED,
1033- "No filesystem interface on D-Bus object for cleartext device");
1034- g_simple_async_result_complete (data->simple);
1035- data->completed = TRUE;
1036- unmount_data_unref (data);
1037- goto out;
1038- }
1039- }
1040- }
1041- g_assert (data->filesystem != NULL);
1042- }
1043- unmount_do (data, FALSE /* force */);
1044-
1045- out:
1046- ;
1047-}
1048-
1049-static gboolean
1050-gvfs_udisks2_mount_unmount_with_operation_finish (GMount *mount,
1051- GAsyncResult *result,
1052- GError **error)
1053-{
1054- return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error);
1055-}
1056-
1057-/* ---------------------------------------------------------------------------------------------------- */
1058-
1059-static void
1060-gvfs_udisks2_mount_unmount (GMount *mount,
1061- GMountUnmountFlags flags,
1062- GCancellable *cancellable,
1063- GAsyncReadyCallback callback,
1064- gpointer user_data)
1065-{
1066- gvfs_udisks2_mount_unmount_with_operation (mount, flags, NULL, cancellable, callback, user_data);
1067-}
1068-
1069-static gboolean
1070-gvfs_udisks2_mount_unmount_finish (GMount *mount,
1071- GAsyncResult *result,
1072- GError **error)
1073-{
1074- return gvfs_udisks2_mount_unmount_with_operation_finish (mount, result, error);
1075-}
1076-
1077-/* ---------------------------------------------------------------------------------------------------- */
1078-
1079-typedef struct
1080-{
1081- GObject *object;
1082- GAsyncReadyCallback callback;
1083- gpointer user_data;
1084-} EjectWrapperOp;
1085-
1086-static void
1087-eject_wrapper_callback (GObject *source_object,
1088- GAsyncResult *res,
1089- gpointer user_data)
1090-{
1091- EjectWrapperOp *data = user_data;
1092- data->callback (data->object, res, data->user_data);
1093- g_object_unref (data->object);
1094- g_free (data);
1095-}
1096-
1097-static void
1098-gvfs_udisks2_mount_eject_with_operation (GMount *_mount,
1099- GMountUnmountFlags flags,
1100- GMountOperation *mount_operation,
1101- GCancellable *cancellable,
1102- GAsyncReadyCallback callback,
1103- gpointer user_data)
1104-{
1105- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
1106- GDrive *drive;
1107-
1108- drive = NULL;
1109- if (mount->volume != NULL)
1110- drive = g_volume_get_drive (G_VOLUME (mount->volume));
1111-
1112- if (drive != NULL)
1113- {
1114- EjectWrapperOp *data;
1115- data = g_new0 (EjectWrapperOp, 1);
1116- data->object = g_object_ref (mount);
1117- data->callback = callback;
1118- data->user_data = user_data;
1119- g_drive_eject_with_operation (drive, flags, mount_operation, cancellable, eject_wrapper_callback, data);
1120- g_object_unref (drive);
1121- }
1122- else
1123- {
1124- GSimpleAsyncResult *simple;
1125- simple = g_simple_async_result_new_error (G_OBJECT (mount),
1126- callback,
1127- user_data,
1128- G_IO_ERROR,
1129- G_IO_ERROR_FAILED,
1130- _("Operation not supported by backend"));
1131- g_simple_async_result_complete (simple);
1132- g_object_unref (simple);
1133- }
1134-}
1135-
1136-static gboolean
1137-gvfs_udisks2_mount_eject_with_operation_finish (GMount *_mount,
1138- GAsyncResult *result,
1139- GError **error)
1140-{
1141- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
1142- gboolean ret = TRUE;
1143- GDrive *drive;
1144-
1145- drive = NULL;
1146- if (mount->volume != NULL)
1147- drive = g_volume_get_drive (G_VOLUME (mount->volume));
1148-
1149- if (drive != NULL)
1150- {
1151- ret = g_drive_eject_with_operation_finish (drive, result, error);
1152- g_object_unref (drive);
1153- }
1154- else
1155- {
1156- g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error);
1157- ret = FALSE;
1158- }
1159- return ret;
1160-}
1161-
1162-static void
1163-gvfs_udisks2_mount_eject (GMount *mount,
1164- GMountUnmountFlags flags,
1165- GCancellable *cancellable,
1166- GAsyncReadyCallback callback,
1167- gpointer user_data)
1168-{
1169- gvfs_udisks2_mount_eject_with_operation (mount, flags, NULL, cancellable, callback, user_data);
1170-}
1171-
1172-static gboolean
1173-gvfs_udisks2_mount_eject_finish (GMount *mount,
1174- GAsyncResult *result,
1175- GError **error)
1176-{
1177- return gvfs_udisks2_mount_eject_with_operation_finish (mount, result, error);
1178-}
1179-
1180-/* ---------------------------------------------------------------------------------------------------- */
1181-
1182-static gchar **
1183-gvfs_udisks2_mount_guess_content_type_sync (GMount *_mount,
1184- gboolean force_rescan,
1185- GCancellable *cancellable,
1186- GError **error)
1187-{
1188- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
1189- gchar **x_content_types;
1190- GPtrArray *p;
1191- gchar **ret;
1192- guint n;
1193-
1194- p = g_ptr_array_new ();
1195-
1196- /* doesn't make sense to probe blank discs - look at the disc type instead */
1197- if (mount->is_burn_mount)
1198- {
1199- GDrive *drive;
1200- drive = gvfs_udisks2_mount_get_drive (_mount);
1201- if (drive != NULL)
1202- {
1203- UDisksDrive *udisks_drive = gvfs_udisks2_drive_get_udisks_drive (GVFS_UDISKS2_DRIVE (drive));;
1204- const gchar *media = udisks_drive_get_media (udisks_drive);
1205- if (media != NULL)
1206- {
1207- if (g_str_has_prefix (media, "optical_dvd"))
1208- g_ptr_array_add (p, g_strdup ("x-content/blank-dvd"));
1209- else if (g_str_has_prefix (media, "optical_hddvd"))
1210- g_ptr_array_add (p, g_strdup ("x-content/blank-hddvd"));
1211- else if (g_str_has_prefix (media, "optical_bd"))
1212- g_ptr_array_add (p, g_strdup ("x-content/blank-bd"));
1213- else
1214- g_ptr_array_add (p, g_strdup ("x-content/blank-cd")); /* assume CD */
1215- }
1216- g_object_unref (drive);
1217- }
1218- }
1219- else
1220- {
1221- /* sniff content type */
1222- x_content_types = g_content_type_guess_for_tree (mount->root);
1223- if (x_content_types != NULL)
1224- {
1225- for (n = 0; x_content_types[n] != NULL; n++)
1226- g_ptr_array_add (p, g_strdup (x_content_types[n]));
1227- g_strfreev (x_content_types);
1228- }
1229- }
1230-
1231- /* Check if its bootable */
1232- if (mount->device_file != NULL)
1233- {
1234- GUdevDevice *gudev_device;
1235- gudev_device = g_udev_client_query_by_device_file (gvfs_udisks2_volume_monitor_get_gudev_client (mount->monitor),
1236- mount->device_file);
1237- if (gudev_device != NULL)
1238- {
1239- if (g_udev_device_get_property_as_boolean (gudev_device, "OSINFO_BOOTABLE"))
1240- g_ptr_array_add (p, g_strdup ("x-content/bootable-media"));
1241- g_object_unref (gudev_device);
1242- }
1243- }
1244-
1245- if (p->len == 0)
1246- {
1247- ret = NULL;
1248- g_ptr_array_free (p, TRUE);
1249- }
1250- else
1251- {
1252- g_ptr_array_add (p, NULL);
1253- ret = (char **) g_ptr_array_free (p, FALSE);
1254- }
1255- return ret;
1256-}
1257-
1258-/* since we're an out-of-process volume monitor we'll just do this sync */
1259-static void
1260-gvfs_udisks2_mount_guess_content_type (GMount *mount,
1261- gboolean force_rescan,
1262- GCancellable *cancellable,
1263- GAsyncReadyCallback callback,
1264- gpointer user_data)
1265-{
1266- GSimpleAsyncResult *simple;
1267- simple = g_simple_async_result_new (G_OBJECT (mount),
1268- callback,
1269- user_data,
1270- NULL);
1271- g_simple_async_result_complete (simple);
1272- g_object_unref (simple);
1273-}
1274-
1275-static gchar **
1276-gvfs_udisks2_mount_guess_content_type_finish (GMount *mount,
1277- GAsyncResult *result,
1278- GError **error)
1279-{
1280- return gvfs_udisks2_mount_guess_content_type_sync (mount, FALSE, NULL, error);
1281-}
1282-/* ---------------------------------------------------------------------------------------------------- */
1283-
1284-static const gchar *
1285-gvfs_udisks2_mount_get_sort_key (GMount *_mount)
1286-{
1287- GVfsUDisks2Mount *mount = GVFS_UDISKS2_MOUNT (_mount);
1288- return mount->sort_key;
1289-}
1290-
1291-/* ---------------------------------------------------------------------------------------------------- */
1292-
1293-static void
1294-gvfs_udisks2_mount_mount_iface_init (GMountIface *iface)
1295-{
1296- iface->get_root = gvfs_udisks2_mount_get_root;
1297- iface->get_name = gvfs_udisks2_mount_get_name;
1298- iface->get_icon = gvfs_udisks2_mount_get_icon;
1299- iface->get_uuid = gvfs_udisks2_mount_get_uuid;
1300- iface->get_drive = gvfs_udisks2_mount_get_drive;
1301- iface->get_volume = gvfs_udisks2_mount_get_volume_;
1302- iface->can_unmount = gvfs_udisks2_mount_can_unmount;
1303- iface->can_eject = gvfs_udisks2_mount_can_eject;
1304- iface->unmount = gvfs_udisks2_mount_unmount;
1305- iface->unmount_finish = gvfs_udisks2_mount_unmount_finish;
1306- iface->unmount_with_operation = gvfs_udisks2_mount_unmount_with_operation;
1307- iface->unmount_with_operation_finish = gvfs_udisks2_mount_unmount_with_operation_finish;
1308- iface->eject = gvfs_udisks2_mount_eject;
1309- iface->eject_finish = gvfs_udisks2_mount_eject_finish;
1310- iface->eject_with_operation = gvfs_udisks2_mount_eject_with_operation;
1311- iface->eject_with_operation_finish = gvfs_udisks2_mount_eject_with_operation_finish;
1312- iface->guess_content_type = gvfs_udisks2_mount_guess_content_type;
1313- iface->guess_content_type_finish = gvfs_udisks2_mount_guess_content_type_finish;
1314- iface->guess_content_type_sync = gvfs_udisks2_mount_guess_content_type_sync;
1315- iface->get_sort_key = gvfs_udisks2_mount_get_sort_key;
1316-}
1317-
1318-gboolean
1319-gvfs_udisks2_mount_has_volume (GVfsUDisks2Mount *mount,
1320- GVfsUDisks2Volume *volume)
1321-{
1322- return mount->volume == volume;
1323-}
1324-
1325-GVfsUDisks2Volume *
1326-gvfs_udisks2_mount_get_volume (GVfsUDisks2Mount *mount)
1327-{
1328- return mount->volume;
1329-}
1330
1331=== removed file '.pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2volume.c'
1332--- .pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2volume.c 2012-06-06 13:48:26 +0000
1333+++ .pc/00git_compile_error.patch/monitor/udisks2/gvfsudisks2volume.c 1970-01-01 00:00:00 +0000
1334@@ -1,1613 +0,0 @@
1335-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
1336-/* gvfs - extensions for gio
1337- *
1338- * Copyright (C) 2006-2012 Red Hat, Inc.
1339- *
1340- * This library is free software; you can redistribute it and/or
1341- * modify it under the terms of the GNU Lesser General Public
1342- * License as published by the Free Software Foundation; either
1343- * version 2 of the License, or (at your option) any later version.
1344- *
1345- * This library is distributed in the hope that it will be useful,
1346- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1347- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1348- * Lesser General Public License for more details.
1349- *
1350- * You should have received a copy of the GNU Lesser General
1351- * Public License along with this library; if not, write to the
1352- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
1353- * Boston, MA 02111-1307, USA.
1354- *
1355- * Author: David Zeuthen <davidz@redhat.com>
1356- */
1357-
1358-#include <config.h>
1359-
1360-#include <string.h>
1361-#include <sys/wait.h>
1362-#include <unistd.h>
1363-
1364-#include <glib.h>
1365-#include <glib/gi18n-lib.h>
1366-#include <gio/gio.h>
1367-
1368-#ifdef HAVE_KEYRING
1369-#include <gnome-keyring.h>
1370-#endif
1371-
1372-#include "gvfsudisks2drive.h"
1373-#include "gvfsudisks2volume.h"
1374-#include "gvfsudisks2mount.h"
1375-#include "gvfsudisks2utils.h"
1376-
1377-typedef struct _GVfsUDisks2VolumeClass GVfsUDisks2VolumeClass;
1378-
1379-struct _GVfsUDisks2VolumeClass
1380-{
1381- GObjectClass parent_class;
1382-};
1383-
1384-struct MountData;
1385-typedef struct MountData MountData;
1386-
1387-static void mount_cancel_pending_op (MountData *data);
1388-
1389-struct _GVfsUDisks2Volume
1390-{
1391- GObject parent;
1392-
1393- GVfsUDisks2VolumeMonitor *monitor; /* owned by volume monitor */
1394- GVfsUDisks2Mount *mount; /* owned by volume monitor */
1395- GVfsUDisks2Drive *drive; /* owned by volume monitor */
1396-
1397- /* If TRUE, the volume was discovered at coldplug time */
1398- gboolean coldplug;
1399-
1400- /* exactly one of these are set */
1401- UDisksBlock *block;
1402- GUnixMountPoint *mount_point;
1403-
1404- /* set in update_volume() */
1405- GIcon *icon;
1406- GFile *activation_root;
1407- gchar *name;
1408- gchar *sort_key;
1409- gchar *device_file;
1410- dev_t dev;
1411- gchar *uuid;
1412- gboolean can_mount;
1413- gboolean should_automount;
1414-
1415- /* If a mount operation is in progress, then pending_mount_op is != NULL. This
1416- * is used to cancel the operation to make possible authentication dialogs go
1417- * away.
1418- */
1419- MountData *mount_pending_op;
1420-};
1421-
1422-static void gvfs_udisks2_volume_volume_iface_init (GVolumeIface *iface);
1423-
1424-static void on_block_changed (GObject *object,
1425- GParamSpec *pspec,
1426- gpointer user_data);
1427-
1428-static void on_udisks_client_changed (UDisksClient *client,
1429- gpointer user_data);
1430-
1431-G_DEFINE_TYPE_EXTENDED (GVfsUDisks2Volume, gvfs_udisks2_volume, G_TYPE_OBJECT, 0,
1432- G_IMPLEMENT_INTERFACE (G_TYPE_VOLUME, gvfs_udisks2_volume_volume_iface_init))
1433-
1434-static void
1435-gvfs_udisks2_volume_finalize (GObject *object)
1436-{
1437- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (object);
1438-
1439- g_signal_handlers_disconnect_by_func (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1440- G_CALLBACK (on_udisks_client_changed),
1441- volume);
1442-
1443- if (volume->mount != NULL)
1444- {
1445- gvfs_udisks2_mount_unset_volume (volume->mount, volume);
1446- }
1447-
1448- if (volume->drive != NULL)
1449- {
1450- gvfs_udisks2_drive_unset_volume (volume->drive, volume);
1451- }
1452-
1453- if (volume->block != NULL)
1454- {
1455- g_signal_handlers_disconnect_by_func (volume->block, G_CALLBACK (on_block_changed), volume);
1456- g_object_unref (volume->block);
1457- }
1458-
1459- if (volume->mount_point != NULL)
1460- g_unix_mount_point_free (volume->mount_point);
1461-
1462- if (volume->icon != NULL)
1463- g_object_unref (volume->icon);
1464- if (volume->activation_root != NULL)
1465- g_object_unref (volume->activation_root);
1466-
1467- g_free (volume->name);
1468- g_free (volume->sort_key);
1469- g_free (volume->device_file);
1470- g_free (volume->uuid);
1471-
1472- G_OBJECT_CLASS (gvfs_udisks2_volume_parent_class)->finalize (object);
1473-}
1474-
1475-static void
1476-gvfs_udisks2_volume_class_init (GVfsUDisks2VolumeClass *klass)
1477-{
1478- GObjectClass *gobject_class;
1479-
1480- gobject_class = G_OBJECT_CLASS (klass);
1481- gobject_class->finalize = gvfs_udisks2_volume_finalize;
1482-}
1483-
1484-static void
1485-gvfs_udisks2_volume_init (GVfsUDisks2Volume *volume)
1486-{
1487-}
1488-
1489-static void
1490-emit_changed (GVfsUDisks2Volume *volume)
1491-{
1492- g_signal_emit_by_name (volume, "changed");
1493- g_signal_emit_by_name (volume->monitor, "volume-changed", volume);
1494-}
1495-
1496-static void
1497-apply_options_from_fstab (GVfsUDisks2Volume *volume,
1498- const gchar *fstab_options)
1499-{
1500- gchar *name;
1501- gchar *icon_name;
1502-
1503- name = gvfs_udisks2_utils_lookup_fstab_options_value (fstab_options, "x-gvfs-name=");
1504- if (name != NULL)
1505- {
1506- g_free (volume->name);
1507- volume->name = name;
1508- }
1509-
1510- icon_name = gvfs_udisks2_utils_lookup_fstab_options_value (fstab_options, "x-gvfs-icon=");
1511- if (icon_name != NULL)
1512- {
1513- volume->icon = g_themed_icon_new_with_default_fallbacks (icon_name);
1514- g_free (icon_name);
1515- }
1516-}
1517-
1518-static gboolean
1519-update_volume (GVfsUDisks2Volume *volume)
1520-{
1521- gboolean changed;
1522- gboolean old_can_mount;
1523- gboolean old_should_automount;
1524- gchar *old_name;
1525- gchar *old_device_file;
1526- dev_t old_dev;
1527- GIcon *old_icon;
1528- UDisksDrive *udisks_drive;
1529- gchar *s;
1530-
1531- /* ---------------------------------------------------------------------------------------------------- */
1532- /* save old values */
1533-
1534- old_can_mount = volume->can_mount;
1535- old_should_automount = volume->should_automount;
1536- old_name = g_strdup (volume->name);
1537- old_device_file = g_strdup (volume->device_file);
1538- old_dev = volume->dev;
1539- old_icon = volume->icon != NULL ? g_object_ref (volume->icon) : NULL;
1540-
1541- /* ---------------------------------------------------------------------------------------------------- */
1542- /* reset */
1543-
1544- volume->can_mount = volume->should_automount = FALSE;
1545- g_free (volume->name); volume->name = NULL;
1546- g_free (volume->device_file); volume->device_file = NULL;
1547- volume->dev = 0;
1548- g_clear_object (&volume->icon);
1549-
1550- /* ---------------------------------------------------------------------------------------------------- */
1551- /* in with the new */
1552-
1553- if (volume->block != NULL)
1554- {
1555- const gchar *hint;
1556- UDisksBlock *block;
1557- UDisksBlock *cleartext_block;
1558- GVariantIter iter;
1559- const gchar *configuration_type;
1560- GVariant *configuration_value;
1561-
1562- /* If unlocked, use the values from the unlocked block device for presentation */
1563- cleartext_block = udisks_client_get_cleartext_block (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1564- volume->block);
1565- if (cleartext_block != NULL)
1566- block = cleartext_block;
1567- else
1568- block = volume->block;
1569-
1570- volume->dev = udisks_block_get_device_number (block);
1571- volume->device_file = udisks_block_dup_device (block);
1572-
1573- if (strlen (udisks_block_get_id_label (block)) > 0)
1574- {
1575- volume->name = g_strdup (udisks_block_get_id_label (block));
1576- }
1577- else if (g_strcmp0 (udisks_block_get_id_type (block), "crypto_LUKS") == 0)
1578- {
1579- s = udisks_client_get_size_for_display (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1580- udisks_block_get_size (volume->block), FALSE, FALSE);
1581- /* Translators: This is used for encrypted volumes.
1582- * The first %s is the formatted size (e.g. "42.0 MB").
1583- */
1584- volume->name = g_strdup_printf (_("%s Encrypted"), s);
1585- g_free (s);
1586- }
1587- else
1588- {
1589- guint64 size = udisks_block_get_size (block);
1590- if (size > 0)
1591- {
1592- s = udisks_client_get_size_for_display (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1593- size, FALSE, FALSE);
1594- /* Translators: This is used for volume with no filesystem label.
1595- * The first %s is the formatted size (e.g. "42.0 MB").
1596- */
1597- volume->name = g_strdup_printf (_("%s Volume"), s);
1598- g_free (s);
1599- }
1600- }
1601-
1602- udisks_drive = udisks_client_get_drive_for_block (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1603- volume->block);
1604- if (udisks_drive != NULL)
1605- {
1606- gchar *drive_desc;
1607- GIcon *drive_icon;
1608- gchar *media_desc;
1609- GIcon *media_icon;
1610-
1611- udisks_client_get_drive_info (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1612- udisks_drive,
1613- NULL, /* drive_name */
1614- &drive_desc,
1615- &drive_icon,
1616- &media_desc,
1617- &media_icon);
1618- if (media_desc == NULL)
1619- {
1620- media_desc = drive_desc;
1621- drive_desc = NULL;
1622- }
1623- if (media_icon == NULL)
1624- {
1625- media_icon = drive_icon;
1626- drive_icon = NULL;
1627- }
1628-
1629- /* Override name for blank and audio discs */
1630- if (udisks_drive_get_optical_blank (udisks_drive))
1631- {
1632- g_free (volume->name);
1633- volume->name = g_strdup (media_desc);
1634- }
1635- else if (volume->activation_root != NULL && g_file_has_uri_scheme (volume->activation_root, "cdda"))
1636- {
1637- g_free (volume->name);
1638- volume->name = g_strdup (_("Audio Disc"));
1639- }
1640-
1641- volume->icon = media_icon != NULL ? g_object_ref (media_icon) : NULL;
1642-
1643- /* use media_desc if we haven't figured out a name yet (applies to e.g.
1644- * /dev/fd0 since its size is 0)
1645- */
1646- if (volume->name == NULL)
1647- {
1648- volume->name = media_desc;
1649- media_desc = NULL;
1650- }
1651-
1652- g_free (media_desc);
1653- if (media_icon != NULL)
1654- g_object_unref (media_icon);
1655-
1656- /* Only automount drives attached to the same seat as we're running on
1657- */
1658- if (gvfs_udisks2_utils_is_drive_on_our_seat (udisks_drive))
1659- {
1660- /* Only automount filesystems from drives of known types/interconnects:
1661- *
1662- * - USB
1663- * - Firewire
1664- * - sdio
1665- * - optical discs
1666- *
1667- * The mantra here is "be careful" - we really don't want to
1668- * automount filesystems from all devices in a SAN etc - We
1669- * REALLY need to be CAREFUL here.
1670- *
1671- * Fortunately udisks provides a property just for this.
1672- */
1673- if (udisks_block_get_hint_auto (volume->block))
1674- {
1675- gboolean just_plugged_in = FALSE;
1676- /* Also, if a volume (partition) appear _much later_ than when media was inserted it
1677- * can only be because the media was repartitioned. We don't want to automount
1678- * such volumes. So only mark volumes appearing just after their drive.
1679- *
1680- * There's a catch here - if the volume was discovered at coldplug-time (typically
1681- * when the user desktop session started), we can't use this heuristic
1682- */
1683- if (g_get_real_time () - udisks_drive_get_time_media_detected (udisks_drive) < 5 * G_USEC_PER_SEC)
1684- just_plugged_in = TRUE;
1685- if (volume->coldplug || just_plugged_in)
1686- volume->should_automount = TRUE;
1687- }
1688- }
1689- g_object_unref (udisks_drive);
1690- }
1691-
1692- /* Use hints, if available */
1693- hint = udisks_block_get_hint_name (volume->block);
1694- if (hint != NULL && strlen (hint) > 0)
1695- {
1696- g_free (volume->name);
1697- volume->name = g_strdup (hint);
1698- }
1699- hint = udisks_block_get_hint_icon_name (volume->block);
1700- if (hint != NULL && strlen (hint) > 0)
1701- {
1702- g_clear_object (&volume->icon);
1703- volume->icon = g_themed_icon_new_with_default_fallbacks (hint);
1704- }
1705-
1706- /* Use x-gvfs-name=The%20Name and x-gvfs-icon=foo-name, if available */
1707- g_variant_iter_init (&iter, udisks_block_get_configuration (block));
1708- while (g_variant_iter_next (&iter, "(&s@a{sv})", &configuration_type, &configuration_value))
1709- {
1710- if (g_strcmp0 (configuration_type, "fstab") == 0)
1711- {
1712- const gchar *fstab_options;
1713- if (g_variant_lookup (configuration_value, "opts", "^&ay", &fstab_options))
1714- apply_options_from_fstab (volume, fstab_options);
1715- }
1716- g_variant_unref (configuration_value);
1717- }
1718-
1719- /* Add an emblem, depending on whether the encrypted volume is locked or unlocked */
1720- if (g_strcmp0 (udisks_block_get_id_type (volume->block), "crypto_LUKS") == 0 && volume->icon != NULL)
1721- {
1722- GEmblem *emblem;
1723- GIcon *padlock;
1724- GIcon *emblemed_icon;
1725- if (cleartext_block != NULL)
1726- padlock = g_themed_icon_new ("changes-allow");
1727- else
1728- padlock = g_themed_icon_new ("changes-prevent");
1729- emblem = g_emblem_new_with_origin (padlock, G_EMBLEM_ORIGIN_DEVICE);
1730- emblemed_icon = g_emblemed_icon_new (volume->icon, emblem);
1731- g_object_unref (padlock);
1732- g_object_unref (emblem);
1733-
1734- g_object_unref (volume->icon);
1735- volume->icon = emblemed_icon;
1736- }
1737-
1738- g_clear_object (&cleartext_block);
1739- }
1740- else
1741- {
1742- apply_options_from_fstab (volume, g_unix_mount_point_get_options (volume->mount_point));
1743- if (volume->name == NULL)
1744- volume->name = g_unix_mount_point_guess_name (volume->mount_point);
1745- if (volume->icon == NULL)
1746- volume->icon = gvfs_udisks2_utils_icon_from_fs_type (g_unix_mount_point_get_fs_type (volume->mount_point));
1747- }
1748-
1749- if (volume->mount == NULL)
1750- volume->can_mount = TRUE;
1751-
1752- /* ---------------------------------------------------------------------------------------------------- */
1753- /* fallbacks */
1754-
1755- if (volume->name == NULL)
1756- {
1757- /* Translators: Name used for volume */
1758- volume->name = g_strdup (_("Volume"));
1759- }
1760- if (volume->icon == NULL)
1761- volume->icon = g_themed_icon_new ("drive-removable-media");
1762-
1763- /* ---------------------------------------------------------------------------------------------------- */
1764- /* compute whether something changed */
1765-
1766- changed = !((old_can_mount == volume->can_mount) &&
1767- (old_should_automount == volume->should_automount) &&
1768- (g_strcmp0 (old_name, volume->name) == 0) &&
1769- (g_strcmp0 (old_device_file, volume->device_file) == 0) &&
1770- (old_dev == volume->dev) &&
1771- g_icon_equal (old_icon, volume->icon)
1772- );
1773-
1774- /* ---------------------------------------------------------------------------------------------------- */
1775- /* free old values */
1776-
1777- g_free (old_name);
1778- g_free (old_device_file);
1779- if (old_icon != NULL)
1780- g_object_unref (old_icon);
1781-
1782- return changed;
1783-}
1784-
1785-/* ---------------------------------------------------------------------------------------------------- */
1786-
1787-static void
1788-update_volume_on_event (GVfsUDisks2Volume *volume)
1789-{
1790- if (update_volume (volume))
1791- {
1792- emit_changed (volume);
1793- /* It could be that volume->dev changed (cryptotext volume morphing into a cleartext
1794- * volume)... since this is used to associated mounts with volumes (see the loop over
1795- * @unchanged in gvfsudisks2volumemonitor.c:update_mounts()) we need to over
1796- * the volume monitor
1797- */
1798- gvfs_udisks2_volume_monitor_update (volume->monitor);
1799- }
1800-}
1801-
1802-static void
1803-on_block_changed (GObject *object,
1804- GParamSpec *pspec,
1805- gpointer user_data)
1806-{
1807- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (user_data);
1808- update_volume_on_event (volume);
1809-}
1810-
1811-static void
1812-on_udisks_client_changed (UDisksClient *client,
1813- gpointer user_data)
1814-{
1815- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (user_data);
1816- update_volume_on_event (volume);
1817-}
1818-
1819-/* takes ownership of @mount_point if not NULL */
1820-GVfsUDisks2Volume *
1821-gvfs_udisks2_volume_new (GVfsUDisks2VolumeMonitor *monitor,
1822- UDisksBlock *block,
1823- GUnixMountPoint *mount_point,
1824- GVfsUDisks2Drive *drive,
1825- GFile *activation_root,
1826- gboolean coldplug)
1827-{
1828- GVfsUDisks2Volume *volume;
1829-
1830- volume = g_object_new (GVFS_TYPE_UDISKS2_VOLUME, NULL);
1831- volume->monitor = monitor;
1832- volume->coldplug = coldplug;
1833-
1834- volume->sort_key = g_strdup_printf ("gvfs.time_detected_usec.%" G_GINT64_FORMAT, g_get_real_time ());
1835-
1836- if (block != NULL)
1837- {
1838- volume->block = g_object_ref (block);
1839- g_signal_connect (volume->block, "notify", G_CALLBACK (on_block_changed), volume);
1840- }
1841- else if (mount_point != NULL)
1842- {
1843- volume->mount_point = mount_point;
1844- }
1845- else
1846- {
1847- g_assert_not_reached ();
1848- }
1849-
1850- volume->activation_root = activation_root != NULL ? g_object_ref (activation_root) : NULL;
1851-
1852- volume->drive = drive;
1853- if (drive != NULL)
1854- gvfs_udisks2_drive_set_volume (drive, volume);
1855-
1856- update_volume (volume);
1857-
1858- /* For LUKS devices, we also need to listen for changes on any possible cleartext device */
1859- if (volume->block != NULL && g_strcmp0 (udisks_block_get_id_type (volume->block), "crypto_LUKS") == 0)
1860- {
1861- g_signal_connect (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
1862- "changed",
1863- G_CALLBACK (on_udisks_client_changed),
1864- volume);
1865- }
1866-
1867- return volume;
1868-}
1869-
1870-/* ---------------------------------------------------------------------------------------------------- */
1871-
1872-void
1873-gvfs_udisks2_volume_removed (GVfsUDisks2Volume *volume)
1874-{
1875- if (volume->mount_pending_op != NULL)
1876- mount_cancel_pending_op (volume->mount_pending_op);
1877-
1878- if (volume->mount != NULL)
1879- {
1880- gvfs_udisks2_mount_unset_volume (volume->mount, volume);
1881- volume->mount = NULL;
1882- }
1883-
1884- if (volume->drive != NULL)
1885- {
1886- gvfs_udisks2_drive_unset_volume (volume->drive, volume);
1887- volume->drive = NULL;
1888- }
1889-}
1890-
1891-void
1892-gvfs_udisks2_volume_set_mount (GVfsUDisks2Volume *volume,
1893- GVfsUDisks2Mount *mount)
1894-{
1895- if (volume->mount != mount)
1896- {
1897- if (volume->mount != NULL)
1898- gvfs_udisks2_mount_unset_volume (volume->mount, volume);
1899-
1900- volume->mount = mount;
1901-
1902- emit_changed (volume);
1903- }
1904-}
1905-
1906-void
1907-gvfs_udisks2_volume_unset_mount (GVfsUDisks2Volume *volume,
1908- GVfsUDisks2Mount *mount)
1909-{
1910- if (volume->mount == mount)
1911- {
1912- volume->mount = NULL;
1913- emit_changed (volume);
1914- }
1915-}
1916-
1917-void
1918-gvfs_udisks2_volume_set_drive (GVfsUDisks2Volume *volume,
1919- GVfsUDisks2Drive *drive)
1920-{
1921- if (volume->drive != drive)
1922- {
1923- if (volume->drive != NULL)
1924- gvfs_udisks2_drive_unset_volume (volume->drive, volume);
1925- volume->drive = drive;
1926- emit_changed (volume);
1927- }
1928-}
1929-
1930-void
1931-gvfs_udisks2_volume_unset_drive (GVfsUDisks2Volume *volume,
1932- GVfsUDisks2Drive *drive)
1933-{
1934- if (volume->drive == drive)
1935- {
1936- volume->drive = NULL;
1937- emit_changed (volume);
1938- }
1939-}
1940-
1941-static GIcon *
1942-gvfs_udisks2_volume_get_icon (GVolume *_volume)
1943-{
1944- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1945- return volume->icon != NULL ? g_object_ref (volume->icon) : NULL;
1946-}
1947-
1948-static char *
1949-gvfs_udisks2_volume_get_name (GVolume *_volume)
1950-{
1951- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1952- return g_strdup (volume->name);
1953-}
1954-
1955-static char *
1956-gvfs_udisks2_volume_get_uuid (GVolume *_volume)
1957-{
1958- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1959- return g_strdup (volume->uuid);
1960-}
1961-
1962-static gboolean
1963-gvfs_udisks2_volume_can_mount (GVolume *_volume)
1964-{
1965- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1966- return volume->can_mount;
1967-}
1968-
1969-static gboolean
1970-gvfs_udisks2_volume_can_eject (GVolume *_volume)
1971-{
1972- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1973- gboolean can_eject = FALSE;
1974-
1975- if (volume->drive != NULL)
1976- can_eject = g_drive_can_eject (G_DRIVE (volume->drive));
1977- return can_eject;
1978-}
1979-
1980-static gboolean
1981-gvfs_udisks2_volume_should_automount (GVolume *_volume)
1982-{
1983- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
1984- return volume->should_automount;
1985-}
1986-
1987-static GDrive *
1988-gvfs_udisks2_volume_get_drive (GVolume *volume)
1989-{
1990- GVfsUDisks2Volume *gdu_volume = GVFS_UDISKS2_VOLUME (volume);
1991- GDrive *drive = NULL;
1992-
1993- if (gdu_volume->drive != NULL)
1994- drive = g_object_ref (gdu_volume->drive);
1995- return drive;
1996-}
1997-
1998-static GMount *
1999-gvfs_udisks2_volume_get_mount (GVolume *volume)
2000-{
2001- GVfsUDisks2Volume *gdu_volume = GVFS_UDISKS2_VOLUME (volume);
2002- GMount *mount = NULL;
2003-
2004- if (gdu_volume->mount != NULL)
2005- mount = g_object_ref (gdu_volume->mount);
2006- return mount;
2007-}
2008-
2009-/* ---------------------------------------------------------------------------------------------------- */
2010-
2011-static gboolean
2012-gvfs_udisks2_volume_is_network_class (GVfsUDisks2Volume *volume)
2013-{
2014- gboolean ret = FALSE;
2015- if (volume->mount_point != NULL)
2016- {
2017- const gchar *fstype = g_unix_mount_point_get_fs_type (volume->mount_point);
2018- if (g_strcmp0 (fstype, "nfs") == 0 ||
2019- g_strcmp0 (fstype, "nfs4") == 0 ||
2020- g_strcmp0 (fstype, "cifs") == 0 ||
2021- g_strcmp0 (fstype, "smbfs") == 0 ||
2022- g_strcmp0 (fstype, "ncpfs") == 0)
2023- ret = TRUE;
2024- }
2025- return ret;
2026-}
2027-
2028-/* ---------------------------------------------------------------------------------------------------- */
2029-
2030-/* can remove this once we depend on gio >= 2.31.19 */
2031-#ifndef G_VOLUME_IDENTIFIER_KIND_CLASS
2032-#define G_VOLUME_IDENTIFIER_KIND_CLASS "class"
2033-#endif
2034-
2035-static gchar *
2036-gvfs_udisks2_volume_get_identifier (GVolume *_volume,
2037- const gchar *kind)
2038-{
2039- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2040- const gchar *label;
2041- const gchar *uuid;
2042- gchar *ret = NULL;
2043-
2044- if (volume->block != NULL)
2045- {
2046- label = udisks_block_get_id_label (volume->block);
2047- uuid = udisks_block_get_id_uuid (volume->block);
2048-
2049- if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
2050- ret = g_strdup (volume->device_file);
2051- else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_LABEL) == 0)
2052- ret = strlen (label) > 0 ? g_strdup (label) : NULL;
2053- else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UUID) == 0)
2054- ret = strlen (uuid) > 0 ? g_strdup (uuid) : NULL;
2055- }
2056- if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_CLASS) == 0)
2057- ret = g_strdup (gvfs_udisks2_volume_is_network_class (volume) ? "network" : "device");
2058-
2059- return ret;
2060-}
2061-
2062-static gchar **
2063-gvfs_udisks2_volume_enumerate_identifiers (GVolume *_volume)
2064-{
2065- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2066- GPtrArray *p;
2067-
2068- p = g_ptr_array_new ();
2069- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_CLASS));
2070- if (volume->block != NULL)
2071- {
2072- const gchar *label;
2073- const gchar *uuid;
2074- label = udisks_block_get_id_label (volume->block);
2075- uuid = udisks_block_get_id_uuid (volume->block);
2076- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
2077- if (strlen (label) > 0)
2078- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_LABEL));
2079- if (strlen (uuid) > 0)
2080- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UUID));
2081- }
2082- g_ptr_array_add (p, NULL);
2083- return (gchar **) g_ptr_array_free (p, FALSE);
2084-}
2085-
2086-static GFile *
2087-gvfs_udisks2_volume_get_activation_root (GVolume *_volume)
2088-{
2089- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2090- return volume->activation_root != NULL ? g_object_ref (volume->activation_root) : NULL;
2091-}
2092-
2093-/* ---------------------------------------------------------------------------------------------------- */
2094-
2095-#ifdef HAVE_KEYRING
2096-static GnomeKeyringPasswordSchema luks_passphrase_schema =
2097-{
2098- GNOME_KEYRING_ITEM_GENERIC_SECRET,
2099- {
2100- {"gvfs-luks-uuid", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
2101- {NULL, 0}
2102- }
2103-};
2104-#endif
2105-
2106-struct MountData
2107-{
2108- GSimpleAsyncResult *simple;
2109-
2110- GVfsUDisks2Volume *volume;
2111- GCancellable *cancellable;
2112-
2113- gulong mount_operation_reply_handler_id;
2114- gulong mount_operation_aborted_handler_id;
2115- GMountOperation *mount_operation;
2116-
2117- gchar *passphrase;
2118-
2119- gchar *passphrase_from_keyring;
2120- GPasswordSave password_save;
2121-
2122- gchar *uuid_of_encrypted_to_unlock;
2123- gchar *desc_of_encrypted_to_unlock;
2124- UDisksEncrypted *encrypted_to_unlock;
2125- UDisksFilesystem *filesystem_to_mount;
2126-
2127- gboolean checked_keyring;
2128-};
2129-
2130-static void
2131-mount_data_free (MountData *data)
2132-{
2133- if (data->volume->mount_pending_op == data)
2134- data->volume->mount_pending_op = NULL;
2135-
2136- g_object_unref (data->simple);
2137-
2138- g_clear_object (&data->volume);
2139- g_clear_object (&data->cancellable);
2140-
2141- if (data->mount_operation != NULL)
2142- {
2143- if (data->mount_operation_reply_handler_id != 0)
2144- g_signal_handler_disconnect (data->mount_operation, data->mount_operation_reply_handler_id);
2145- if (data->mount_operation_aborted_handler_id != 0)
2146- g_signal_handler_disconnect (data->mount_operation, data->mount_operation_aborted_handler_id);
2147- g_object_unref (data->mount_operation);
2148- }
2149-
2150- g_free (data->passphrase);
2151- g_free (data->passphrase_from_keyring);
2152-
2153- g_free (data->uuid_of_encrypted_to_unlock);
2154- g_free (data->desc_of_encrypted_to_unlock);
2155- g_clear_object (&data->encrypted_to_unlock);
2156- g_clear_object (&data->filesystem_to_mount);
2157- g_free (data);
2158-}
2159-
2160-static void
2161-mount_cancel_pending_op (MountData *data)
2162-{
2163- g_cancellable_cancel (data->cancellable);
2164- /* send an ::aborted signal to make the dialog go away */
2165- if (data->mount_operation != NULL)
2166- g_signal_emit_by_name (data->mount_operation, "aborted");
2167-}
2168-
2169-/* ------------------------------ */
2170-
2171-static void
2172-mount_command_cb (GObject *source_object,
2173- GAsyncResult *res,
2174- gpointer user_data)
2175-{
2176- MountData *data = user_data;
2177- GError *error;
2178- gint exit_status;
2179- gchar *standard_error = NULL;
2180-
2181- /* NOTE: for e.g. NFS and CIFS mounts we could do GMountOperation stuff and pipe a
2182- * password to mount(8)'s stdin channel
2183- *
2184- * NOTE: if this fails because the user is not authorized (e.g. EPERM), we could
2185- * run it through a polkit-ified setuid root helper
2186- */
2187-
2188- error = NULL;
2189- if (!gvfs_udisks2_utils_spawn_finish (res,
2190- &exit_status,
2191- NULL, /* gchar **out_standard_output */
2192- &standard_error,
2193- &error))
2194- {
2195- g_simple_async_result_take_error (data->simple, error);
2196- g_simple_async_result_complete (data->simple);
2197- mount_data_free (data);
2198- goto out;
2199- }
2200-
2201- if (WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0)
2202- {
2203- gvfs_udisks2_volume_monitor_update (data->volume->monitor);
2204- g_simple_async_result_complete (data->simple);
2205- mount_data_free (data);
2206- goto out;
2207- }
2208-
2209- g_simple_async_result_set_error (data->simple,
2210- G_IO_ERROR,
2211- G_IO_ERROR_FAILED,
2212- standard_error);
2213- g_simple_async_result_complete (data->simple);
2214- mount_data_free (data);
2215-
2216- out:
2217- g_free (standard_error);
2218-}
2219-
2220-/* ------------------------------ */
2221-
2222-static void
2223-mount_cb (GObject *source_object,
2224- GAsyncResult *res,
2225- gpointer user_data)
2226-{
2227- MountData *data = user_data;
2228- gchar *mount_path;
2229- GError *error;
2230-
2231- error = NULL;
2232- if (!udisks_filesystem_call_mount_finish (UDISKS_FILESYSTEM (source_object),
2233- &mount_path,
2234- res,
2235- &error))
2236- {
2237- gvfs_udisks2_utils_udisks_error_to_gio_error (error);
2238- g_simple_async_result_take_error (data->simple, error);
2239- g_simple_async_result_complete (data->simple);
2240- }
2241- else
2242- {
2243- gvfs_udisks2_volume_monitor_update (data->volume->monitor);
2244- g_simple_async_result_complete (data->simple);
2245- g_free (mount_path);
2246- }
2247- mount_data_free (data);
2248-}
2249-
2250-static void
2251-do_mount (MountData *data)
2252-{
2253- GVariantBuilder builder;
2254-
2255- g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
2256- if (data->mount_operation == NULL)
2257- {
2258- g_variant_builder_add (&builder,
2259- "{sv}",
2260- "auth.no_user_interaction", g_variant_new_boolean (TRUE));
2261- }
2262- udisks_filesystem_call_mount (data->filesystem_to_mount,
2263- g_variant_builder_end (&builder),
2264- data->cancellable,
2265- mount_cb,
2266- data);
2267-}
2268-
2269-/* ------------------------------ */
2270-
2271-#ifdef HAVE_KEYRING
2272-static void
2273-luks_store_passphrase_cb (GnomeKeyringResult result,
2274- gpointer user_data)
2275-{
2276- MountData *data = user_data;
2277- if (result == GNOME_KEYRING_RESULT_OK)
2278- {
2279- /* everything is good */
2280- do_mount (data);
2281- }
2282- else
2283- {
2284- /* report failure */
2285- g_simple_async_result_set_error (data->simple,
2286- G_IO_ERROR,
2287- G_IO_ERROR_FAILED,
2288- _("Error storing passphrase in keyring (error code %d)"),
2289- result);
2290- g_simple_async_result_complete (data->simple);
2291- mount_data_free (data);
2292- }
2293-}
2294-#endif
2295-
2296-
2297-static void do_unlock (MountData *data);
2298-
2299-
2300-#ifdef HAVE_KEYRING
2301-static void
2302-luks_delete_passphrase_cb (GnomeKeyringResult result,
2303- gpointer user_data)
2304-{
2305- MountData *data = user_data;
2306- if (result == GNOME_KEYRING_RESULT_OK)
2307- {
2308- /* with the bad passphrase out of the way, try again */
2309- g_free (data->passphrase);
2310- data->passphrase = NULL;
2311- do_unlock (data);
2312- }
2313- else
2314- {
2315- /* report failure */
2316- g_simple_async_result_set_error (data->simple,
2317- G_IO_ERROR,
2318- G_IO_ERROR_FAILED,
2319- _("Error deleting invalid passphrase from keyring (error code %d)"),
2320- result);
2321- g_simple_async_result_complete (data->simple);
2322- mount_data_free (data);
2323- }
2324-}
2325-#endif
2326-
2327-static void
2328-unlock_cb (GObject *source_object,
2329- GAsyncResult *res,
2330- gpointer user_data)
2331-{
2332- MountData *data = user_data;
2333- gchar *cleartext_device = NULL;
2334- GError *error;
2335-
2336- error = NULL;
2337- if (!udisks_encrypted_call_unlock_finish (UDISKS_ENCRYPTED (source_object),
2338- &cleartext_device,
2339- res,
2340- &error))
2341- {
2342-#ifdef HAVE_KEYRING
2343- /* If this failed with a passphrase read from the keyring, try again
2344- * this time prompting the user...
2345- *
2346- * TODO: ideally check against something like UDISKS_ERROR_PASSPHRASE_INVALID
2347- * when such a thing is available in udisks
2348- */
2349- if (data->passphrase_from_keyring != NULL &&
2350- g_strcmp0 (data->passphrase, data->passphrase_from_keyring) == 0)
2351- {
2352- /* nuke the invalid passphrase from keyring... */
2353- gnome_keyring_delete_password (&luks_passphrase_schema,
2354- luks_delete_passphrase_cb,
2355- data,
2356- NULL, /* GDestroyNotify */
2357- "gvfs-luks-uuid", data->uuid_of_encrypted_to_unlock,
2358- NULL); /* sentinel */
2359- goto out;
2360- }
2361-#endif
2362- gvfs_udisks2_utils_udisks_error_to_gio_error (error);
2363- g_simple_async_result_take_error (data->simple, error);
2364- g_simple_async_result_complete (data->simple);
2365- mount_data_free (data);
2366- goto out;
2367- }
2368- else
2369- {
2370- UDisksObject *object;
2371-
2372- gvfs_udisks2_volume_monitor_update (data->volume->monitor);
2373-
2374- object = udisks_client_peek_object (gvfs_udisks2_volume_monitor_get_udisks_client (data->volume->monitor),
2375- cleartext_device);
2376- data->filesystem_to_mount = object != NULL ? udisks_object_get_filesystem (object) : NULL;
2377- if (data->filesystem_to_mount == NULL)
2378- {
2379- g_simple_async_result_set_error (data->simple,
2380- G_IO_ERROR,
2381- G_IO_ERROR_FAILED,
2382- _("The unlocked device does not have a recognizable filesystem on it"));
2383- g_simple_async_result_complete (data->simple);
2384- mount_data_free (data);
2385- goto out;
2386- }
2387-
2388-#ifdef HAVE_KEYRING
2389- /* passphrase worked - save it in the keyring if requested */
2390- if (data->password_save != G_PASSWORD_SAVE_NEVER)
2391- {
2392- const gchar *keyring;
2393- gchar *display_name;
2394-
2395- switch (data->password_save)
2396- {
2397- case G_PASSWORD_SAVE_NEVER:
2398- g_assert_not_reached ();
2399- break;
2400- case G_PASSWORD_SAVE_FOR_SESSION:
2401- keyring = GNOME_KEYRING_SESSION;
2402- break;
2403- case G_PASSWORD_SAVE_PERMANENTLY:
2404- keyring = GNOME_KEYRING_DEFAULT;
2405- break;
2406- }
2407-
2408- display_name = g_strdup_printf (_("Encryption passphrase for %s"),
2409- data->desc_of_encrypted_to_unlock);
2410-
2411- gnome_keyring_store_password (&luks_passphrase_schema,
2412- keyring,
2413- display_name,
2414- data->passphrase,
2415- luks_store_passphrase_cb,
2416- data,
2417- NULL, /* GDestroyNotify */
2418- "gvfs-luks-uuid", data->uuid_of_encrypted_to_unlock,
2419- NULL); /* sentinel */
2420- goto out;
2421- }
2422-#endif
2423-
2424- /* OK, ready to rock */
2425- do_mount (data);
2426- }
2427-
2428- out:
2429- g_free (cleartext_device);
2430-}
2431-
2432-static void
2433-on_mount_operation_reply (GMountOperation *mount_operation,
2434- GMountOperationResult result,
2435- gpointer user_data)
2436-{
2437- MountData *data = user_data;
2438-
2439- /* we got what we wanted; don't listen to any other signals from the mount operation */
2440- if (data->mount_operation_reply_handler_id != 0)
2441- {
2442- g_signal_handler_disconnect (data->mount_operation, data->mount_operation_reply_handler_id);
2443- data->mount_operation_reply_handler_id = 0;
2444- }
2445- if (data->mount_operation_aborted_handler_id != 0)
2446- {
2447- g_signal_handler_disconnect (data->mount_operation, data->mount_operation_aborted_handler_id);
2448- data->mount_operation_aborted_handler_id = 0;
2449- }
2450-
2451- if (result != G_MOUNT_OPERATION_HANDLED)
2452- {
2453- if (result == G_MOUNT_OPERATION_ABORTED)
2454- {
2455- /* The user aborted the operation so consider it "handled" */
2456- g_simple_async_result_set_error (data->simple,
2457- G_IO_ERROR,
2458- G_IO_ERROR_FAILED_HANDLED,
2459- "Password dialog aborted (user should never see this error since it is G_IO_ERROR_FAILED_HANDLED)");
2460- }
2461- else
2462- {
2463- g_simple_async_result_set_error (data->simple,
2464- G_IO_ERROR,
2465- G_IO_ERROR_PERMISSION_DENIED,
2466- "Expected G_MOUNT_OPERATION_HANDLED but got %d", result);
2467- }
2468- g_simple_async_result_complete (data->simple);
2469- mount_data_free (data);
2470- goto out;
2471- }
2472-
2473- data->passphrase = g_strdup (g_mount_operation_get_password (mount_operation));
2474- data->password_save = g_mount_operation_get_password_save (mount_operation);
2475-
2476- /* Don't save password in keyring just yet - check if it works first */
2477-
2478- do_unlock (data);
2479-
2480- out:
2481- ;
2482-}
2483-
2484-static void
2485-on_mount_operation_aborted (GMountOperation *mount_operation,
2486- gpointer user_data)
2487-{
2488- on_mount_operation_reply (mount_operation, G_MOUNT_OPERATION_ABORTED, user_data);
2489-}
2490-
2491-static gboolean
2492-has_crypttab_passphrase (MountData *data)
2493-{
2494- gboolean ret = FALSE;
2495- GVariantIter iter;
2496- GVariant *configuration_value;
2497- const gchar *configuration_type;
2498-
2499- g_variant_iter_init (&iter, udisks_block_get_configuration (data->volume->block));
2500- while (g_variant_iter_next (&iter, "(&s@a{sv})", &configuration_type, &configuration_value))
2501- {
2502- if (g_strcmp0 (configuration_type, "crypttab") == 0)
2503- {
2504- const gchar *passphrase_path;
2505- if (g_variant_lookup (configuration_value, "passphrase-path", "^&ay", &passphrase_path))
2506- {
2507- if (passphrase_path != NULL && strlen (passphrase_path) > 0)
2508- {
2509- ret = TRUE;
2510- g_variant_unref (configuration_value);
2511- goto out;
2512- }
2513- }
2514- }
2515- g_variant_unref (configuration_value);
2516- }
2517- out:
2518- return ret;
2519-}
2520-
2521-#ifdef HAVE_KEYRING
2522-static void
2523-luks_find_passphrase_cb (GnomeKeyringResult result,
2524- const gchar *string,
2525- gpointer user_data)
2526-{
2527- MountData *data = user_data;
2528-
2529- /* Don't fail if a keyring error occured - just continue and request
2530- * the passphrase from the user...
2531- */
2532- if (result == GNOME_KEYRING_RESULT_OK)
2533- {
2534- data->passphrase = g_strdup (string);
2535- data->passphrase_from_keyring = g_strdup (string);
2536- }
2537- /* try again */
2538- do_unlock (data);
2539-}
2540-#endif
2541-
2542-static void
2543-do_unlock (MountData *data)
2544-{
2545- GVariantBuilder builder;
2546-
2547- if (data->passphrase == NULL)
2548- {
2549- /* If the passphrase is in the crypttab file, no need to ask the user, just use a blank passphrase */
2550- if (has_crypttab_passphrase (data))
2551- {
2552- data->passphrase = g_strdup ("");
2553- }
2554- else
2555- {
2556- gchar *message;
2557-
2558-#ifdef HAVE_KEYRING
2559- /* check if the passphrase is in the user's keyring */
2560- if (!data->checked_keyring)
2561- {
2562- data->checked_keyring = TRUE;
2563- gnome_keyring_find_password (&luks_passphrase_schema,
2564- luks_find_passphrase_cb,
2565- data,
2566- NULL, /* GDestroyNotify */
2567- "gvfs-luks-uuid", data->uuid_of_encrypted_to_unlock,
2568- NULL); /* sentinel */
2569- goto out;
2570- }
2571-#endif
2572-
2573- if (data->mount_operation == NULL)
2574- {
2575- g_simple_async_result_set_error (data->simple,
2576- G_IO_ERROR,
2577- G_IO_ERROR_FAILED,
2578- _("A passphrase is required to access the volume"));
2579- g_simple_async_result_complete (data->simple);
2580- mount_data_free (data);
2581- goto out;
2582- }
2583-
2584- data->mount_operation_reply_handler_id = g_signal_connect (data->mount_operation,
2585- "reply",
2586- G_CALLBACK (on_mount_operation_reply),
2587- data);
2588- data->mount_operation_aborted_handler_id = g_signal_connect (data->mount_operation,
2589- "aborted",
2590- G_CALLBACK (on_mount_operation_aborted),
2591- data);
2592- /* Translators: This is the message shown to users */
2593- message = g_strdup_printf (_("Enter a passphrase to unlock the volume\n"
2594- "The passphrase is needed to access encrypted data on %s."),
2595- data->desc_of_encrypted_to_unlock);
2596-
2597- /* NOTE: We (currently) don't offer the user to save the
2598- * passphrase in the keyring or /etc/crypttab - compared to
2599- * the gdu volume monitor (that used the keyring for this)
2600- * this is a "regression" but it's done this way on purpose
2601- * because
2602- *
2603- * - if the device is encrypted, it was probably the intent
2604- * that the passphrase is to be used every time it's used
2605- *
2606- * - supporting both /etc/crypttab and the keyring is confusing
2607- * and leaves the user to wonder where the key is stored.
2608- *
2609- * - the user can add an /etc/crypttab entry himself either
2610- * manually or through palimpsest
2611- */
2612- g_signal_emit_by_name (data->mount_operation,
2613- "ask-password",
2614- message,
2615- NULL,
2616- NULL,
2617- G_ASK_PASSWORD_NEED_PASSWORD |
2618- G_ASK_PASSWORD_SAVING_SUPPORTED);
2619- g_free (message);
2620- goto out;
2621- }
2622- }
2623-
2624- g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
2625- if (data->mount_operation == NULL)
2626- {
2627- g_variant_builder_add (&builder,
2628- "{sv}",
2629- "auth.no_user_interaction", g_variant_new_boolean (TRUE));
2630- }
2631- udisks_encrypted_call_unlock (data->encrypted_to_unlock,
2632- data->passphrase,
2633- g_variant_builder_end (&builder),
2634- data->cancellable,
2635- unlock_cb,
2636- data);
2637- out:
2638- ;
2639-}
2640-
2641-
2642-static void
2643-gvfs_udisks2_volume_mount (GVolume *_volume,
2644- GMountMountFlags flags,
2645- GMountOperation *mount_operation,
2646- GCancellable *cancellable,
2647- GAsyncReadyCallback callback,
2648- gpointer user_data)
2649-{
2650- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2651- GDBusObject *object;
2652- UDisksBlock *block;
2653- UDisksFilesystem *filesystem;
2654- MountData *data;
2655-
2656- data = g_new0 (MountData, 1);
2657- data->simple = g_simple_async_result_new (G_OBJECT (volume),
2658- callback,
2659- user_data,
2660- gvfs_udisks2_volume_mount);
2661- data->volume = g_object_ref (volume);
2662- data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
2663- data->mount_operation = mount_operation != NULL ? g_object_ref (mount_operation) : NULL;
2664-
2665- if (volume->mount_pending_op != NULL)
2666- {
2667- g_simple_async_result_set_error (data->simple,
2668- G_IO_ERROR,
2669- G_IO_ERROR_FAILED,
2670- "A mount operation is already pending");
2671- g_simple_async_result_complete (data->simple);
2672- mount_data_free (data);
2673- goto out;
2674- }
2675- volume->mount_pending_op = data;
2676-
2677- /* Use the mount(8) command if there is no block device */
2678- if (volume->block == NULL)
2679- {
2680- gchar *escaped_mount_path;
2681- escaped_mount_path = g_strescape (g_unix_mount_point_get_mount_path (data->volume->mount_point), NULL);
2682- gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
2683- data->cancellable,
2684- mount_command_cb,
2685- data,
2686- "mount \"%s\"",
2687- escaped_mount_path);
2688- g_free (escaped_mount_path);
2689- goto out;
2690- }
2691-
2692- /* if encrypted and already unlocked, just mount the cleartext block device */
2693- block = udisks_client_get_cleartext_block (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
2694- volume->block);
2695- if (block != NULL)
2696- g_object_unref (block);
2697- else
2698- block = volume->block;
2699-
2700- object = g_dbus_interface_get_object (G_DBUS_INTERFACE (block));
2701- if (object == NULL)
2702- {
2703- g_simple_async_result_set_error (data->simple,
2704- G_IO_ERROR,
2705- G_IO_ERROR_FAILED,
2706- "No object for D-Bus interface");
2707- g_simple_async_result_complete (data->simple);
2708- mount_data_free (data);
2709- goto out;
2710- }
2711-
2712- filesystem = udisks_object_peek_filesystem (UDISKS_OBJECT (object));
2713- if (filesystem == NULL)
2714- {
2715- data->encrypted_to_unlock = udisks_object_get_encrypted (UDISKS_OBJECT (object));
2716- if (data->encrypted_to_unlock != NULL)
2717- {
2718- UDisksDrive *udisks_drive;
2719-
2720- /* This description is used in both the prompt and the display-name of
2721- * the key stored in the user's keyring ...
2722- *
2723- * NOTE: we want a little bit more detail than what g_drive_get_name()
2724- * gives us, since this is going to be used to refer to the device even
2725- * when not plugged in
2726- */
2727- udisks_drive = udisks_client_get_drive_for_block (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
2728- block);
2729- if (udisks_drive != NULL)
2730- {
2731- gchar *drive_name;
2732- gchar *drive_desc;
2733- udisks_client_get_drive_info (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
2734- udisks_drive,
2735- &drive_name,
2736- &drive_desc,
2737- NULL, /* drive_icon */
2738- NULL, /* media_desc */
2739- NULL); /* media_icon */
2740- /* Translators: this is used to describe the drive the encrypted media
2741- * is on - the first %s is the name (such as 'WD 2500JB External'), the
2742- * second %s is the description ('250 GB Hard Disk').
2743- */
2744- data->desc_of_encrypted_to_unlock = g_strdup_printf (_("%s (%s)"),
2745- drive_name,
2746- drive_desc);
2747- g_free (drive_desc);
2748- g_free (drive_name);
2749- g_object_unref (udisks_drive);
2750- }
2751- else
2752- {
2753- data->desc_of_encrypted_to_unlock = udisks_block_dup_preferred_device (block);
2754- }
2755- data->uuid_of_encrypted_to_unlock = udisks_block_dup_id_uuid (block);
2756-
2757- do_unlock (data);
2758- goto out;
2759- }
2760-
2761- g_simple_async_result_set_error (data->simple,
2762- G_IO_ERROR,
2763- G_IO_ERROR_FAILED,
2764- "No .Filesystem or .Encrypted interface on D-Bus object");
2765- g_simple_async_result_complete (data->simple);
2766- mount_data_free (data);
2767- goto out;
2768- }
2769-
2770- data->filesystem_to_mount = g_object_ref (filesystem);
2771- do_mount (data);
2772-
2773- out:
2774- ;
2775-}
2776-
2777-static gboolean
2778-gvfs_udisks2_volume_mount_finish (GVolume *volume,
2779- GAsyncResult *result,
2780- GError **error)
2781-{
2782- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
2783- return !g_simple_async_result_propagate_error (simple, error);
2784-}
2785-
2786-/* ---------------------------------------------------------------------------------------------------- */
2787-
2788-typedef struct
2789-{
2790- GObject *object;
2791- GAsyncReadyCallback callback;
2792- gpointer user_data;
2793-} EjectWrapperOp;
2794-
2795-static void
2796-eject_wrapper_callback (GObject *source_object,
2797- GAsyncResult *res,
2798- gpointer user_data)
2799-{
2800- EjectWrapperOp *data = user_data;
2801- data->callback (data->object, res, data->user_data);
2802- g_object_unref (data->object);
2803- g_free (data);
2804-}
2805-
2806-static void
2807-gvfs_udisks2_volume_eject_with_operation (GVolume *_volume,
2808- GMountUnmountFlags flags,
2809- GMountOperation *mount_operation,
2810- GCancellable *cancellable,
2811- GAsyncReadyCallback callback,
2812- gpointer user_data)
2813-{
2814- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2815- GVfsUDisks2Drive *drive;
2816-
2817- drive = NULL;
2818- if (volume->drive != NULL)
2819- drive = g_object_ref (volume->drive);
2820-
2821- if (drive != NULL)
2822- {
2823- EjectWrapperOp *data;
2824- data = g_new0 (EjectWrapperOp, 1);
2825- data->object = g_object_ref (volume);
2826- data->callback = callback;
2827- data->user_data = user_data;
2828- g_drive_eject_with_operation (G_DRIVE (drive), flags, mount_operation, cancellable, eject_wrapper_callback, data);
2829- g_object_unref (drive);
2830- }
2831- else
2832- {
2833- GSimpleAsyncResult *simple;
2834- simple = g_simple_async_result_new_error (G_OBJECT (volume),
2835- callback,
2836- user_data,
2837- G_IO_ERROR,
2838- G_IO_ERROR_FAILED,
2839- _("Operation not supported by backend"));
2840- g_simple_async_result_complete (simple);
2841- g_object_unref (simple);
2842- }
2843-}
2844-
2845-static gboolean
2846-gvfs_udisks2_volume_eject_with_operation_finish (GVolume *_volume,
2847- GAsyncResult *result,
2848- GError **error)
2849-{
2850- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2851- gboolean ret = TRUE;
2852-
2853- if (volume->drive != NULL)
2854- {
2855- ret = g_drive_eject_with_operation_finish (G_DRIVE (volume->drive), result, error);
2856- }
2857- else
2858- {
2859- g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error);
2860- ret = FALSE;
2861- }
2862- return ret;
2863-}
2864-
2865-static void
2866-gvfs_udisks2_volume_eject (GVolume *volume,
2867- GMountUnmountFlags flags,
2868- GCancellable *cancellable,
2869- GAsyncReadyCallback callback,
2870- gpointer user_data)
2871-{
2872- gvfs_udisks2_volume_eject_with_operation (volume, flags, NULL, cancellable, callback, user_data);
2873-}
2874-
2875-static gboolean
2876-gvfs_udisks2_volume_eject_finish (GVolume *volume,
2877- GAsyncResult *result,
2878- GError **error)
2879-{
2880- return gvfs_udisks2_volume_eject_with_operation_finish (volume, result, error);
2881-}
2882-
2883-/* ---------------------------------------------------------------------------------------------------- */
2884-
2885-static const gchar *
2886-gvfs_udisks2_volume_get_sort_key (GVolume *_volume)
2887-{
2888- GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (_volume);
2889- return volume->sort_key;
2890-}
2891-
2892-/* ---------------------------------------------------------------------------------------------------- */
2893-
2894-static void
2895-gvfs_udisks2_volume_volume_iface_init (GVolumeIface *iface)
2896-{
2897- iface->get_name = gvfs_udisks2_volume_get_name;
2898- iface->get_icon = gvfs_udisks2_volume_get_icon;
2899- iface->get_uuid = gvfs_udisks2_volume_get_uuid;
2900- iface->get_drive = gvfs_udisks2_volume_get_drive;
2901- iface->get_mount = gvfs_udisks2_volume_get_mount;
2902- iface->can_mount = gvfs_udisks2_volume_can_mount;
2903- iface->can_eject = gvfs_udisks2_volume_can_eject;
2904- iface->should_automount = gvfs_udisks2_volume_should_automount;
2905- iface->get_activation_root = gvfs_udisks2_volume_get_activation_root;
2906- iface->enumerate_identifiers = gvfs_udisks2_volume_enumerate_identifiers;
2907- iface->get_identifier = gvfs_udisks2_volume_get_identifier;
2908-
2909- iface->mount_fn = gvfs_udisks2_volume_mount;
2910- iface->mount_finish = gvfs_udisks2_volume_mount_finish;
2911- iface->eject = gvfs_udisks2_volume_eject;
2912- iface->eject_finish = gvfs_udisks2_volume_eject_finish;
2913- iface->eject_with_operation = gvfs_udisks2_volume_eject_with_operation;
2914- iface->eject_with_operation_finish = gvfs_udisks2_volume_eject_with_operation_finish;
2915- iface->get_sort_key = gvfs_udisks2_volume_get_sort_key;
2916-}
2917-
2918-/* ---------------------------------------------------------------------------------------------------- */
2919-
2920-UDisksBlock *
2921-gvfs_udisks2_volume_get_block (GVfsUDisks2Volume *volume)
2922-{
2923- g_return_val_if_fail (GVFS_IS_UDISKS2_VOLUME (volume), NULL);
2924- return volume->block;
2925-}
2926-
2927-GUnixMountPoint *
2928-gvfs_udisks2_volume_get_mount_point (GVfsUDisks2Volume *volume)
2929-{
2930- g_return_val_if_fail (GVFS_IS_UDISKS2_VOLUME (volume), NULL);
2931- return volume->mount_point;
2932-}
2933-
2934-dev_t
2935-gvfs_udisks2_volume_get_dev (GVfsUDisks2Volume *volume)
2936-{
2937- g_return_val_if_fail (GVFS_IS_UDISKS2_VOLUME (volume), 0);
2938- return volume->dev;
2939-}
2940-
2941-gboolean
2942-gvfs_udisks2_volume_has_uuid (GVfsUDisks2Volume *volume,
2943- const gchar *uuid)
2944-{
2945- g_return_val_if_fail (GVFS_IS_UDISKS2_VOLUME (volume), FALSE);
2946- return g_strcmp0 (volume->uuid, uuid) == 0;
2947-}
2948
2949=== removed directory '.pc/01_modules_dir.patch'
2950=== removed file '.pc/01_modules_dir.patch/configure.ac'
2951--- .pc/01_modules_dir.patch/configure.ac 2012-06-28 10:42:45 +0000
2952+++ .pc/01_modules_dir.patch/configure.ac 1970-01-01 00:00:00 +0000
2953@@ -1,826 +0,0 @@
2954-AC_PREREQ([2.64])
2955-
2956-AC_INIT([gvfs],[1.13.2],[http://bugzilla.gnome.org/enter_bug.cgi?product=gvfs])
2957-AM_INIT_AUTOMAKE([1.11.1 no-dist-gzip dist-xz tar-pax])
2958-AM_CONFIG_HEADER(config.h)
2959-
2960-AM_SANITY_CHECK
2961-
2962-AC_C_CONST
2963-AC_ISC_POSIX
2964-AC_PROG_CC
2965-AC_PROG_CPP
2966-AC_PROG_INSTALL
2967-AC_PROG_LN_S
2968-AC_PROG_MAKE_SET
2969-AM_DISABLE_STATIC
2970-AM_PROG_LIBTOOL
2971-AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2972-AC_PATH_PROG(GIO_QUERYMODULES, gio-querymodules, no)
2973-AM_PROG_CC_C_O
2974-AC_PROG_SED
2975-
2976-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
2977-
2978-AC_TYPE_PID_T
2979-AC_TYPE_SIGNAL
2980-AC_TYPE_SIZE_T
2981-AC_TYPE_UID_T
2982-
2983-GLIB_GSETTINGS
2984-
2985-AH_VERBATIM([_GNU_SOURCE],
2986-[/* Enable GNU extensions on systems that have them. */
2987-#ifndef _GNU_SOURCE
2988-# define _GNU_SOURCE
2989-#endif])
2990-
2991-saved_CFLAGS=$CFLAGS
2992-AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec])
2993-CFLAGS=$saved_CFLAGS
2994-
2995-LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
2996-AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
2997-
2998-GTK_DOC_CHECK
2999-DISTCHECK_CONFIGURE_FLAGS="--enable-gtk-doc"
3000-AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
3001-
3002-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.31.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0 )
3003-
3004-PKG_CHECK_MODULES(DBUS, dbus-1)
3005-
3006-AC_ARG_WITH(dbus_service_dir,
3007- AS_HELP_STRING([--with-dbus-service-dir=PATH],[choose directory for dbus service files, [default=PREFIX/share/dbus-1/services]]),
3008- with_dbus_service_dir="$withval", with_dbus_service_dir=$datadir/dbus-1/services)
3009-DBUS_SERVICE_DIR=$with_dbus_service_dir
3010-AC_SUBST(DBUS_SERVICE_DIR)
3011-
3012-giomodulesdir=$libdir/gio/modules
3013-AC_SUBST(giomodulesdir)
3014-
3015-dnl ****************************
3016-dnl *** Checks for intltool ***
3017-dnl ****************************
3018-
3019-IT_PROG_INTLTOOL([0.35.0])
3020-GETTEXT_PACKAGE=gvfs
3021-
3022-AC_SUBST([GETTEXT_PACKAGE])
3023-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
3024-AM_GLIB_GNU_GETTEXT
3025-
3026-dnl ****************************
3027-dnl *** Checks for gettext ***
3028-dnl ****************************
3029-
3030-dnl *** disabled by now, using intltool ***
3031-dnl *** we'll revert when glib-gettexttize will be able
3032-dnl *** to manage [enconding: UTF-8] in POTIFILES.in
3033-
3034-dnl GETTEXT_PACKAGE=gvfs
3035-dnl AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain name])
3036-dnl AC_SUBST(GETTEXT_PACKAGE)
3037-
3038-dnl ALL_LINGUAS=""
3039-
3040-dnl AM_GLIB_GNU_GETTEXT
3041-
3042-dnl LIBS="$LIBS $INTLLIBS"
3043-
3044-dnl AM_GLIB_DEFINE_LOCALEDIR(GVFS_LOCALEDIR)
3045-
3046-dnl ****************************
3047-dnl *** Checks for ssh stuff ***
3048-dnl ****************************
3049-
3050-AC_PATH_PROG(SSH_PROGRAM, ssh, "ssh")
3051-
3052-dnl ****************************
3053-dnl *** Checks for pty stuff ***
3054-dnl ****************************
3055-
3056-AC_CHECK_HEADERS(sys/un.h stropts.h termios.h util.h utmp.h sys/uio.h sys/param.h)
3057-
3058-# Check for PTY handling functions.
3059-AC_CHECK_FUNCS(getpt posix_openpt grantpt unlockpt ptsname ptsname_r)
3060-
3061-# Pull in the right libraries for various functions which might not be
3062-# bundled into an exploded libc.
3063-AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
3064-if test x$have_socketpair = x1 ; then
3065- AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.])
3066-fi
3067-
3068-AC_SEARCH_LIBS(login_tty, util, [AC_DEFINE([HAVE_LOGIN_TTY],[],[Whether login_tty is available])])
3069-
3070-dnl **************************************************
3071-dnl *** Check if we should build with http backend ***
3072-dnl **************************************************
3073-AC_ARG_ENABLE(http, AS_HELP_STRING([--disable-http],[build without http/dav backend]))
3074-msg_http=no
3075-HTTP_CFLAGS=
3076-HTTP_LIBS=
3077-
3078-if test "x$enable_http" != "xno"; then
3079- PKG_CHECK_EXISTS(libsoup-gnome-2.4 >= 2.26.0, msg_http=yes)
3080-
3081- if test "x$msg_http" = "xyes"; then
3082- PKG_CHECK_MODULES(HTTP, libsoup-gnome-2.4 libxml-2.0)
3083- AC_DEFINE(HAVE_HTTP, 1, [Define to 1 if http/dav is going to be built])
3084- fi
3085-fi
3086-
3087-AC_SUBST(HTTP_CFLAGS)
3088-AC_SUBST(HTTP_LIBS)
3089-AM_CONDITIONAL(HAVE_HTTP, [test "$msg_http" = "yes"])
3090-
3091-dnl **************************************************
3092-dnl *** Check if we should build with DNS-SD backend ***
3093-dnl **************************************************
3094-AM_CONDITIONAL(HAVE_AVAHI, false)
3095-
3096-AC_ARG_ENABLE(avahi, AS_HELP_STRING([--disable-avahi],[build without avahi support]))
3097-msg_avahi=no
3098-if test "x$enable_avahi" != "xno"; then
3099- PKG_CHECK_MODULES(AVAHI, avahi-glib >= 0.6 avahi-client >= 0.6,
3100- [AM_CONDITIONAL(HAVE_AVAHI, true)
3101- AC_DEFINE(HAVE_AVAHI, [], [Set if we can use avahi])]
3102- msg_avahi=yes,
3103- [AM_CONDITIONAL(HAVE_AVAHI, false)])
3104- AC_SUBST(AVAHI_CFLAGS)
3105- AC_SUBST(AVAHI_LIBS)
3106-fi
3107-
3108-dnl ************************
3109-dnl *** Check for libXML ***
3110-dnl ************************
3111-PKG_CHECK_MODULES(LIBXML, libxml-2.0,
3112- [AM_CONDITIONAL(HAVE_LIBXML, true)
3113- AC_DEFINE(HAVE_LIBXML, [], [Set if we have libxml])]
3114- msg_libxml=yes,
3115- [AM_CONDITIONAL(HAVE_LIBXML, false)])
3116-
3117-dnl *************************
3118-dnl *** Check for libudev ***
3119-dnl *************************
3120-AC_ARG_ENABLE(udev, AS_HELP_STRING([--disable-udev],[build without libudev]))
3121-msg_udev=no
3122-UDEV_CFLAGS=
3123-UDEV_LIBS=
3124-
3125-if test "x$enable_udev" != "xno"; then
3126- PKG_CHECK_EXISTS(libudev >= 138, msg_udev=yes)
3127-
3128- if test "x$msg_udev" = "xyes"; then
3129- PKG_CHECK_MODULES(UDEV, libudev)
3130- AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev availible])
3131- fi
3132-fi
3133-
3134-dnl **********************
3135-dnl *** Check for FUSE ***
3136-dnl **********************
3137-AC_ARG_ENABLE(fuse, AS_HELP_STRING([--disable-fuse],[build without FUSE support]))
3138-msg_fuse=no
3139-FUSE_LIBS=
3140-FUSE_CFLAGS=
3141-
3142-if test "x$enable_fuse" != "xno"; then
3143- PKG_CHECK_EXISTS(fuse, msg_fuse=yes)
3144-
3145- if test "x$msg_fuse" = "xyes"; then
3146- PKG_CHECK_MODULES(FUSE, fuse >= 2.8.0)
3147- AC_DEFINE(HAVE_FUSE, 1, [Define to 1 if FUSE is available])
3148- fi
3149-fi
3150-
3151-AM_CONDITIONAL(USE_FUSE, [test "$msg_fuse" = "yes"])
3152-
3153-dnl ************************************
3154-dnl *** Check for gnome-disk-utility ***
3155-dnl ************************************
3156-
3157-AC_ARG_ENABLE(gdu, AS_HELP_STRING([--disable-gdu],[build without GDU volume monitor]))
3158-msg_gdu=no
3159-GDU_LIBS=
3160-GDU_CFLAGS=
3161-GDU_REQUIRED=3.0.2
3162-
3163-if test "x$enable_gdu" != "xno"; then
3164- PKG_CHECK_EXISTS([gdu >= $GDU_REQUIRED], msg_gdu=yes)
3165-
3166- if test "x$msg_gdu" = "xyes"; then
3167- PKG_CHECK_MODULES([GDU],[gdu >= $GDU_REQUIRED])
3168- AC_DEFINE(HAVE_GDU, 1, [Define to 1 if gnome-disk-utility is available])
3169- fi
3170-fi
3171-
3172-AM_CONDITIONAL(USE_GDU, [test "$msg_gdu" = "yes"])
3173-
3174-dnl *************************
3175-dnl *** Check for udisks2 ***
3176-dnl *************************
3177-
3178-AC_ARG_ENABLE(udisks2, AS_HELP_STRING([--disable-udisks2],[build without libudisks2]))
3179-msg_udisks2=no
3180-UDISKS2_LIBS=
3181-UDISKS2_CFLAGS=
3182-UDISKS2_REQUIRED=1.90
3183-
3184-if test "x$enable_udisks2" != "xno"; then
3185- PKG_CHECK_EXISTS([udisks2 >= $UDISKS2_REQUIRED], msg_udisks2=yes)
3186-
3187- if test "x$msg_udisks2" = "xyes"; then
3188- PKG_CHECK_MODULES([UDISKS2],[udisks2 >= $UDISKS2_REQUIRED])
3189- AC_DEFINE(HAVE_UDISKS2, 1, [Define to 1 if libudisks2 is available])
3190- fi
3191-fi
3192-
3193-AM_CONDITIONAL(USE_UDISKS2, [test "$msg_udisks2" = "yes"])
3194-
3195-dnl **********************************
3196-dnl *** Check for libsystemd-login ***
3197-dnl **********************************
3198-
3199-AC_ARG_ENABLE(libsystemd_login, AS_HELP_STRING([--disable-libsystemd-login],[build without liblibsystemd-login]))
3200-msg_libsystemd_login=no
3201-LIBSYSTEMD_LOGIN_LIBS=
3202-LIBSYSTEMD_LOGIN_CFLAGS=
3203-LIBSYSTEMD_LOGIN_REQUIRED=44
3204-
3205-if test "x$enable_libsystemd_login" != "xno"; then
3206- PKG_CHECK_EXISTS([libsystemd-login >= $LIBSYSTEMD_LOGIN_REQUIRED], msg_libsystemd_login=yes)
3207-
3208- if test "x$msg_libsystemd_login" = "xyes"; then
3209- PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],[libsystemd-login >= $LIBSYSTEMD_LOGIN_REQUIRED])
3210- AC_DEFINE(HAVE_LIBSYSTEMD_LOGIN, 1, [Define to 1 if liblibsystemd_login is available])
3211- fi
3212-fi
3213-
3214-AM_CONDITIONAL(USE_LIBSYSTEMD_LOGIN, [test "$msg_libsystemd_login" = "yes"])
3215-
3216-dnl **********************
3217-dnl *** Check for HAL ***
3218-dnl **********************
3219-AC_ARG_ENABLE(hal, AS_HELP_STRING([--disable-hal],[build without HAL support]))
3220-msg_hal=no
3221-have_hal_fast_init=no
3222-HAL_LIBS=
3223-HAL_CFLAGS=
3224-HAL_REQUIRED=0.5.10
3225-
3226-if test "x$enable_hal" != "xno" && test "x$msg_gdu" = "xno"; then
3227- PKG_CHECK_EXISTS([hal >= $HAL_REQUIRED], msg_hal=yes)
3228-
3229- if test "x$msg_hal" = "xyes"; then
3230- PKG_CHECK_MODULES([HAL],[hal >= $HAL_REQUIRED])
3231- AC_DEFINE(HAVE_HAL, 1, [Define to 1 if HAL is available])
3232- save_libs="$LIBS"
3233- LIBS="$HAL_LIBS"
3234- AC_CHECK_LIB(hal, libhal_get_all_devices_with_properties, have_hal_fast_init=yes)
3235- if test "x$have_hal_fast_init" = "xyes"; then
3236- AC_DEFINE(HAVE_HAL_FAST_INIT, 1, [Define to 1 if libhal_get_all_devices_with_properties is available])
3237- fi
3238- LIBS="$save_libs"
3239- fi
3240-fi
3241-
3242-AM_CONDITIONAL(USE_HAL, [test "$msg_hal" = "yes"])
3243-
3244-dnl **********************
3245-dnl *** Check for gudev ***
3246-dnl **********************
3247-AC_ARG_ENABLE(gudev, AS_HELP_STRING([--disable-gudev],[build without gudev support]))
3248-msg_gudev=no
3249-GUDEV_REQUIRED=001
3250-
3251-if test "x$enable_gudev" != "xno"; then
3252- PKG_CHECK_EXISTS([gudev-1.0 >= $GUDEV_REQUIRED], msg_gudev=yes)
3253-
3254- if test "x$msg_gudev" = "xyes"; then
3255- PKG_CHECK_MODULES(GUDEV, [gudev-1.0 >= $GUDEV_REQUIRED])
3256- AC_DEFINE(HAVE_GUDEV, 1, [Define to 1 if gudev is available])
3257- fi
3258-fi
3259-AM_CONDITIONAL(USE_GUDEV, [test "$msg_gudev" = "yes"])
3260-
3261-if test "x$msg_gudev" = "xyes"; then
3262- msg_hotplug_backend="gudev"
3263-else
3264- if test "x$msg_hal" = "xyes"; then
3265- msg_hotplug_backend="hal"
3266- else
3267- msg_hotplug_backend="none"
3268- fi
3269-fi
3270-
3271-dnl **************************************************
3272-dnl *** Check if we should build with CDDA backend ***
3273-dnl **************************************************
3274-AC_ARG_ENABLE(cdda, AS_HELP_STRING([--disable-cdda],[build without CDDA backend]))
3275-msg_cdda=no
3276-CDDA_LIBS=
3277-CDDA_CFLAGS=
3278-
3279-if test "x$enable_cdda" != "xno" -a \( "x$msg_hal" = "xyes" -o "x$msg_gudev" = "xyes" \); then
3280- PKG_CHECK_EXISTS(libcdio_paranoia >= 0.78.2, msg_cdda=yes)
3281-
3282- if test "x$msg_cdda" = "xyes"; then
3283- PKG_CHECK_MODULES(CDDA, libcdio_paranoia)
3284- AC_DEFINE(HAVE_CDDA, 1, [Define to 1 if CDDA is going to be built])
3285- fi
3286-fi
3287-
3288-AM_CONDITIONAL(USE_CDDA, [test "$msg_cdda" = "yes"])
3289-
3290-dnl *************************************************
3291-dnl *** Check if we should build with AFC backend ***
3292-dnl *************************************************
3293-AC_ARG_ENABLE(afc, AS_HELP_STRING([--disable-afc],[build without AFC backend]))
3294-msg_afc=no
3295-AFC_LIBS=
3296-AFC_CFLAGS=
3297-
3298-if test "x$enable_afc" != "xno" ; then
3299- PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.0 libplist >= 0.15, msg_afc=yes)
3300-
3301- if test "x$msg_afc" = "xyes"; then
3302- PKG_CHECK_MODULES(AFC, libimobiledevice-1.0 libplist)
3303- AC_DEFINE(HAVE_AFC, 1, [Define to 1 if AFC is going to be built])
3304- PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.2,
3305- [AC_DEFINE(HAVE_LIBIMOBILEDEVICE_1_1_2, 1,
3306- [Define to 1 if libimobiledevice-1.1.2 found])])
3307- fi
3308-fi
3309-
3310-AC_SUBST(AFC_LIBS)
3311-AC_SUBST(AFC_CFLAGS)
3312-
3313-AM_CONDITIONAL(USE_AFC, [test "$msg_afc" = "yes"])
3314-
3315-dnl *****************************************************
3316-dnl *** Check if we should build with obexftp backend ***
3317-dnl *****************************************************
3318-AC_ARG_ENABLE(obexftp, AS_HELP_STRING([--disable-obexftp],[build without ObexFTP backend]))
3319-msg_obexftp=no
3320-OBEXFTP_LIBS=
3321-OBEXFTP_CFLAGS=
3322-
3323-if test "x$enable_obexftp" != "xno"; then
3324- PKG_CHECK_EXISTS(dbus-glib-1 bluez >= 4.0, msg_obexftp=yes)
3325-
3326- dnl Make sure we have expat
3327- AC_CHECK_LIB(expat, XML_ParserCreate_MM,
3328- [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
3329- have_expat=false)
3330-
3331- if test "x$msg_obexftp" = "xyes" -a "x$have_expat" = "xtrue"; then
3332- PKG_CHECK_MODULES(OBEXFTP, dbus-glib-1 bluez >= 4.0)
3333- AC_SUBST(OBEXFTP_LIBS)
3334- AC_SUBST(OBEXFTP_CFLAGS)
3335-
3336- msg_obexftp=yes
3337- AC_DEFINE(HAVE_OBEXFTP, 1, [Define to 1 if ObexFTP is going to be built])
3338- EXPAT_CFLAGS=""
3339- EXPAT_LIBS="-lexpat"
3340- else
3341- msg_obexftp=no
3342- fi
3343-fi
3344-
3345-AC_SUBST(EXPAT_CFLAGS)
3346-AC_SUBST(EXPAT_LIBS)
3347-AM_CONDITIONAL(USE_OBEXFTP, [test "$msg_obexftp" = "yes"])
3348-
3349-dnl *************************
3350-dnl *** Check for gphoto2 ***
3351-dnl *************************
3352-AC_ARG_ENABLE(gphoto2, AS_HELP_STRING([--disable-gphoto2],[build without gphoto2 support]))
3353-msg_gphoto2=no
3354-GPHOTO2_LIBS=
3355-GPHOTO2_CFLAGS=
3356-
3357-if test "x$enable_gphoto2" != "xno" -a \( "x$msg_hal" = "xyes" -o "x$msg_gudev" = "xyes" \); then
3358- PKG_CHECK_MODULES(GPHOTO2, libgphoto2 >= 2.4.0, [msg_gphoto2=yes])
3359-
3360- # Need OS tweaks in hal volume monitor backend
3361- case "$host" in
3362- *-linux* | *-freebsd* | *-kfreebsd*-gnu)
3363- use_gphoto2=yes
3364- ;;
3365- *)
3366- use_gphoto2=no
3367- ;;
3368- esac
3369-
3370- if test "x$enable_gphoto2" = "xyes" -a "x$msg_gphoto2" != "xyes"; then
3371- AC_MSG_ERROR([gphoto2 support requested but not available])
3372- fi
3373-
3374- if test "x$msg_gphoto2" = "xyes"; then
3375- if test "x$use_gphoto2" = "xyes"; then
3376- AC_DEFINE(HAVE_GPHOTO2, 1, [Define to 1 if gphoto2 is available])
3377- else
3378- if test "x$enable_gphoto2" = "xyes"; then
3379- AC_MSG_ERROR([Cannot build with gphoto2 support. Need OS tweaks in hal volume monitor.])
3380- else
3381- AC_MSG_WARN([Not building with gphoto2 support. Need OS tweaks in hal volume monitor.])
3382- fi
3383- msg_gphoto2=no
3384- fi
3385- fi
3386-fi
3387-
3388-AM_CONDITIONAL(USE_GPHOTO2, [test "$msg_gphoto2" = "yes"])
3389-
3390-dnl *******************************
3391-dnl *** Check for GNOME Keyring ***
3392-dnl *******************************
3393-AC_ARG_ENABLE(keyring, AS_HELP_STRING([--disable-keyring],[build without GNOME Keyring support]))
3394-msg_keyring=no
3395-KEYRING_LIBS=
3396-KEYRING_CFLAGS=
3397-
3398-if test "x$enable_keyring" != "xno"; then
3399- PKG_CHECK_EXISTS(gnome-keyring-1, msg_keyring=yes)
3400-
3401- if test "x$msg_keyring" = "xyes"; then
3402- PKG_CHECK_MODULES(KEYRING, gnome-keyring-1)
3403- AC_DEFINE(HAVE_KEYRING, 1, [Define to 1 if GNOME Keyring is available])
3404- fi
3405-fi
3406-
3407-AM_CONDITIONAL(USE_KEYRING, [test "$msg_keyring" = "yes"])
3408-
3409-dnl ***********************************************
3410-dnl *** Check if we should build with libbluray ***
3411-dnl ***********************************************
3412-AC_ARG_ENABLE(bluray, AS_HELP_STRING([--disable-bluray],[build without bluray metadata support]))
3413-msg_bluray=no
3414-BLURAY_CFLAGS=
3415-BLURAY_LIBS=
3416-
3417-if test "x$enable_bluray" != "xno"; then
3418- PKG_CHECK_EXISTS(libbluray, msg_bluray=yes)
3419-
3420- if test "x$msg_bluray" = "xyes"; then
3421- PKG_CHECK_MODULES(BLURAY, libbluray)
3422- AC_DEFINE(HAVE_BLURAY, 1, [Define to 1 if bluray metadata is going to be built])
3423- fi
3424-fi
3425-
3426-AC_SUBST(BLURAY_CFLAGS)
3427-AC_SUBST(BLURAY_LIBS)
3428-AM_CONDITIONAL(HAVE_BLURAY, [test "$msg_bluray" = "yes"])
3429-
3430-dnl ==========================================================================
3431-dnl Samba 3.0
3432-
3433-AC_ARG_ENABLE(samba, AS_HELP_STRING([--disable-samba],[build without samba support]))
3434-msg_samba="no"
3435-if test "x$enable_samba" != "xno"; then
3436- AC_ARG_WITH(samba-includes, AS_HELP_STRING([--with-samba-includes=PREFIX],[Location of samba includes.]),
3437- with_samba_includes="$withval", with_samba_includes="/usr/include")
3438- have_samba_includes="no"
3439- if test "x${with_samba_includes}" != "xno"; then
3440- CPPFLAGS_save="$CPPFLAGS"
3441-
3442- CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
3443- AC_CHECK_HEADER(libsmbclient.h, [ samba_includes="yes" ])
3444- CPPFLAGS="$CPPFLAGS_save"
3445-
3446- if test "x{samba_includes}" != "xno" -a "x${samba_includes}" != "x"; then
3447- have_samba_includes="yes"
3448- if test "${with_samba_includes}" != "/usr/include" ; then
3449- SAMBA_CFLAGS="-I$with_samba_includes"
3450- else
3451- SAMBA_CFLAGS=""
3452- fi
3453-
3454- CPPFLAGS="$CPPFLAGS -I$with_samba_includes"
3455- AC_CHECK_MEMBER(SMBCCTX.flags,
3456- [AC_DEFINE(HAVE_SAMBA_FLAGS,, [Defined if flags available in SMBCCTXT])],,
3457- [#include <libsmbclient.h>])
3458- AC_CHECK_MEMBER(SMBCCTX.close,
3459- [AC_DEFINE(HAVE_SAMBA_OLD_CLOSE, , [Defined if old close is available in SMBCCTXT])],,
3460- [#include <libsmbclient.h>])
3461- CPPFLAGS="$CPPFLAGS_save"
3462- else
3463- SAMBA_CFLAGS=""
3464- fi
3465- fi
3466- AC_ARG_WITH(samba-libs, AS_HELP_STRING([--with-samba-libs=PREFIX],[Location of Samba libs.]),
3467- with_samba_libs="$withval", with_samba_libs="/usr/lib")
3468- if test "x${with_samba_libs}" != "xno" -a "x${have_samba_includes}" != "xno"; then
3469- LDFLAGS_save="$LDFLAGS"
3470-
3471- LDFLAGS="$LDFLAGS -L$with_samba_libs"
3472- AC_CHECK_LIB(smbclient, smbc_option_get,samba_libs="yes", samba_libs="no")
3473- LDFLAGS="$LDFLAGS_save"
3474- if test "x${samba_libs}" != "xno"; then
3475- AC_DEFINE(HAVE_SAMBA,, [Define to 1 if you have the samba 3.0 libraries])
3476- msg_samba="yes"
3477- if test x$with_samba_libs != x/usr/lib; then
3478- SAMBA_LIBS="-L$with_samba_libs -lsmbclient"
3479- else
3480- SAMBA_LIBS="-lsmbclient"
3481- fi
3482- AC_CHECK_LIB(smbclient, smbc_getFunctionStatVFS,
3483- AC_DEFINE(HAVE_SAMBA_STAT_VFS, , [Define to 1 if smbclient supports smbc_stat_fn]))
3484- else
3485- AC_CHECK_LIB(smbclient, smbc_new_context,samba_old_libs="yes", samba_old_libs="no")
3486- if test "x${samba_old_libs}" != "xno"; then
3487- msg_samba="Too old, need at least samba 3.0.22"
3488- fi
3489- SAMBA_CFLAGS=""
3490- SAMBA_LIBS=""
3491- fi
3492- fi
3493- AC_MSG_CHECKING(for Samba 3.0 libraries)
3494- AC_MSG_RESULT($msg_samba)
3495-fi
3496-AM_CONDITIONAL(HAVE_SAMBA, test "$msg_samba" = "yes")
3497-AC_SUBST(SAMBA_CFLAGS)
3498-AC_SUBST(SAMBA_LIBS)
3499-
3500-dnl ==========================================================================
3501-
3502-dnl ****************************
3503-dnl *** Check for libarchive ***
3504-dnl ****************************
3505-
3506-AC_ARG_ENABLE(archive, AS_HELP_STRING([--disable-archive],[build without archive support]))
3507-msg_archive="no"
3508-if test "x$enable_archive" != "xno"; then
3509- AC_ARG_WITH(archive-includes, AS_HELP_STRING([--with-archive-includes=PREFIX],[Location of archive includes.]),
3510- with_archive_includes="$withval", with_archive_includes="/usr/include")
3511- have_archive_includes="no"
3512- if test "x${with_archive_includes}" != "xno"; then
3513- CPPFLAGS_save="$CPPFLAGS"
3514-
3515- CPPFLAGS="$CPPFLAGS -I$with_archive_includes"
3516- AC_CHECK_HEADER(archive.h, [ archive_includes="yes" ])
3517- CPPFLAGS="$CPPFLAGS_save"
3518-
3519- if test "x{archive_includes}" != "xno" -a "x${archive_includes}" != "x"; then
3520- have_archive_includes="yes"
3521- if test "${with_archive_includes}" != "/usr/include" ; then
3522- ARCHIVE_CFLAGS="-I$with_archive_includes"
3523- else
3524- ARCHIVE_CFLAGS=""
3525- fi
3526- else
3527- ARCHIVE_CFLAGS=""
3528- fi
3529- fi
3530- AC_ARG_WITH(archive-libs, AS_HELP_STRING ([--with-archive-libs=PREFIX],[Location of Archive libs.]),
3531- with_archive_libs="$withval", with_archive_libs="/usr/lib")
3532- if test "x${with_archive_libs}" != "xno" -a "x${have_archive_includes}" != "xno"; then
3533- LDFLAGS_save="$LDFLAGS"
3534-
3535- LDFLAGS="$LDFLAGS -L$with_archive_libs"
3536- AC_CHECK_LIB(archive, archive_entry_filetype, archive_libs="yes", archive_libs="no")
3537- LDFLAGS="$LDFLAGS_save"
3538- if test "x${archive_libs}" != "xno"; then
3539- AC_DEFINE(HAVE_ARCHIVE,, [Define to 1 if you have the libarchive library])
3540- msg_archive="yes"
3541- if test x$with_archive_libs != x/usr/lib; then
3542- ARCHIVE_LIBS="-L$with_archive_libs -larchive"
3543- else
3544- ARCHIVE_LIBS="-larchive"
3545- fi
3546- else
3547- AC_CHECK_LIB(archive, archive_entry_filetype, archive_old_libs="yes", archive_old_libs="no")
3548- if test "x${archive_old_libs}" != "xno"; then
3549- msg_archive="Too old, need at least archive 3.0.22"
3550- fi
3551- ARCHIVE_CFLAGS=""
3552- ARCHIVE_LIBS=""
3553- fi
3554- fi
3555- AC_MSG_CHECKING(for Archive 3.libraries)
3556- AC_MSG_RESULT($msg_archive)
3557-fi
3558-AM_CONDITIONAL(HAVE_ARCHIVE, test "$msg_archive" = "yes")
3559-AC_SUBST(ARCHIVE_CFLAGS)
3560-AC_SUBST(ARCHIVE_LIBS)
3561-
3562-dnl ***************************
3563-dnl *** Check for libgcrypt ***
3564-dnl ***************************
3565-GCRYPT_VERSION=1.2.2
3566-GCRYPT_LIBVER=1
3567-
3568-AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION, have_gcrypt="yes",
3569- have_gcrypt="no")
3570-
3571-if test "x$have_gcrypt" != "xno"; then
3572- AC_DEFINE(HAVE_GCRYPT, 1, [Define to 1 if libgcrypt is available])
3573-fi
3574-AC_SUBST([LIBGCRYPT_CFLAGS])
3575-AC_SUBST([LIBGCRYPT_LIBS])
3576-
3577-dnl *******************
3578-dnl *** AFP backend ***
3579-dnl *******************
3580-AC_ARG_ENABLE(afp, AS_HELP_STRING([--disable-afp], [build without AFP support]))
3581-msg_afp="no"
3582-if test "x$enable_afp" != "xno"; then
3583-
3584- if test "x$have_gcrypt" = "xyes"; then
3585- msg_afp="yes"
3586- else
3587- msg_afp="partial (crypt support missing! Only anonymous logins)"
3588- fi
3589-fi
3590-AM_CONDITIONAL(USE_AFP, test "x$enable_afp" != "xno")
3591-
3592-dnl Install bash-completion file?
3593-AC_ARG_ENABLE([bash-completion],
3594- AC_HELP_STRING([--disable-bash-completion],
3595- [build without bash-completion support]),
3596- msg_bash_completion=$enableval,
3597- msg_bash_completion=yes)
3598-if test "x$enable_bash_completion" != "xno"; then
3599- msg_bash_completion=yes
3600-fi
3601-AM_CONDITIONAL(ENABLE_BASHCOMP, test "$msg_bash_completion" = "yes")
3602-
3603-AC_ARG_WITH([bash-completion-dir],
3604- AC_HELP_STRING([--with-bash-completion-dir=PATH],
3605- [choose directory for bash-completion file (default=DATADIR/bash-completion/completions)]),
3606- with_bashcomp_dir=$withval,
3607- with_bashcomp_dir=$datadir/bash-completion/completions)
3608-BASHCOMP_DIR=$with_bashcomp_dir
3609-AC_SUBST(BASHCOMP_DIR)
3610-
3611-dnl ==========================================================================
3612-
3613-dnl Globally define_GNU_SOURCE and therefore enable the GNU extensions
3614-AC_DEFINE(_GNU_SOURCE, 1, [Enable GNU Extensions])
3615-
3616-dnl ==========================================================================
3617-
3618-AC_DEFINE(_FILE_OFFSET_BITS, 64, [Enable LFS])
3619-
3620-dnl ==========================================================================
3621-
3622-AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
3623-
3624-dnl ==========================================================================
3625-dnl Look for various fs info getters
3626-
3627-AC_CHECK_HEADERS([sys/statfs.h sys/statvfs.h sys/vfs.h sys/mount.h sys/param.h])
3628-AC_CHECK_FUNCS(statvfs statfs)
3629-AC_CHECK_MEMBERS([struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include <sys/types.h>
3630-#include <sys/stat.h>
3631-#include <unistd.h>
3632-#ifdef HAVE_SYS_STATFS_H
3633-#include <sys/statfs.h>
3634-#endif
3635-#ifdef HAVE_SYS_PARAM_H
3636-#include <sys/param.h>
3637-#endif
3638-#ifdef HAVE_SYS_MOUNT_H
3639-#include <sys/mount.h>
3640-#endif])
3641-# struct statvfs.f_basetype is available on Solaris but not for Linux.
3642-AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [#include <sys/statvfs.h>])
3643-
3644-dnl
3645-dnl if statfs() takes 2 arguments (Posix) or 4 (Solaris)
3646-dnl
3647-if test "$ac_cv_func_statfs" = yes ; then
3648- AC_MSG_CHECKING([number of arguments to statfs()])
3649- AC_TRY_COMPILE([#include <unistd.h>
3650- #ifdef HAVE_SYS_PARAM_H
3651- #include <sys/param.h>
3652- #endif
3653- #ifdef HAVE_SYS_VFS_H
3654- #include <sys/vfs.h>
3655- #endif
3656- #ifdef HAVE_SYS_MOUNT_H
3657- #include <sys/mount.h>
3658- #endif
3659- #ifdef HAVE_SYS_STATFS_H
3660- #include <sys/statfs.h>
3661- #endif], [struct statfs st;
3662- statfs(NULL, &st);],[
3663- AC_MSG_RESULT([2])
3664- AC_DEFINE(STATFS_ARGS, 2, [Number of arguments to statfs()])],[
3665- AC_TRY_COMPILE([#include <unistd.h>
3666- #ifdef HAVE_SYS_PARAM_H
3667- #include <sys/param.h>
3668- #endif
3669- #ifdef HAVE_SYS_VFS_H
3670- #include <sys/vfs.h>
3671- #endif
3672- #ifdef HAVE_SYS_MOUNT_H
3673- #include <sys/mount.h>
3674- #endif
3675- #ifdef HAVE_SYS_STATFS_H
3676- #include <sys/statfs.h>
3677- #endif], [struct statfs st;
3678- statfs(NULL, &st, sizeof (st), 0);],[
3679- AC_MSG_RESULT([4])
3680- AC_DEFINE(STATFS_ARGS, 4, [Number of arguments to statfs()])],[
3681- AC_MSG_RESULT(unknown)
3682- AC_MSG_ERROR([unable to determine number of arguments to statfs()])])])
3683-fi
3684-
3685-dnl ==========================================================================
3686-dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
3687-
3688-AC_ARG_ENABLE(more-warnings,
3689-AS_HELP_STRING([--enable-more-warnings],[Maximum compiler warnings]),
3690-set_more_warnings="$enableval",[
3691-if test -f $srcdir/CVSVERSION; then
3692- is_cvs_version=true
3693- set_more_warnings=yes
3694-else
3695- set_more_warnings=no
3696-fi
3697-])
3698-AC_MSG_CHECKING(for more warnings, including -Werror)
3699-if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
3700- AC_MSG_RESULT(yes)
3701- CFLAGS="\
3702- -Wall \
3703- -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
3704- -Wnested-externs -Wpointer-arith \
3705- -Wcast-align -Wsign-compare \
3706- $CFLAGS"
3707-
3708- for option in -Wno-strict-aliasing -Wno-sign-compare -Wtype-limits; do
3709- SAVE_CFLAGS="$CFLAGS"
3710- CFLAGS="$CFLAGS $option"
3711- AC_MSG_CHECKING([whether gcc understands $option])
3712- AC_TRY_COMPILE([], [],
3713- has_option=yes,
3714- has_option=no,)
3715- if test $has_option = no; then
3716- CFLAGS="$SAVE_CFLAGS"
3717- fi
3718- AC_MSG_RESULT($has_option)
3719- unset has_option
3720- unset SAVE_CFLAGS
3721- done
3722- unset option
3723-else
3724- AC_MSG_RESULT(no)
3725-fi
3726-
3727-AC_OUTPUT([
3728-Makefile
3729-common/Makefile
3730-client/Makefile
3731-metadata/Makefile
3732-daemon/trashlib/Makefile
3733-daemon/Makefile
3734-monitor/Makefile
3735-monitor/proxy/Makefile
3736-monitor/hal/Makefile
3737-monitor/gdu/Makefile
3738-monitor/udisks2/Makefile
3739-monitor/gphoto2/Makefile
3740-monitor/afc/Makefile
3741-programs/Makefile
3742-test/Makefile
3743-po/Makefile.in
3744-])
3745-
3746-echo
3747-echo "gvfs configuration summary:"
3748-echo "
3749- gio module directory : $giomodulesdir
3750-
3751- hotplug backend: $msg_hotplug_backend
3752-
3753- Blu-ray metadata support: $msg_bluray
3754- FTP/HTTP/WebDAV support: $msg_http
3755- ObexFTP support $msg_obexftp
3756- Samba support: $msg_samba
3757- FUSE support: $msg_fuse
3758- CDDA support: $msg_cdda
3759- Gphoto2 support: $msg_gphoto2
3760- archive support: $msg_archive
3761- AFC support: $msg_afc
3762- AFP support: $msg_afp
3763- DNS-SD support: $msg_avahi
3764- Build HAL volume monitor: $msg_hal (with fast init path: $have_hal_fast_init)
3765- Build GDU volume monitor: $msg_gdu
3766- Build udisks2 volume monitor: $msg_udisks2
3767- Use libsystemd-login: $msg_libsystemd_login
3768- GNOME Keyring support: $msg_keyring
3769- Bash-completion support: $msg_bash_completion
3770-"
3771-
3772-# The gudev gphoto monitor needs a recent libgphoto; point to the required patch if the version is too old
3773-if test "x$msg_gudev" = "xyes"; then
3774- PKG_CHECK_EXISTS(libgphoto2 >= 2.4.7,, msg_gphoto_patch=yes)
3775- if test "x$msg_gphoto_patch" = "xyes"; then
3776- AC_MSG_WARN([You are using a libgphoto2 version earlier than 2.4.7. To work with gudev, you must apply the patch in http://sourceforge.net/tracker/?func=detail&aid=2801117&group_id=8874&atid=308874])
3777- fi
3778-fi
3779-
3780
3781=== removed directory '.pc/03_xdg-mount.patch'
3782=== removed directory '.pc/03_xdg-mount.patch/monitor'
3783=== removed directory '.pc/03_xdg-mount.patch/monitor/hal'
3784=== removed file '.pc/03_xdg-mount.patch/monitor/hal/ghaldrive.c'
3785--- .pc/03_xdg-mount.patch/monitor/hal/ghaldrive.c 2010-05-02 18:16:31 +0000
3786+++ .pc/03_xdg-mount.patch/monitor/hal/ghaldrive.c 1970-01-01 00:00:00 +0000
3787@@ -1,959 +0,0 @@
3788-/* GIO - GLib Input, Output and Streaming Library
3789- *
3790- * Copyright (C) 2006-2007 Red Hat, Inc.
3791- *
3792- * This library is free software; you can redistribute it and/or
3793- * modify it under the terms of the GNU Lesser General Public
3794- * License as published by the Free Software Foundation; either
3795- * version 2 of the License, or (at your option) any later version.
3796- *
3797- * This library is distributed in the hope that it will be useful,
3798- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3799- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3800- * Lesser General Public License for more details.
3801- *
3802- * You should have received a copy of the GNU Lesser General
3803- * Public License along with this library; if not, write to the
3804- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
3805- * Boston, MA 02111-1307, USA.
3806- *
3807- * Author: David Zeuthen <davidz@redhat.com>
3808- */
3809-
3810-#include <config.h>
3811-
3812-#include <string.h>
3813-#include <sys/wait.h>
3814-#include <unistd.h>
3815-
3816-#include <glib.h>
3817-#include <glib/gi18n-lib.h>
3818-
3819-#include "ghalvolumemonitor.h"
3820-#include "ghaldrive.h"
3821-#include "ghalvolume.h"
3822-
3823-struct _GHalDrive {
3824- GObject parent;
3825-
3826- GVolumeMonitor *volume_monitor; /* owned by volume monitor */
3827- GList *volumes; /* entries in list are owned by volume_monitor */
3828-
3829- char *name;
3830- char *icon;
3831- char *device_path;
3832-
3833- gboolean can_eject;
3834- gboolean can_poll_for_media;
3835- gboolean is_media_check_automatic;
3836- gboolean has_media;
3837- gboolean uses_removable_media;
3838-
3839- HalDevice *device;
3840- HalPool *pool;
3841-};
3842-
3843-static void g_hal_drive_drive_iface_init (GDriveIface *iface);
3844-
3845-G_DEFINE_TYPE_EXTENDED (GHalDrive, g_hal_drive, G_TYPE_OBJECT, 0,
3846- G_IMPLEMENT_INTERFACE (G_TYPE_DRIVE,
3847- g_hal_drive_drive_iface_init))
3848-
3849-static void
3850-g_hal_drive_finalize (GObject *object)
3851-{
3852- GList *l;
3853- GHalDrive *drive;
3854-
3855- drive = G_HAL_DRIVE (object);
3856-
3857- for (l = drive->volumes; l != NULL; l = l->next)
3858- {
3859- GHalVolume *volume = l->data;
3860- g_hal_volume_unset_drive (volume, drive);
3861- }
3862-
3863- g_free (drive->device_path);
3864- if (drive->device != NULL)
3865- g_object_unref (drive->device);
3866- if (drive->pool != NULL)
3867- g_object_unref (drive->pool);
3868-
3869- g_free (drive->name);
3870- g_free (drive->icon);
3871-
3872- if (drive->volume_monitor != NULL)
3873- g_object_remove_weak_pointer (G_OBJECT (drive->volume_monitor), (gpointer) &(drive->volume_monitor));
3874-
3875- if (G_OBJECT_CLASS (g_hal_drive_parent_class)->finalize)
3876- (*G_OBJECT_CLASS (g_hal_drive_parent_class)->finalize) (object);
3877-}
3878-
3879-static void
3880-g_hal_drive_class_init (GHalDriveClass *klass)
3881-{
3882- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
3883-
3884- gobject_class->finalize = g_hal_drive_finalize;
3885-}
3886-
3887-static void
3888-g_hal_drive_init (GHalDrive *hal_drive)
3889-{
3890-}
3891-
3892-static char *
3893-_drive_get_description (HalDevice *d)
3894-{
3895- char *s = NULL;
3896- const char *drive_type;
3897- const char *drive_bus;
3898- const char *name_from_hal;
3899-
3900- drive_type = hal_device_get_property_string (d, "storage.drive_type");
3901- drive_bus = hal_device_get_property_string (d, "storage.bus");
3902- name_from_hal = hal_device_get_property_string (d, "info.desktop.name");
3903-
3904-
3905- if (strlen (name_from_hal) > 0)
3906- {
3907- s = g_strdup (name_from_hal);
3908- }
3909- else if (strcmp (drive_type, "cdrom") == 0)
3910- {
3911- const char *first;
3912- const char *second;
3913-
3914- first = _("CD-ROM");
3915- if (hal_device_get_property_bool (d, "storage.cdrom.cdr"))
3916- first = _("CD-R");
3917- if (hal_device_get_property_bool (d, "storage.cdrom.cdrw"))
3918- first = _("CD-RW");
3919-
3920- second = NULL;
3921- if (hal_device_get_property_bool (d, "storage.cdrom.dvd"))
3922- second = _("DVD-ROM");
3923- if (hal_device_get_property_bool (d, "storage.cdrom.dvdplusr"))
3924- second = _("DVD+R");
3925- if (hal_device_get_property_bool (d, "storage.cdrom.dvdplusrw"))
3926- second = _("DVD+RW");
3927- if (hal_device_get_property_bool (d, "storage.cdrom.dvdr"))
3928- second = _("DVD-R");
3929- if (hal_device_get_property_bool (d, "storage.cdrom.dvdrw"))
3930- second = _("DVD-RW");
3931- if (hal_device_get_property_bool (d, "storage.cdrom.dvdram"))
3932- second = _("DVD-RAM");
3933- if ((hal_device_get_property_bool (d, "storage.cdrom.dvdr")) &&
3934- (hal_device_get_property_bool (d, "storage.cdrom.dvdplusr")))
3935- second = _("DVD\xc2\xb1R");
3936- if (hal_device_get_property_bool (d, "storage.cdrom.dvdrw") &&
3937- hal_device_get_property_bool (d, "storage.cdrom.dvdplusrw"))
3938- second = _("DVD\xc2\xb1RW");
3939- if (hal_device_get_property_bool (d, "storage.cdrom.hddvd"))
3940- second = _("HDDVD");
3941- if (hal_device_get_property_bool (d, "storage.cdrom.hddvdr"))
3942- second = _("HDDVD-r");
3943- if (hal_device_get_property_bool (d, "storage.cdrom.hddvdrw"))
3944- second = _("HDDVD-RW");
3945- if (hal_device_get_property_bool (d, "storage.cdrom.bd"))
3946- second = _("Blu-ray");
3947- if (hal_device_get_property_bool (d, "storage.cdrom.bdr"))
3948- second = _("Blu-ray-R");
3949- if (hal_device_get_property_bool (d, "storage.cdrom.bdre"))
3950- second = _("Blu-ray-RE");
3951-
3952- if (second != NULL)
3953- {
3954- /* translators: This wis something like "CD-ROM/DVD Drive" or
3955- "CD-RW/Blue-ray Drive" depending on the properties of the drive */
3956- s = g_strdup_printf (_("%s/%s Drive"), first, second);
3957- }
3958- else
3959- {
3960- /* translators: This wis something like "CD-ROM Drive" or "CD-RW Drive
3961- depending on the properties of the drive */
3962- s = g_strdup_printf (_("%s Drive"), first);
3963- }
3964- }
3965- else if (strcmp (drive_type, "floppy") == 0)
3966- s = g_strdup (_("Floppy Drive"));
3967- else if (strcmp (drive_type, "disk") == 0)
3968- {
3969- if (drive_bus != NULL)
3970- {
3971- if (strcmp (drive_bus, "linux_raid") == 0)
3972- s = g_strdup (_("Software RAID Drive"));
3973- if (strcmp (drive_bus, "usb") == 0)
3974- s = g_strdup (_("USB Drive"));
3975- if (strcmp (drive_bus, "ide") == 0)
3976- s = g_strdup (_("ATA Drive"));
3977- if (strcmp (drive_bus, "scsi") == 0)
3978- s = g_strdup (_("SCSI Drive"));
3979- if (strcmp (drive_bus, "ieee1394") == 0)
3980- s = g_strdup (_("FireWire Drive"));
3981- }
3982- }
3983- else if (strcmp (drive_type, "tape") == 0)
3984- s = g_strdup (_("Tape Drive"));
3985- else if (strcmp (drive_type, "compact_flash") == 0)
3986- s = g_strdup (_("CompactFlash Drive"));
3987- else if (strcmp (drive_type, "memory_stick") == 0)
3988- s = g_strdup (_("MemoryStick Drive"));
3989- else if (strcmp (drive_type, "smart_media") == 0)
3990- s = g_strdup (_("SmartMedia Drive"));
3991- else if (strcmp (drive_type, "sd_mmc") == 0)
3992- s = g_strdup (_("SD/MMC Drive"));
3993- else if (strcmp (drive_type, "zip") == 0)
3994- s = g_strdup (_("Zip Drive"));
3995- else if (strcmp (drive_type, "jaz") == 0)
3996- s = g_strdup (_("Jaz Drive"));
3997- else if (strcmp (drive_type, "flashkey") == 0)
3998- s = g_strdup (_("Thumb Drive"));
3999-
4000- if (s == NULL)
4001- s = g_strdup (_("Mass Storage Drive"));
4002-
4003- return s;
4004-}
4005-
4006-char *
4007-_drive_get_icon (HalDevice *d)
4008-{
4009- char *s = NULL;
4010- const char *drive_type;
4011- const char *drive_bus;
4012- const char *icon_from_hal;
4013- gboolean is_audio_player;
4014-
4015- drive_type = hal_device_get_property_string (d, "storage.drive_type");
4016- drive_bus = hal_device_get_property_string (d, "storage.bus");
4017- is_audio_player = hal_device_has_capability (d, "portable_audio_player");
4018- icon_from_hal = hal_device_get_property_string (d, "storage.icon.drive");
4019-
4020- if (strlen (icon_from_hal) > 0)
4021- s = g_strdup (icon_from_hal);
4022- else if (is_audio_player)
4023- s = g_strdup ("multimedia-player");
4024- else if (strcmp (drive_type, "disk") == 0)
4025- {
4026- if (strcmp (drive_bus, "ide") == 0)
4027- s = g_strdup ("drive-removable-media-ata");
4028- else if (strcmp (drive_bus, "scsi") == 0)
4029- s = g_strdup ("drive-removable-media-scsi");
4030- else if (strcmp (drive_bus, "ieee1394") == 0)
4031- s = g_strdup ("drive-removable-media-ieee1394");
4032- else if (strcmp (drive_bus, "usb") == 0)
4033- s = g_strdup ("drive-removable-media-usb");
4034- else
4035- s = g_strdup ("drive-removable-media");
4036- }
4037- else if (strcmp (drive_type, "cdrom") == 0)
4038- {
4039- /* TODO: maybe there's a better heuristic than this */
4040- if (hal_device_get_property_int (d, "storage.cdrom.write_speed") > 0)
4041- s = g_strdup ("drive-optical-recorder");
4042- else
4043- s = g_strdup ("drive-optical");
4044- }
4045- else if (strcmp (drive_type, "floppy") == 0)
4046- s = g_strdup ("drive-removable-media-floppy");
4047- else if (strcmp (drive_type, "tape") == 0)
4048- s = g_strdup ("drive-removable-media-tape");
4049- else if (strcmp (drive_type, "compact_flash") == 0)
4050- s = g_strdup ("drive-removable-media-flash-cf");
4051- else if (strcmp (drive_type, "memory_stick") == 0)
4052- s = g_strdup ("drive-removable-media-flash-ms");
4053- else if (strcmp (drive_type, "smart_media") == 0)
4054- s = g_strdup ("drive-removable-media-flash-sm");
4055- else if (strcmp (drive_type, "sd_mmc") == 0)
4056- s = g_strdup ("drive-removable-media-flash-sd");
4057-
4058- if (s == NULL)
4059- s = g_strdup ("drive-removable-media");
4060-
4061- return s;
4062-}
4063-
4064-static void
4065-_do_update_from_hal (GHalDrive *d)
4066-{
4067- d->name = _drive_get_description (d->device);
4068- d->icon = _drive_get_icon (d->device);
4069-
4070- d->uses_removable_media = hal_device_get_property_bool (d->device, "storage.removable");
4071- if (d->uses_removable_media)
4072- {
4073- d->has_media = hal_device_get_property_bool (d->device, "storage.removable.media_available");
4074- d->is_media_check_automatic = hal_device_get_property_bool (d->device, "storage.media_check_enabled");
4075- d->can_poll_for_media = hal_device_has_interface (d->device, "org.freedesktop.Hal.Device.Storage.Removable");
4076- d->can_eject = hal_device_get_property_bool (d->device, "storage.requires_eject");
4077- }
4078- else
4079- {
4080- d->has_media = TRUE;
4081- d->is_media_check_automatic = FALSE;
4082- d->can_poll_for_media = FALSE;
4083- d->can_eject = FALSE;
4084- }
4085-}
4086-
4087-static void
4088-emit_drive_changed (GHalDrive *drive)
4089-{
4090- g_signal_emit_by_name (drive, "changed");
4091- if (drive->volume_monitor != NULL)
4092- g_signal_emit_by_name (drive->volume_monitor, "drive_changed", drive);
4093-}
4094-
4095-static void
4096-_update_from_hal (GHalDrive *d, gboolean emit_changed)
4097-{
4098- char *old_name;
4099- char *old_icon;
4100- gboolean old_uses_removable_media;
4101- gboolean old_has_media;
4102- gboolean old_is_media_check_automatic;
4103- gboolean old_can_poll_for_media;
4104- gboolean old_can_eject;
4105-
4106- old_name = g_strdup (d->name);
4107- old_icon = g_strdup (d->icon);
4108- old_uses_removable_media = d->uses_removable_media;
4109- old_has_media = d->has_media;
4110- old_is_media_check_automatic = d->is_media_check_automatic;
4111- old_can_poll_for_media = d->can_poll_for_media;
4112- old_can_eject = d->can_eject;
4113-
4114- g_free (d->name);
4115- g_free (d->icon);
4116- _do_update_from_hal (d);
4117-
4118- if (emit_changed &&
4119- (old_uses_removable_media != d->uses_removable_media ||
4120- old_has_media != d->has_media ||
4121- old_is_media_check_automatic != d->is_media_check_automatic ||
4122- old_can_poll_for_media != d->can_poll_for_media ||
4123- old_can_eject != d->can_eject ||
4124- old_name == NULL ||
4125- old_icon == NULL ||
4126- strcmp (old_name, d->name) != 0 ||
4127- strcmp (old_icon, d->icon) != 0))
4128- emit_drive_changed (d);
4129-
4130- g_free (old_name);
4131- g_free (old_icon);
4132-}
4133-
4134-static void
4135-hal_condition (HalDevice *device, const char *name, const char *detail, gpointer user_data)
4136-{
4137- GHalDrive *hal_drive = G_HAL_DRIVE (user_data);
4138-
4139- if (strcmp (name, "EjectPressed") == 0)
4140- {
4141- g_signal_emit_by_name (hal_drive, "eject-button");
4142- if (hal_drive->volume_monitor != NULL)
4143- g_signal_emit_by_name (hal_drive->volume_monitor, "drive-eject-button", hal_drive);
4144- }
4145-
4146-}
4147-
4148-static void
4149-hal_changed (HalDevice *device, const char *key, gpointer user_data)
4150-{
4151- GHalDrive *hal_drive = G_HAL_DRIVE (user_data);
4152-
4153- /*g_warning ("volhal modifying %s (property %s changed)", hal_drive->device_path, key);*/
4154- _update_from_hal (hal_drive, TRUE);
4155-}
4156-
4157-GHalDrive *
4158-g_hal_drive_new (GVolumeMonitor *volume_monitor,
4159- HalDevice *device,
4160- HalPool *pool)
4161-{
4162- GHalDrive *drive;
4163-
4164- drive = g_object_new (G_TYPE_HAL_DRIVE, NULL);
4165- drive->volume_monitor = volume_monitor;
4166- g_object_add_weak_pointer (G_OBJECT (volume_monitor), (gpointer) &(drive->volume_monitor));
4167- drive->device_path = g_strdup (hal_device_get_property_string (device, "block.device"));
4168- drive->device = g_object_ref (device);
4169- drive->pool = g_object_ref (pool);
4170-
4171- drive->name = g_strdup_printf ("Drive for %s", drive->device_path);
4172- drive->icon = g_strdup_printf ("drive-removable-media");
4173-
4174- g_signal_connect_object (device, "hal_property_changed", (GCallback) hal_changed, drive, 0);
4175- g_signal_connect_object (device, "hal_condition", (GCallback) hal_condition, drive, 0);
4176-
4177- _update_from_hal (drive, FALSE);
4178-
4179- return drive;
4180-}
4181-
4182-void
4183-g_hal_drive_disconnected (GHalDrive *drive)
4184-{
4185- GList *l, *volumes;
4186-
4187- volumes = drive->volumes;
4188- drive->volumes = NULL;
4189-
4190- for (l = volumes; l != NULL; l = l->next)
4191- {
4192- GHalVolume *volume = l->data;
4193- g_hal_volume_unset_drive (volume, drive);
4194- }
4195-
4196- g_list_free (volumes);
4197-}
4198-
4199-void
4200-g_hal_drive_set_volume (GHalDrive *drive,
4201- GHalVolume *volume)
4202-{
4203-
4204- if (g_list_find (drive->volumes, volume) == NULL)
4205- {
4206- drive->volumes = g_list_prepend (drive->volumes, volume);
4207- emit_drive_changed (drive);
4208- }
4209-}
4210-
4211-void
4212-g_hal_drive_unset_volume (GHalDrive *drive,
4213- GHalVolume *volume)
4214-{
4215- GList *l;
4216-
4217- l = g_list_find (drive->volumes, volume);
4218- if (l != NULL)
4219- {
4220- drive->volumes = g_list_delete_link (drive->volumes, l);
4221-
4222- emit_drive_changed (drive);
4223- }
4224-}
4225-
4226-gboolean
4227-g_hal_drive_has_udi (GHalDrive *drive, const char *udi)
4228-{
4229- gboolean res;
4230-
4231- res = strcmp (udi, hal_device_get_udi (drive->device)) == 0;
4232-
4233- return res;
4234-}
4235-
4236-static GIcon *
4237-g_hal_drive_get_icon (GDrive *drive)
4238-{
4239- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4240- GIcon *icon;
4241-
4242- icon = g_themed_icon_new_with_default_fallbacks (hal_drive->icon);
4243-
4244- return icon;
4245-}
4246-
4247-static char *
4248-g_hal_drive_get_name (GDrive *drive)
4249-{
4250- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4251- char *name;
4252-
4253- name = g_strdup (hal_drive->name);
4254-
4255- return name;
4256-}
4257-
4258-static GList *
4259-g_hal_drive_get_volumes (GDrive *drive)
4260-{
4261- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4262- GList *l;
4263-
4264- l = g_list_copy (hal_drive->volumes);
4265- g_list_foreach (l, (GFunc) g_object_ref, NULL);
4266-
4267- return l;
4268-}
4269-
4270-static gboolean
4271-g_hal_drive_has_volumes (GDrive *drive)
4272-{
4273- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4274-
4275- return hal_drive->volumes != NULL;
4276-}
4277-
4278-static gboolean
4279-g_hal_drive_is_media_removable (GDrive *drive)
4280-{
4281- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4282-
4283- return hal_drive->uses_removable_media;
4284-}
4285-
4286-static gboolean
4287-g_hal_drive_has_media (GDrive *drive)
4288-{
4289- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4290-
4291- return hal_drive->has_media;
4292-}
4293-
4294-static gboolean
4295-g_hal_drive_is_media_check_automatic (GDrive *drive)
4296-{
4297- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4298-
4299- return hal_drive->is_media_check_automatic;
4300-}
4301-
4302-static gboolean
4303-g_hal_drive_can_eject (GDrive *drive)
4304-{
4305- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4306-
4307- return hal_drive->can_eject;
4308-}
4309-
4310-static gboolean
4311-g_hal_drive_can_poll_for_media (GDrive *drive)
4312-{
4313- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4314-
4315- return hal_drive->can_poll_for_media;
4316-}
4317-
4318-typedef struct {
4319- GObject *object;
4320- GAsyncReadyCallback callback;
4321- gpointer user_data;
4322- GCancellable *cancellable;
4323-} SpawnOp;
4324-
4325-static void
4326-spawn_cb (GPid pid, gint status, gpointer user_data)
4327-{
4328- SpawnOp *data = user_data;
4329- GSimpleAsyncResult *simple;
4330-
4331-
4332- if (WEXITSTATUS (status) != 0)
4333- {
4334- GError *error;
4335- error = g_error_new_literal (G_IO_ERROR,
4336- G_IO_ERROR_FAILED_HANDLED,
4337- "You are not supposed to show G_IO_ERROR_FAILED_HANDLED in the UI");
4338- simple = g_simple_async_result_new_from_error (data->object,
4339- data->callback,
4340- data->user_data,
4341- error);
4342- g_error_free (error);
4343- }
4344- else
4345- {
4346- simple = g_simple_async_result_new (data->object,
4347- data->callback,
4348- data->user_data,
4349- NULL);
4350- }
4351- g_simple_async_result_complete (simple);
4352- g_object_unref (simple);
4353- g_object_unref (data->object);
4354- g_free (data);
4355-}
4356-
4357-static void
4358-g_hal_drive_eject_do (GDrive *drive,
4359- GCancellable *cancellable,
4360- GAsyncReadyCallback callback,
4361- gpointer user_data)
4362-{
4363- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4364- SpawnOp *data;
4365- GPid child_pid;
4366- GError *error;
4367- char *argv[] = {"gnome-mount", "-e", "-b", "-d", NULL, NULL};
4368-
4369- argv[4] = g_strdup (hal_drive->device_path);
4370-
4371- data = g_new0 (SpawnOp, 1);
4372- data->object = g_object_ref (drive);
4373- data->callback = callback;
4374- data->user_data = user_data;
4375- data->cancellable = cancellable;
4376-
4377- error = NULL;
4378- if (!g_spawn_async (NULL, /* working dir */
4379- argv,
4380- NULL, /* envp */
4381- G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH,
4382- NULL, /* child_setup */
4383- NULL, /* user_data for child_setup */
4384- &child_pid,
4385- &error))
4386- {
4387- GSimpleAsyncResult *simple;
4388-
4389- simple = g_simple_async_result_new_from_error (data->object,
4390- data->callback,
4391- data->user_data,
4392- error);
4393- g_simple_async_result_complete (simple);
4394- g_object_unref (simple);
4395- g_object_unref (drive);
4396- g_error_free (error);
4397- g_free (data);
4398- }
4399- else
4400- g_child_watch_add (child_pid, spawn_cb, data);
4401-
4402- g_free (argv[4]);
4403-}
4404-
4405-
4406-typedef struct {
4407- GDrive *drive;
4408- GAsyncReadyCallback callback;
4409- gpointer user_data;
4410- GMountOperation *mount_operation;
4411- GCancellable *cancellable;
4412- GMountUnmountFlags flags;
4413-
4414- GList *pending_mounts;
4415-} UnmountMountsOp;
4416-
4417-static void
4418-free_unmount_mounts_op (UnmountMountsOp *data)
4419-{
4420- GList *l;
4421-
4422- for (l = data->pending_mounts; l != NULL; l = l->next)
4423- {
4424- GMount *mount = l->data;
4425- g_object_unref (mount);
4426- }
4427- g_list_free (data->pending_mounts);
4428-}
4429-
4430-static void _eject_unmount_mounts (UnmountMountsOp *data);
4431-
4432-static void
4433-_eject_unmount_mounts_cb (GObject *source_object,
4434- GAsyncResult *res,
4435- gpointer user_data)
4436-{
4437- UnmountMountsOp *data = user_data;
4438- GMount *mount = G_MOUNT (source_object);
4439- GSimpleAsyncResult *simple;
4440- GError *error = NULL;
4441-
4442- if (!g_mount_unmount_with_operation_finish (mount, res, &error))
4443- {
4444- /* make the error dialog more targeted to the drive.. unless the user has already seen a dialog */
4445- if (error->code != G_IO_ERROR_FAILED_HANDLED)
4446- {
4447- g_error_free (error);
4448- error = g_error_new (G_IO_ERROR, G_IO_ERROR_BUSY,
4449- _("Failed to eject media; one or more volumes on the media are busy."));
4450- }
4451-
4452- /* unmount failed; need to fail the whole eject operation */
4453- simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
4454- data->callback,
4455- data->user_data,
4456- error);
4457- g_error_free (error);
4458- g_simple_async_result_complete (simple);
4459- g_object_unref (simple);
4460-
4461- free_unmount_mounts_op (data);
4462- }
4463- else
4464- {
4465-
4466- /*g_warning ("successfully unmounted %p", mount);*/
4467-
4468- /* move on to the next mount.. */
4469- _eject_unmount_mounts (data);
4470- }
4471-
4472- g_object_unref (mount);
4473-}
4474-
4475-static void
4476-_eject_unmount_mounts (UnmountMountsOp *data)
4477-{
4478- GMount *mount;
4479-
4480- if (data->pending_mounts == NULL)
4481- {
4482-
4483- /*g_warning ("all pending mounts done; ejecting drive");*/
4484-
4485- g_hal_drive_eject_do (data->drive,
4486- data->cancellable,
4487- data->callback,
4488- data->user_data);
4489-
4490- g_object_unref (data->drive);
4491- g_free (data);
4492- }
4493- else
4494- {
4495- mount = data->pending_mounts->data;
4496- data->pending_mounts = g_list_remove (data->pending_mounts, mount);
4497-
4498- /*g_warning ("unmounting %p", mount);*/
4499-
4500- g_mount_unmount_with_operation (mount,
4501- data->flags,
4502- data->mount_operation,
4503- data->cancellable,
4504- _eject_unmount_mounts_cb,
4505- data);
4506- }
4507-}
4508-
4509-static void
4510-g_hal_drive_eject_with_operation (GDrive *drive,
4511- GMountUnmountFlags flags,
4512- GMountOperation *mount_operation,
4513- GCancellable *cancellable,
4514- GAsyncReadyCallback callback,
4515- gpointer user_data)
4516-{
4517- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4518- UnmountMountsOp *data;
4519- GList *l;
4520-
4521- /* first we need to go through all the volumes and unmount their assoicated mounts (if any) */
4522-
4523- data = g_new0 (UnmountMountsOp, 1);
4524- data->drive = g_object_ref (drive);
4525- data->mount_operation = mount_operation;
4526- data->cancellable = cancellable;
4527- data->callback = callback;
4528- data->user_data = user_data;
4529- data->flags = flags;
4530-
4531- for (l = hal_drive->volumes; l != NULL; l = l->next)
4532- {
4533- GHalVolume *volume = l->data;
4534- GMount *mount; /* the mount may be foreign; cannot assume GHalMount */
4535-
4536- mount = g_volume_get_mount (G_VOLUME (volume));
4537- if (mount != NULL && g_mount_can_unmount (mount))
4538- data->pending_mounts = g_list_prepend (data->pending_mounts, g_object_ref (mount));
4539- }
4540-
4541- _eject_unmount_mounts (data);
4542-}
4543-
4544-static gboolean
4545-g_hal_drive_eject_with_operation_finish (GDrive *drive,
4546- GAsyncResult *result,
4547- GError **error)
4548-{
4549- return TRUE;
4550-}
4551-
4552-static void
4553-g_hal_drive_eject (GDrive *drive,
4554- GMountUnmountFlags flags,
4555- GCancellable *cancellable,
4556- GAsyncReadyCallback callback,
4557- gpointer user_data)
4558-{
4559- g_hal_drive_eject (drive, flags, cancellable, callback, user_data);
4560-}
4561-
4562-static gboolean
4563-g_hal_drive_eject_finish (GDrive *drive,
4564- GAsyncResult *result,
4565- GError **error)
4566-{
4567- return g_hal_drive_eject_with_operation_finish (drive, result, error);
4568-}
4569-
4570-typedef struct {
4571- GObject *object;
4572- GAsyncReadyCallback callback;
4573- gpointer user_data;
4574- GCancellable *cancellable;
4575-} PollOp;
4576-
4577-static void
4578-poll_for_media_cb (DBusPendingCall *pending_call, void *user_data)
4579-{
4580- PollOp *data = (PollOp *) user_data;
4581- GSimpleAsyncResult *simple;
4582- DBusMessage *reply;
4583-
4584- reply = dbus_pending_call_steal_reply (pending_call);
4585-
4586- if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
4587- {
4588- GError *error;
4589- DBusError dbus_error;
4590-
4591- dbus_error_init (&dbus_error);
4592- dbus_set_error_from_message (&dbus_error, reply);
4593- error = g_error_new (G_IO_ERROR,
4594- G_IO_ERROR_FAILED,
4595- "Cannot invoke CheckForMedia on HAL: %s: %s", dbus_error.name, dbus_error.message);
4596- simple = g_simple_async_result_new_from_error (data->object,
4597- data->callback,
4598- data->user_data,
4599- error);
4600- g_simple_async_result_complete (simple);
4601- g_object_unref (simple);
4602- g_error_free (error);
4603- dbus_error_free (&dbus_error);
4604- goto out;
4605- }
4606-
4607- /* TODO: parse reply and extract result?
4608- * (the result is whether the media availability state changed)
4609- */
4610-
4611- simple = g_simple_async_result_new (data->object,
4612- data->callback,
4613- data->user_data,
4614- NULL);
4615- g_simple_async_result_complete (simple);
4616- g_object_unref (simple);
4617-
4618- out:
4619- g_object_unref (data->object);
4620- dbus_message_unref (reply);
4621- dbus_pending_call_unref (pending_call);
4622-}
4623-
4624-
4625-static void
4626-g_hal_drive_poll_for_media (GDrive *drive,
4627- GCancellable *cancellable,
4628- GAsyncReadyCallback callback,
4629- gpointer user_data)
4630-{
4631- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4632- DBusConnection *con;
4633- DBusMessage *msg;
4634- DBusPendingCall *pending_call;
4635- PollOp *data;
4636-
4637- data = g_new0 (PollOp, 1);
4638- data->object = g_object_ref (drive);
4639- data->callback = callback;
4640- data->user_data = user_data;
4641- data->cancellable = cancellable;
4642-
4643- /*g_warning ("Rescanning udi %s", hal_device_get_udi (hal_drive->device));*/
4644-
4645- con = hal_pool_get_dbus_connection (hal_drive->pool);
4646- msg = dbus_message_new_method_call ("org.freedesktop.Hal",
4647- hal_device_get_udi (hal_drive->device),
4648- "org.freedesktop.Hal.Device.Storage.Removable",
4649- "CheckForMedia");
4650-
4651- if (!dbus_connection_send_with_reply (con, msg, &pending_call, -1))
4652- {
4653- GError *error;
4654- GSimpleAsyncResult *simple;
4655- error = g_error_new_literal (G_IO_ERROR,
4656- G_IO_ERROR_FAILED,
4657- "Cannot invoke CheckForMedia on HAL");
4658- simple = g_simple_async_result_new_from_error (data->object,
4659- data->callback,
4660- data->user_data,
4661- error);
4662- g_simple_async_result_complete (simple);
4663- g_object_unref (simple);
4664- g_error_free (error);
4665- g_object_unref (data->object);
4666- g_free (data);
4667- }
4668- else
4669- dbus_pending_call_set_notify (pending_call,
4670- poll_for_media_cb,
4671- data,
4672- (DBusFreeFunction) g_free);
4673-
4674- dbus_message_unref (msg);
4675-}
4676-
4677-static gboolean
4678-g_hal_drive_poll_for_media_finish (GDrive *drive,
4679- GAsyncResult *result,
4680- GError **error)
4681-{
4682- /*g_warning ("poll finish");*/
4683- return TRUE;
4684-}
4685-
4686-static char *
4687-g_hal_drive_get_identifier (GDrive *drive,
4688- const char *kind)
4689-{
4690- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4691- char *res;
4692-
4693- res = NULL;
4694-
4695- if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_HAL_UDI) == 0)
4696- res = g_strdup (hal_device_get_udi (hal_drive->device));
4697-
4698- if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
4699- res = g_strdup (hal_drive->device_path);
4700-
4701- return res;
4702-}
4703-
4704-static char **
4705-g_hal_drive_enumerate_identifiers (GDrive *drive)
4706-{
4707- GHalDrive *hal_drive = G_HAL_DRIVE (drive);
4708- GPtrArray *res;
4709-
4710- res = g_ptr_array_new ();
4711-
4712- g_ptr_array_add (res,
4713- g_strdup (G_VOLUME_IDENTIFIER_KIND_HAL_UDI));
4714-
4715- if (hal_drive->device_path && *hal_drive->device_path != 0)
4716- g_ptr_array_add (res,
4717- g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
4718-
4719-
4720- /* Null-terminate */
4721- g_ptr_array_add (res, NULL);
4722-
4723- return (char **)g_ptr_array_free (res, FALSE);
4724-}
4725-
4726-static void
4727-g_hal_drive_drive_iface_init (GDriveIface *iface)
4728-{
4729- iface->get_name = g_hal_drive_get_name;
4730- iface->get_icon = g_hal_drive_get_icon;
4731- iface->has_volumes = g_hal_drive_has_volumes;
4732- iface->get_volumes = g_hal_drive_get_volumes;
4733- iface->is_media_removable = g_hal_drive_is_media_removable;
4734- iface->has_media = g_hal_drive_has_media;
4735- iface->is_media_check_automatic = g_hal_drive_is_media_check_automatic;
4736- iface->can_eject = g_hal_drive_can_eject;
4737- iface->can_poll_for_media = g_hal_drive_can_poll_for_media;
4738- iface->eject = g_hal_drive_eject;
4739- iface->eject_finish = g_hal_drive_eject_finish;
4740- iface->eject_with_operation = g_hal_drive_eject_with_operation;
4741- iface->eject_with_operation_finish = g_hal_drive_eject_with_operation_finish;
4742- iface->poll_for_media = g_hal_drive_poll_for_media;
4743- iface->poll_for_media_finish = g_hal_drive_poll_for_media_finish;
4744- iface->get_identifier = g_hal_drive_get_identifier;
4745- iface->enumerate_identifiers = g_hal_drive_enumerate_identifiers;
4746-}
4747
4748=== removed file '.pc/03_xdg-mount.patch/monitor/hal/ghalmount.c'
4749--- .pc/03_xdg-mount.patch/monitor/hal/ghalmount.c 2011-11-17 07:43:33 +0000
4750+++ .pc/03_xdg-mount.patch/monitor/hal/ghalmount.c 1970-01-01 00:00:00 +0000
4751@@ -1,1192 +0,0 @@
4752-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
4753-/* GIO - GLib Input, Output and Streaming Library
4754- *
4755- * Copyright (C) 2006-2007 Red Hat, Inc.
4756- *
4757- * This library is free software; you can redistribute it and/or
4758- * modify it under the terms of the GNU Lesser General Public
4759- * License as published by the Free Software Foundation; either
4760- * version 2 of the License, or (at your option) any later version.
4761- *
4762- * This library is distributed in the hope that it will be useful,
4763- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4764- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4765- * Lesser General Public License for more details.
4766- *
4767- * You should have received a copy of the GNU Lesser General
4768- * Public License along with this library; if not, write to the
4769- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
4770- * Boston, MA 02111-1307, USA.
4771- *
4772- * Author: David Zeuthen <davidz@redhat.com>
4773- */
4774-
4775-#include <config.h>
4776-
4777-#include <string.h>
4778-#include <sys/wait.h>
4779-#include <unistd.h>
4780-
4781-#include <glib.h>
4782-#include <glib/gi18n-lib.h>
4783-#include <gio/gio.h>
4784-
4785-#include <gvfsmountinfo.h>
4786-
4787-#include "ghalvolumemonitor.h"
4788-#include "ghalmount.h"
4789-#include "ghalvolume.h"
4790-
4791-#include "hal-utils.h"
4792-
4793-struct _GHalMount {
4794- GObject parent;
4795-
4796- GVolumeMonitor *volume_monitor; /* owned by volume monitor */
4797- GHalVolume *volume; /* owned by volume monitor */
4798-
4799- char *name;
4800- GIcon *icon;
4801- char *device_path;
4802- char *mount_path;
4803-
4804- char *uuid;
4805-
4806- char *override_name;
4807- GIcon *override_icon;
4808- GFile *override_root;
4809- gboolean cannot_unmount;
4810-
4811- HalDevice *device;
4812- HalDevice *drive_device;
4813-
4814- GIcon *autorun_icon;
4815- gboolean searched_for_autorun;
4816-
4817- gchar *xdg_volume_info_name;
4818- GIcon *xdg_volume_info_icon;
4819- gboolean searched_for_xdg_volume_info;
4820-};
4821-
4822-static GFile *get_root (GHalMount *hal_mount);
4823-
4824-static void update_from_hal (GHalMount *m, gboolean emit_changed);
4825-
4826-static void g_hal_mount_mount_iface_init (GMountIface *iface);
4827-
4828-G_DEFINE_TYPE_EXTENDED (GHalMount, g_hal_mount, G_TYPE_OBJECT, 0,
4829- G_IMPLEMENT_INTERFACE (G_TYPE_MOUNT,
4830- g_hal_mount_mount_iface_init))
4831-
4832-static void
4833-g_hal_mount_finalize (GObject *object)
4834-{
4835- GHalMount *mount;
4836-
4837- mount = G_HAL_MOUNT (object);
4838-
4839- if (mount->volume != NULL)
4840- g_hal_volume_unset_mount (mount->volume, mount);
4841-
4842- g_free (mount->device_path);
4843- g_free (mount->mount_path);
4844- g_free (mount->uuid);
4845-
4846- if (mount->device != NULL)
4847- g_object_unref (mount->device);
4848- if (mount->drive_device != NULL)
4849- g_object_unref (mount->drive_device);
4850-
4851- g_free (mount->name);
4852- if (mount->icon != NULL)
4853- g_object_unref (mount->icon);
4854-
4855- g_free (mount->override_name);
4856- if (mount->override_icon != NULL)
4857- g_object_unref (mount->override_icon);
4858-
4859- if (mount->override_root != NULL)
4860- g_object_unref (mount->override_root);
4861-
4862- if (mount->autorun_icon != NULL)
4863- g_object_unref (mount->autorun_icon);
4864-
4865- g_free (mount->xdg_volume_info_name);
4866- if (mount->xdg_volume_info_icon != NULL)
4867- g_object_unref (mount->xdg_volume_info_icon);
4868-
4869- if (mount->volume_monitor != NULL)
4870- g_object_remove_weak_pointer (G_OBJECT (mount->volume_monitor), (gpointer) &(mount->volume_monitor));
4871-
4872- if (G_OBJECT_CLASS (g_hal_mount_parent_class)->finalize)
4873- (*G_OBJECT_CLASS (g_hal_mount_parent_class)->finalize) (object);
4874-}
4875-
4876-static void
4877-g_hal_mount_class_init (GHalMountClass *klass)
4878-{
4879- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
4880-
4881- gobject_class->finalize = g_hal_mount_finalize;
4882-}
4883-
4884-static void
4885-g_hal_mount_init (GHalMount *hal_mount)
4886-{
4887-}
4888-
4889-static void
4890-emit_mount_changed (GHalMount *mount)
4891-{
4892- g_signal_emit_by_name (mount, "changed");
4893- if (mount->volume_monitor != NULL)
4894- g_signal_emit_by_name (mount->volume_monitor, "mount_changed", mount);
4895-}
4896-
4897-#define KILOBYTE_FACTOR 1000.0
4898-#define MEGABYTE_FACTOR (1000.0 * 1000.0)
4899-#define GIGABYTE_FACTOR (1000.0 * 1000.0 * 1000.0)
4900-
4901-static char *
4902-format_size_for_display (guint64 size)
4903-{
4904- char *str;
4905- gdouble displayed_size;
4906-
4907- if (size < MEGABYTE_FACTOR)
4908- {
4909- displayed_size = (double) size / KILOBYTE_FACTOR;
4910- str = g_strdup_printf (_("%.1f kB"), displayed_size);
4911- }
4912- else if (size < GIGABYTE_FACTOR)
4913- {
4914- displayed_size = (double) size / MEGABYTE_FACTOR;
4915- str = g_strdup_printf (_("%.1f MB"), displayed_size);
4916- }
4917- else
4918- {
4919- displayed_size = (double) size / GIGABYTE_FACTOR;
4920- str = g_strdup_printf (_("%.1f GB"), displayed_size);
4921- }
4922-
4923- return str;
4924-}
4925-
4926-static void
4927-got_autorun_info_cb (GObject *source_object,
4928- GAsyncResult *res,
4929- gpointer user_data)
4930-{
4931- GHalMount *mount = G_HAL_MOUNT (user_data);
4932-
4933- mount->autorun_icon = g_vfs_mount_info_query_autorun_info_finish (G_FILE (source_object),
4934- res,
4935- NULL);
4936-
4937- update_from_hal (mount, TRUE);
4938-
4939- g_object_unref (mount);
4940-}
4941-
4942-static void
4943-got_xdg_volume_info_cb (GObject *source_object,
4944- GAsyncResult *res,
4945- gpointer user_data)
4946-{
4947- GHalMount *mount = G_HAL_MOUNT (user_data);
4948-
4949- mount->xdg_volume_info_icon = g_vfs_mount_info_query_xdg_volume_info_finish (G_FILE (source_object),
4950- res,
4951- &(mount->xdg_volume_info_name),
4952- NULL);
4953- update_from_hal (mount, TRUE);
4954-
4955- g_object_unref (mount);
4956-}
4957-
4958-static void
4959-do_update_from_hal (GHalMount *m)
4960-{
4961- HalDevice *volume;
4962- HalDevice *drive;
4963- char *name;
4964- const char *icon_name;
4965- const char *icon_name_fallback;
4966- const char *drive_type;
4967- const char *drive_bus;
4968- gboolean drive_uses_removable_media;
4969- const char *volume_fs_label;
4970- guint64 volume_size;
4971- gboolean volume_is_disc;
4972- gboolean volume_disc_has_audio;
4973- gboolean volume_disc_has_data;
4974- const char *volume_disc_type;
4975- gboolean volume_disc_is_blank;
4976- gboolean is_audio_player;
4977- const char *icon_from_hal;
4978- const char *volume_icon_from_hal;
4979- const char *name_from_hal;
4980- const char *volume_name_from_hal;
4981- gboolean is_crypto;
4982- gboolean is_crypto_cleartext;
4983-
4984- volume = m->device;
4985- drive = m->drive_device;
4986-
4987- drive_type = hal_device_get_property_string (drive, "storage.drive_type");
4988- drive_bus = hal_device_get_property_string (drive, "storage.bus");
4989- drive_uses_removable_media = hal_device_get_property_bool (drive, "storage.removable");
4990- volume_fs_label = hal_device_get_property_string (volume, "volume.label");
4991- volume_size = hal_device_get_property_uint64 (volume, "volume.size");
4992- volume_is_disc = hal_device_get_property_bool (volume, "volume.is_disc");
4993- volume_disc_has_audio = hal_device_get_property_bool (volume, "volume.disc.has_audio");
4994- volume_disc_has_data = hal_device_get_property_bool (volume, "volume.disc.has_data");
4995- volume_disc_is_blank = hal_device_get_property_bool (volume, "volume.disc.is_blank");
4996- volume_disc_type = hal_device_get_property_string (volume, "volume.disc.type");
4997- is_audio_player = hal_device_has_capability (drive, "portable_audio_player");
4998- icon_from_hal = hal_device_get_property_string (drive, "storage.icon.drive");
4999- volume_icon_from_hal = hal_device_get_property_string (volume, "storage.icon.volume");
5000- name_from_hal = hal_device_get_property_string (drive, "info.desktop.name");
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: