mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 10:16:17 +01:00
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:
parent
47b8809e17
commit
896ebed1a5
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user