Commit 20fdc386 authored by Kai Lüke's avatar Kai Lüke

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
parent 38044aad
......@@ -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);
......
......@@ -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)
......
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