Add g_unix_mount_guess_should_display and use for unix volume monitor

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


svn path=/trunk/; revision=6285
This commit is contained in:
Alexander Larsson 2008-01-09 15:45:56 +00:00 committed by Alexander Larsson
parent 47b8809e17
commit 896ebed1a5
5 changed files with 48 additions and 1 deletions

View File

@ -1,3 +1,14 @@
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
2008-01-09 Alexander Larsson <alexl@redhat.com>
* gio.symbols:

View File

@ -628,6 +628,7 @@ g_unix_mount_get_fs_type
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

View File

@ -108,7 +108,7 @@ _g_unix_mount_new (GVolumeMonitor *volume_monitor,
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);

View File

@ -1830,6 +1830,40 @@ g_unix_mount_guess_can_eject (GUnixMountEntry *mount_entry)
return FALSE;
}
/**
* 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

View File

@ -67,6 +67,7 @@ const char * g_unix_mount_get_fs_type (GUnixMountEntry *mount_e
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);