[gnome-disk-utility] bug 576431 – better warning
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-disk-utility] bug 576431 – better warning
- Date: Tue, 31 Mar 2009 17:03:52 -0400 (EDT)
commit 1c2c67959f76ac5f0262d7d4dd198540a4055e26
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Mar 31 17:00:22 2009 -0400
bug 576431 â?? better warning
I was trying to delete a partition that was inside an extended partition. The
partitions I have are
part1
part2
part3
[extended]
part4
part5
part6
I was going to delete part6. I got a warning dialog that was talking about
deleting "partition 7 on the media". This had me slightly confused, because my
naming choice didn't make it obvious that part6 is the seventh. I think it
would be better to mention the label in the warning dialog, if there is a
label.
Similarly, when deleting an extended partition, the warning should make it very
clear that all the partitions contained in the extended partition will be
deleted too.
http://bugzilla.gnome.org/show_bug.cgi?id=576431
Signed-off-by: David Zeuthen <davidz redhat com>
---
src/palimpsest/gdu-section-partition.c | 101 +++++++++++++++++++++++++++----
1 files changed, 88 insertions(+), 13 deletions(-)
diff --git a/src/palimpsest/gdu-section-partition.c b/src/palimpsest/gdu-section-partition.c
index b186744..b404404 100644
--- a/src/palimpsest/gdu-section-partition.c
+++ b/src/palimpsest/gdu-section-partition.c
@@ -72,12 +72,16 @@ delete_partition_callback (GtkAction *action, gpointer user_data)
{
GduSectionPartition *section = GDU_SECTION_PARTITION (user_data);
GduDevice *device;
+ GduPresentable *presentable;
char *primary;
char *secondary;
char *secure_erase;
GduPresentable *toplevel_presentable;
GduDevice *toplevel_device;
char *drive_name;
+ char *name;
+ const gchar *type;
+ gint msdos_type;
secure_erase = NULL;
primary = NULL;
@@ -85,8 +89,10 @@ delete_partition_callback (GtkAction *action, gpointer user_data)
toplevel_presentable = NULL;
toplevel_device = NULL;
drive_name = NULL;
+ name = NULL;
- device = gdu_presentable_get_device (gdu_section_get_presentable (GDU_SECTION (section)));
+ presentable = gdu_section_get_presentable (GDU_SECTION (section));
+ device = gdu_presentable_get_device (presentable);
if (device == NULL) {
g_warning ("%s: device is not supposed to be NULL", __FUNCTION__);
goto out;
@@ -104,23 +110,92 @@ delete_partition_callback (GtkAction *action, gpointer user_data)
}
drive_name = gdu_presentable_get_name (toplevel_presentable);
+ name = gdu_presentable_get_name (presentable);
+ type = gdu_device_partition_get_type (device);
+ msdos_type = strtol (type, NULL, 0);
primary = g_strconcat ("<b><big>", _("Are you sure you want to remove the partition, deleting existing data ?"), "</big></b>", NULL);
if (gdu_device_is_removable (toplevel_device)) {
- secondary = g_strdup_printf (_("All data on partition %d on the media in \"%s\" will be "
- "irrecovably erased. "
- "Make sure important data is backed up. "
- "This action cannot be undone."),
- gdu_device_partition_get_number (device),
- drive_name);
+ if (name != NULL && strlen (name) > 0) {
+ if (msdos_type == 0x05 || msdos_type == 0x0f || msdos_type == 0x85) {
+ secondary = g_strdup_printf (_("All data on partition %d with name \"%s\" on the media in \"%s\" "
+ "and all partitions contained in this extended partition "
+ "will be irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ name,
+ drive_name);
+ }
+ else {
+ secondary = g_strdup_printf (_("All data on partition %d with name \"%s\" on the media in \"%s\" will be "
+ "irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ name,
+ drive_name);
+ }
+ } else {
+ if (msdos_type == 0x05 || msdos_type == 0x0f || msdos_type == 0x85) {
+ secondary = g_strdup_printf (_("All data on partition %d on the media in \"%s\" "
+ "and all partitions contained in this extended partition "
+ "will be irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ drive_name);
+ }
+ else {
+ secondary = g_strdup_printf (_("All data on partition %d on the media in \"%s\" "
+ "will be irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ drive_name);
+ }
+ }
} else {
- secondary = g_strdup_printf (_("All data on partition %d of \"%s\" will be "
- "irrecovably erased. "
- "Make sure important data is backed up. "
- "This action cannot be undone."),
- gdu_device_partition_get_number (device),
- drive_name);
+ if (name != NULL && strlen (name) > 0) {
+ if (msdos_type == 0x05 || msdos_type == 0x0f || msdos_type == 0x85) {
+ secondary = g_strdup_printf (_("All data on partition %d with name \"%s\" of \"%s\" "
+ "and all partitions contained in this extended partition "
+ "will be irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ name,
+ drive_name);
+ }
+ else {
+ secondary = g_strdup_printf (_("All data on partition %d with name \"%s\" of \"%s\" will be "
+ "irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ name,
+ drive_name);
+ }
+ } else {
+ if (msdos_type == 0x05 || msdos_type == 0x0f || msdos_type == 0x85) {
+ secondary = g_strdup_printf (_("All data on partition %d of \"%s\" "
+ "and all partitions contained in this extended partition "
+ "will be irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ drive_name);
+ }
+ else {
+ secondary = g_strdup_printf (_("All data on partition %d of \"%s\" will be "
+ "irrecovably erased.\n\n"
+ "Make sure important data is backed up. "
+ "This action cannot be undone."),
+ gdu_device_partition_get_number (device),
+ drive_name);
+ }
+ }
}
secure_erase = gdu_util_delete_confirmation_dialog (gdu_shell_get_toplevel (gdu_section_get_shell (GDU_SECTION (section))),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]