Author: aschnell
Date: Thu Jun 26 17:52:15 2008
New Revision: 48556
URL: http://svn.opensuse.org/viewcvs/yast?rev=48556&view=rev
Log:
- added dialog to choose partition table type (fate #303924)
Modified:
branches/tmp/aschnell/part-redesign/package/yast2-storage.changes
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp
branches/tmp/aschnell/part-redesign/storage/src/modules/Storage.ycp
Modified: branches/tmp/aschnell/part-redesign/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/package/yast2-storage.changes?rev=48556&r1=48555&r2=48556&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/package/yast2-storage.changes (original)
+++ branches/tmp/aschnell/part-redesign/package/yast2-storage.changes Thu Jun 26 17:52:15 2008
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Jun 26 17:51:12 CEST 2008 - aschnell@suse.de
+
+- added dialog to choose partition table type (fate #303924)
+
+-------------------------------------------------------------------
Mon Apr 14 18:57:35 CEST 2008 - aschnell@suse.de
- added function getUnusedPartitionSlots to libstorage
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp?rev=48556&r1=48555&r2=48556&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp Thu Jun 26 17:52:15 2008
@@ -16,11 +16,48 @@
return;
}
+ map target_map = Storage::GetTargetMap();
+
+ string default_label = Storage::DefaultDiskLabel(target_map[disk_device, "size_k"]:0);
+
+ list<string> labels = [ default_label ];
+ if (!contains(labels, "gpt"))
+ labels = add(labels, "gpt");
+
+ string label = default_label;
+ if (size(labels) > 1)
+ {
+ term tmp = list::reduce(term t, string l, `VBox(), labels, {
+ return add(t, `LeftRadioButton(`id(l), toupper(l), l == default_label));
+ });
+
+ UI::OpenDialog(`opt(`decorated),
+ Greasemonkey::Transform(
+ `VBox(
+ `Label(sformat(_("Select new partition table type for %1."), disk_device)),
+ `RadioButtonGroup(`id(`labels), tmp),
+ `HBox(
+ `PushButton(`id(`ok), `opt(`default), Label::OKButton()),
+ `PushButton(`id(`cancel), Label::CancelButton())
+ )
+ )
+ )
+ );
+
+ symbol widget = (symbol) UI::UserInput();
+
+ label = (string) UI::QueryWidget(`id(`labels), `Value);
+
+ UI::CloseDialog();
+
+ if (widget != `ok)
+ return;
+ }
+
if (YesNo(sformat(_("Really create new partition table on %1? This will delete all data
-on %1 and all RAIDs and Volume Groups using %1."), disk_device)))
+on %1 and all RAIDs and Volume Groups using partitions on %1."), disk_device)))
{
- map target_map = Storage::GetTargetMap();
- Storage::DeletePartitionTable(disk_device, target_map[disk_device, "size_k"]:0);
+ Storage::CreatePartitionTable(disk_device, label);
UpdateNavigationTree(nil);
TreePanel::Create();
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/modules/Storage.ycp?rev=48556&r1=48555&r2=48556&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/modules/Storage.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/modules/Storage.ycp Thu Jun 26 17:52:15 2008
@@ -3361,6 +3361,16 @@
return( ret==0 );
}
+
+global string DefaultDiskLabel(integer size_k)
+{
+ y2milestone("DefaultDiskLabel size_k:%1", size_k );
+ string label = LibStorage::StorageInterface::defaultDiskLabelSize(sint, size_k);
+ y2milestone("DefaultDiskLabel label:%1", label);
+ return label;
+}
+
+
/**
* Delete the partition table and disk label of device
* @param string the disk to deleted the partition table from
@@ -3381,6 +3391,18 @@
return( ret==0 );
}
+
+global boolean CreatePartitionTable(string disk, string label)
+{
+ y2milestone("CreatePartitionTable %1 label:%2", disk, label);
+ integer ret = LibStorage::StorageInterface::destroyPartitionTable(sint, disk, label);
+ if (ret < 0)
+ y2error("CreatePartitionTable sint ret:%1", ret);
+ UpdateTargetMap();
+ return ret == 0;
+}
+
+
global symbol GetMountBy( string device );
/**
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org