From 61411a5fc2388639ae8e05f1b984fa4f2bebe4b5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 8 Feb 2008 16:12:55 +0000 Subject: [PATCH] Add g_volume_should_automount. Docs needed. 2008-02-08 Alexander Larsson * gio.symbols: * gunixvolume.c: * gvolume.[ch]: Add g_volume_should_automount. Docs needed. svn path=/trunk/; revision=6484 --- gio/ChangeLog | 8 ++++++++ gio/gio.symbols | 1 + gio/gunixvolume.c | 10 +++++++++- gio/gvolume.c | 16 ++++++++++++++++ gio/gvolume.h | 4 ++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 6eaa960fc..97f83b494 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,11 @@ +2008-02-08 Alexander Larsson + + * gio.symbols: + * gunixvolume.c: + * gvolume.[ch]: + Add g_volume_should_automount. + Docs needed. + 2008-02-07 Tor Lillqvist * tests/Makefile.am (TEST_PROGS): live-g-file won't build on diff --git a/gio/gio.symbols b/gio/gio.symbols index 482844989..fec2c1024 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -713,6 +713,7 @@ g_volume_get_icon g_volume_get_uuid g_volume_get_drive g_volume_get_mount +g_volume_should_automount g_volume_can_mount g_volume_can_eject g_volume_mount diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c index 6b126255c..0b9f16a69 100644 --- a/gio/gunixvolume.c +++ b/gio/gunixvolume.c @@ -244,6 +244,14 @@ g_unix_volume_can_eject (GVolume *volume) return unix_volume->can_eject; } +static gboolean +g_unix_volume_should_automount (GVolume *volume) +{ + /* We automount all local volumes because we don't even + make the internal stuff visible */ + return TRUE; +} + static GDrive * g_unix_volume_get_drive (GVolume *volume) { @@ -462,7 +470,6 @@ g_unix_volume_enumerate_identifiers (GVolume *volume) return res; } - static void g_unix_volume_volume_iface_init (GVolumeIface *iface) { @@ -473,6 +480,7 @@ g_unix_volume_volume_iface_init (GVolumeIface *iface) iface->get_mount = g_unix_volume_get_mount; iface->can_mount = g_unix_volume_can_mount; iface->can_eject = g_unix_volume_can_eject; + iface->should_automount = g_unix_volume_should_automount; iface->mount_fn = g_unix_volume_mount; iface->mount_finish = g_unix_volume_mount_finish; iface->eject = g_unix_volume_eject; diff --git a/gio/gvolume.c b/gio/gvolume.c index 9eb0703b6..28bf63520 100644 --- a/gio/gvolume.c +++ b/gio/gvolume.c @@ -288,6 +288,22 @@ g_volume_can_eject (GVolume *volume) return (* iface->can_eject) (volume); } +gboolean +g_volume_should_automount (GVolume *volume) +{ + GVolumeIface *iface; + + g_return_val_if_fail (G_IS_VOLUME (volume), FALSE); + + iface = G_VOLUME_GET_IFACE (volume); + + if (iface->should_automount == NULL) + return FALSE; + + return (* iface->should_automount) (volume); +} + + /** * g_volume_mount: * @volume: a #GVolume. diff --git a/gio/gvolume.h b/gio/gvolume.h index 656a24255..c5b8c564d 100644 --- a/gio/gvolume.h +++ b/gio/gvolume.h @@ -109,6 +109,9 @@ struct _GVolumeIface char * (*get_identifier) (GVolume *volume, const char *kind); char ** (*enumerate_identifiers) (GVolume *volume); + + gboolean (*should_automount) (GVolume *volume); + }; GType g_volume_get_type (void) G_GNUC_CONST; @@ -120,6 +123,7 @@ GDrive * g_volume_get_drive (GVolume *volume); GMount * g_volume_get_mount (GVolume *volume); gboolean g_volume_can_mount (GVolume *volume); gboolean g_volume_can_eject (GVolume *volume); +gboolean g_volume_should_automount (GVolume *volume); void g_volume_mount (GVolume *volume, GMountOperation *mount_operation, GCancellable *cancellable,