[gnome-disk-utility/gnome-3-26] Show mount options for swap volumes
- From: Kai Lüke <kailueke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/gnome-3-26] Show mount options for swap volumes
- Date: Fri, 29 Sep 2017 07:56:50 +0000 (UTC)
commit 01a4701c93d92b5efd75de39ab7bd9533f97f670
Author: Kai Lüke <kailueke riseup net>
Date: Tue Aug 1 16:24:13 2017 +0100
Show mount options for swap volumes
The mount option dialog for editing /etc/fstab was
only shown for swap volumes if they were already
present in /etc/fstab.
Now the mount options are always accessible for
swap volumes. Their mount point is fixed to 'none'
because that is the only valid option, opts default
to 'sw' and type to swap. The irrelevant options
are insensitive.
https://bugzilla.gnome.org/show_bug.cgi?id=785453
src/disks/gdufstabdialog.c | 47 ++++++++++++++++++++++++++++++-------------
src/disks/gduwindow.c | 2 +
2 files changed, 35 insertions(+), 14 deletions(-)
---
diff --git a/src/disks/gdufstabdialog.c b/src/disks/gdufstabdialog.c
index 9f37a7e..5cd9d9b 100644
--- a/src/disks/gdufstabdialog.c
+++ b/src/disks/gdufstabdialog.c
@@ -39,6 +39,7 @@ typedef struct
GtkWidget *symbolic_icon_entry;
GVariant *orig_fstab_entry;
+ gboolean is_swap;
} FstabDialogData;
static void
@@ -189,21 +190,25 @@ fstab_on_device_combobox_changed (GtkComboBox *combobox,
gpointer user_data)
{
FstabDialogData *data = user_data;
- gchar *fsname;
- gchar *proposed_mount_point;
- const gchar *s;
- fsname = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (data->device_combobox));
- s = strrchr (fsname, '/');
- if (s == NULL)
- s = strrchr (fsname, '=');
- if (s == NULL)
- s = "/disk";
- proposed_mount_point = g_strdup_printf ("/mnt/%s", s + 1);
-
- gtk_entry_set_text (GTK_ENTRY (data->directory_entry), proposed_mount_point);
- g_free (proposed_mount_point);
- g_free (fsname);
+ if (!data->is_swap)
+ {
+ gchar *fsname;
+ gchar *proposed_mount_point;
+ const gchar *s;
+
+ fsname = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (data->device_combobox));
+ s = strrchr (fsname, '/');
+ if (s == NULL)
+ s = strrchr (fsname, '=');
+ if (s == NULL)
+ s = "/disk";
+ proposed_mount_point = g_strdup_printf ("/mnt/%s", s + 1);
+
+ gtk_entry_set_text (GTK_ENTRY (data->directory_entry), proposed_mount_point);
+ g_free (proposed_mount_point);
+ g_free (fsname);
+ }
update_device_explanation (data);
}
@@ -405,6 +410,8 @@ gdu_fstab_dialog_show (GduWindow *window,
data.icon_entry = GTK_WIDGET (gtk_builder_get_object (builder, "fstab-icon-entry"));
data.symbolic_icon_entry = GTK_WIDGET (gtk_builder_get_object (builder, "fstab-symbolic-icon-entry"));
+ data.is_swap = (udisks_object_peek_swapspace (object) != NULL);
+
/* there could be multiple fstab entries - we only consider the first one */
g_variant_iter_init (&iter, udisks_block_get_configuration (block));
while (g_variant_iter_next (&iter, "(&s@a{sv})", &configuration_type, &configuration_dict))
@@ -448,6 +455,18 @@ gdu_fstab_dialog_show (GduWindow *window,
drive,
block,
fsname);
+ if (data.is_swap)
+ {
+ dir = "none";
+ type = "swap";
+ opts = "sw";
+ gtk_widget_set_sensitive (data.directory_entry, FALSE);
+ gtk_widget_set_sensitive (data.show_checkbutton, FALSE);
+ gtk_widget_set_sensitive (data.name_entry, FALSE);
+ gtk_widget_set_sensitive (data.icon_entry, FALSE);
+ gtk_widget_set_sensitive (data.symbolic_icon_entry, FALSE);
+ }
+
gtk_entry_set_text (GTK_ENTRY (data.directory_entry), dir);
gtk_entry_set_text (GTK_ENTRY (data.type_entry), type);
gtk_entry_set_text (GTK_ENTRY (data.options_entry), opts);
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 186e0d9..7f80dd0 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -2775,6 +2775,8 @@ update_device_page_for_block (GduWindow *window,
/* Translators: Shown as in-use part of 'Contents' if the swap device is not in use */
in_use_markup = g_strdup (C_("volume-content-swap", "Not Active"));
}
+
+ show_flags->volume_menu |= SHOW_FLAGS_VOLUME_MENU_CONFIGURE_FSTAB;
}
}
else if (g_strcmp0 (udisks_block_get_id_usage (block), "crypto") == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]