Commit c6eb1882 authored by Andrea Azzarone's avatar Andrea Azzarone 🚴 Committed by Kai Lüke

Hide devices if mounted with x-gdu.hide

Check inside should_include_block if a block has been mounted with
the x-gdu.hide option. This allows to hide e.g. snap squashfs from
gnome-disk-utility.

https://bugzilla.gnome.org/show_bug.cgi?id=790279
parent 1dabb1c3
......@@ -98,6 +98,10 @@ udisks2_7_2_dep = dependency('udisks2', version: '>= 2.7.2', required: false)
config_h.set('HAVE_UDISKS2_7_2', udisks2_7_2_dep.found(),
description: 'Define to 1 if UDisks version >= 2.7.2 for resize, repair, check')
udisks2_7_6_dep = dependency('udisks2', version: '>= 2.7.6', required: false)
config_h.set('HAVE_UDISKS2_7_6', udisks2_7_6_dep.found(),
description: 'Define to 1 if UDisks version >= 2.7.6 for userspace mount options')
# *** Check for libsystemd ***
enable_libsystemd = get_option('libsystemd')
if enable_libsystemd
......
......@@ -1196,6 +1196,9 @@ should_include_block (UDisksObject *object)
partition = udisks_object_peek_partition (object);
loop = udisks_object_peek_loop (object);
if (gdu_utils_has_userspace_mount_option (block, "x-gdu.hide"))
goto out;
/* RAM devices are useless */
device = udisks_block_get_device (block);
if (g_str_has_prefix (device, "/dev/ram"))
......
......@@ -63,6 +63,26 @@ gdu_utils_has_configuration (UDisksBlock *block,
return ret;
}
gboolean
gdu_utils_has_userspace_mount_option (UDisksBlock *block,
const gchar *option)
{
#ifdef HAVE_UDISKS2_7_6
const gchar *const *options;
gboolean ret;
ret = FALSE;
options = udisks_block_get_userspace_mount_options (block);
if (options != NULL)
ret = g_strv_contains (options, option);
return ret;
#else
return FALSE;
#endif
}
void
gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser,
gboolean set_file_types,
......
......@@ -18,6 +18,9 @@ gboolean gdu_utils_has_configuration (UDisksBlock *block,
const gchar *type,
gboolean *out_has_passphrase);
gboolean gdu_utils_has_userspace_mount_option (UDisksBlock *block,
const gchar *option);
void gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser,
gboolean set_file_types,
gboolean allow_compressed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment