glib r6285 - trunk/gio
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6285 - trunk/gio
- Date: Wed, 9 Jan 2008 15:45:56 +0000 (GMT)
Author: alexl
Date: Wed Jan 9 15:45:56 2008
New Revision: 6285
URL: http://svn.gnome.org/viewvc/glib?rev=6285&view=rev
Log:
2008-01-09 Alexander Larsson <alexl redhat com>
* gio.symbols:
* gunixmount.c:
* gunixmounts.[ch]:
Add g_unix_mount_guess_should_display and use
for unix volume monitor backend.
This means we more or less show what the
gnome-vfs backend did.
Based on patch from Padraig O'Briain
Modified:
trunk/gio/ChangeLog
trunk/gio/gio.symbols
trunk/gio/gunixmount.c
trunk/gio/gunixmounts.c
trunk/gio/gunixmounts.h
Modified: trunk/gio/gio.symbols
==============================================================================
--- trunk/gio/gio.symbols (original)
+++ trunk/gio/gio.symbols Wed Jan 9 15:45:56 2008
@@ -628,6 +628,7 @@
g_unix_mount_is_readonly
g_unix_mount_is_system_internal
g_unix_mount_guess_can_eject
+g_unix_mount_guess_should_display
g_unix_mount_guess_name
g_unix_mount_guess_icon
g_unix_mount_point_compare
Modified: trunk/gio/gunixmount.c
==============================================================================
--- trunk/gio/gunixmount.c (original)
+++ trunk/gio/gunixmount.c Wed Jan 9 15:45:56 2008
@@ -108,7 +108,7 @@
GUnixMount *mount;
/* No volume for mount: Ignore internal things */
- if (volume == NULL && g_unix_mount_is_system_internal (mount_entry))
+ if (volume == NULL && !g_unix_mount_guess_should_display (mount_entry))
return NULL;
mount = g_object_new (G_TYPE_UNIX_MOUNT, NULL);
Modified: trunk/gio/gunixmounts.c
==============================================================================
--- trunk/gio/gunixmounts.c (original)
+++ trunk/gio/gunixmounts.c Wed Jan 9 15:45:56 2008
@@ -1831,6 +1831,40 @@
}
/**
+ * g_unix_mount_guess_should_display:
+ * @mount_entry: a #GUnixMountEntry
+ *
+ * Guesses whether a Unix mount should be displayed in the UI.
+ *
+ * Returns: %TRUE if @mount_entry is deemed to be displayable.
+ */
+gboolean
+g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
+{
+ GUnixMountType guessed_type;
+
+ /* Never display internal mountpoints */
+ if (g_unix_mount_is_system_internal (mount_entry))
+ return FALSE;
+
+ /* Only display things that look "removable" or
+ things in /media (which are generally user mountable) */
+ guessed_type = g_unix_mount_guess_type (mount_entry);
+ if (guessed_type == G_UNIX_MOUNT_TYPE_IPOD ||
+ guessed_type == G_UNIX_MOUNT_TYPE_CDROM ||
+ guessed_type == G_UNIX_MOUNT_TYPE_FLOPPY ||
+ guessed_type == G_UNIX_MOUNT_TYPE_ZIP ||
+ guessed_type == G_UNIX_MOUNT_TYPE_JAZ ||
+ guessed_type == G_UNIX_MOUNT_TYPE_CAMERA ||
+ guessed_type == G_UNIX_MOUNT_TYPE_MEMSTICK ||
+ (mount_entry->mount_path != NULL &&
+ g_str_has_prefix (mount_entry->mount_path, "/media")))
+ return TRUE;
+
+ return FALSE;
+}
+
+/**
* g_unix_mount_point_guess_can_eject:
* @mount_point: a #GUnixMountPoint
*
Modified: trunk/gio/gunixmounts.h
==============================================================================
--- trunk/gio/gunixmounts.h (original)
+++ trunk/gio/gunixmounts.h Wed Jan 9 15:45:56 2008
@@ -67,6 +67,7 @@
gboolean g_unix_mount_is_readonly (GUnixMountEntry *mount_entry);
gboolean g_unix_mount_is_system_internal (GUnixMountEntry *mount_entry);
gboolean g_unix_mount_guess_can_eject (GUnixMountEntry *mount_entry);
+gboolean g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry);
char * g_unix_mount_guess_name (GUnixMountEntry *mount_entry);
GIcon * g_unix_mount_guess_icon (GUnixMountEntry *mount_entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]