parted/Fix-help-text-for-disk_-set-toggle.patch

80 lines
3.0 KiB
Diff

From 3e005b4644d2a97da85c251f93d32d93e94bcccf Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Mon, 24 Feb 2014 11:29:43 -0500
Subject: [PATCH] Fix help text for disk_{set,toggle}
Fix the help text to show *disk* flags instead of partition flags.
---
parted/parted.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
Index: parted-3.1/parted/parted.c
===================================================================
--- parted-3.1.orig/parted/parted.c
+++ parted-3.1/parted/parted.c
@@ -144,6 +144,7 @@ static const char* number_msg = N_(
static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
static const char* flag_msg_start = N_("FLAG is one of: ");
+static const char* disk_flag_msg_start = N_("FLAG is one of: ");
static const char* unit_msg_start = N_("UNIT is one of: ");
static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal");
static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, "
@@ -170,6 +171,7 @@ static const char* copyright_msg = N_(
static char* label_type_msg;
static char* flag_msg;
+static char* disk_flag_msg;
static char* unit_msg;
static char* mkpart_fs_type_msg;
@@ -1845,6 +1847,7 @@ _init_messages ()
PedFileSystemAlias* fs_alias;
PedDiskType* disk_type;
PedPartitionFlag part_flag;
+ PedDiskFlag disk_flag;
PedUnit unit;
/* flags */
@@ -1863,6 +1866,22 @@ _init_messages ()
flag_msg = str_list_convert (list);
str_list_destroy (list);
+/* disk flags */
+ first = 1;
+ list = str_list_create (_(disk_flag_msg_start), NULL);
+ for (disk_flag = ped_disk_flag_next (0); disk_flag;
+ disk_flag = ped_disk_flag_next (disk_flag)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list,
+ _(ped_disk_flag_get_name (disk_flag)));
+ }
+ str_list_append (list, "\n");
+
+ disk_flag_msg = str_list_convert (list);
+ str_list_destroy (list);
/* units */
first = 1;
@@ -2055,7 +2074,7 @@ command_register (commands, command_crea
str_list_create (
_("disk_set FLAG STATE change the FLAG on selected device"),
NULL),
- str_list_create (flag_msg, _(state_msg), NULL), 1));
+ str_list_create (disk_flag_msg, _(state_msg), NULL), 1));
command_register (commands, command_create (
str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL),
@@ -2064,7 +2083,7 @@ command_register (commands, command_crea
_("disk_toggle [FLAG] toggle the state of FLAG on "
"selected device"),
NULL),
- str_list_create (flag_msg, NULL), 1));
+ str_list_create (disk_flag_msg, NULL), 1));
command_register (commands, command_create (
str_list_create_unique ("set", _("set"), NULL),