diff options
author | Eric Koegel <eric.koegel@gmail.com> | 2013-10-15 19:25:30 +0300 |
---|---|---|
committer | Eric Koegel <eric.koegel@gmail.com> | 2013-10-19 21:23:17 +0300 |
commit | c460b0acb86791eb7ee9d954fae505589b88a68a (patch) | |
tree | ed00a16f9187ac68e25f9210d0d1ee6aeb974f4a /src/xfdesktop-file-utils.c | |
parent | 7fd36c23d7e72cec2721c5324b63ca1e57dd2fef (diff) | |
download | xfdesktop-c460b0acb86791eb7ee9d954fae505589b88a68a.tar.gz |
More removable device icon types (Bug 4056)
In xfdesktop-settings the removable devices option now has an
expander allowing the user to show network shares, devices, or
unknown/other volumes (such as mtp devices).
Diffstat (limited to 'src/xfdesktop-file-utils.c')
-rw-r--r-- | src/xfdesktop-file-utils.c | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c index 44feba14..4f53c574 100644 --- a/src/xfdesktop-file-utils.c +++ b/src/xfdesktop-file-utils.c @@ -237,137 +237,6 @@ xfdesktop_file_utils_get_display_name(GFile *file, return display_name; } -gboolean -xfdesktop_file_utils_volume_is_present(GVolume *volume) -{ - gboolean has_media = FALSE; - gboolean is_shadowed = FALSE; - GDrive *drive; -#if GLIB_CHECK_VERSION (2, 20, 0) - GMount *mount; -#endif - - g_return_val_if_fail(G_IS_VOLUME(volume), FALSE); - - drive = g_volume_get_drive (volume); - if(drive) { - has_media = g_drive_has_media(drive); - g_object_unref(drive); - } - -#if GLIB_CHECK_VERSION (2, 20, 0) - mount = g_volume_get_mount(volume); - if(mount) { - is_shadowed = g_mount_is_shadowed(mount); - g_object_unref(mount); - } -#endif - - return has_media && !is_shadowed; -} - -#ifdef HAVE_GIO_UNIX -static gboolean -xfdesktop_file_utils_mount_is_internal (GMount *mount) -{ - const gchar *point_mount_path; - gboolean is_internal = FALSE; - GFile *root; - GList *lp; - GList *mount_points; - gchar *mount_path; - - g_return_val_if_fail(G_IS_MOUNT(mount), FALSE); - - /* determine the mount path */ - root = g_mount_get_root(mount); - mount_path = g_file_get_path(root); - g_object_unref(root); - - /* assume non-internal if we cannot determine the path */ - if (!mount_path) - return FALSE; - - if (g_unix_is_mount_path_system_internal(mount_path)) { - /* mark as internal */ - is_internal = TRUE; - } else { - /* get a list of all mount points */ - mount_points = g_unix_mount_points_get(NULL); - - /* search for the mount point associated with the mount entry */ - for (lp = mount_points; !is_internal && lp != NULL; lp = lp->next) { - point_mount_path = g_unix_mount_point_get_mount_path(lp->data); - - /* check if this is the mount point we are looking for */ - if (g_strcmp0(mount_path, point_mount_path) == 0) { - /* mark as internal if the user cannot mount this device */ - if (!g_unix_mount_point_is_user_mountable(lp->data)) - is_internal = TRUE; - } - - /* free the mount point, we no longer need it */ - g_unix_mount_point_free(lp->data); - } - - /* free the mount point list */ - g_list_free(mount_points); - } - - g_free(mount_path); - - return is_internal; -} -#endif - - - -gboolean -xfdesktop_file_utils_volume_is_removable(GVolume *volume) -{ - gboolean can_eject; - gboolean can_mount = FALSE; - gboolean can_unmount = FALSE; - gboolean is_removable = FALSE; - gboolean is_internal = FALSE; - GDrive *drive; - GMount *mount; - - g_return_val_if_fail(G_IS_VOLUME(volume), FALSE); - - /* check if the volume can be ejected */ - can_eject = g_volume_can_eject(volume); - - /* determine the drive for the volume */ - drive = g_volume_get_drive(volume); - if(drive) { - /*check if the drive media can be removed */ - is_removable = g_drive_is_media_removable(drive); - - /* release the drive */ - g_object_unref(drive); - } - - /* determine the mount for the volume (if it is mounted at all) */ - mount = g_volume_get_mount(volume); - if(mount) { -#ifdef HAVE_GIO_UNIX - is_internal = xfdesktop_file_utils_mount_is_internal (mount); -#endif - - /* check if the volume can be unmounted */ - can_unmount = g_mount_can_unmount(mount); - - /* release the mount */ - g_object_unref(mount); - } - - /* determine whether the device can be mounted */ - can_mount = g_volume_can_mount(volume); - - return (!is_internal) && (can_eject || can_unmount || is_removable || can_mount); -} - GList * xfdesktop_file_utils_file_icon_list_to_file_list(GList *icon_list) { |