Hi all,

This is a first patch, concerning the drakdisk feature 
https://wiki.mageia.org/en/Feature:DiskDrakeRedesign

the patch does the following:
- group the functionality to actually get all the disks in a function
- pass a ref to the function as the do_force_reload parameter to interactive
- make a Refresh function that returns "force_reload"
- add a button in the gtk

what it still needs for the first stage of this feature:
- a button for the curses one
- remove the abort message if no disks are found, but add a text in place of 
the disk tabs to say there are no disks and telling you can refresh after 
plugging in a disk.


attached is a small patch for /soft/drakx

can *anyone* tell me if i'm on the right track, or if i'm doing ugly stuff, or 
if i'm forgetting important parts?

Thanks,

AL13N
Index: perl-install/standalone/diskdrake
===================================================================
--- perl-install/standalone/diskdrake	(revision 6209)
+++ perl-install/standalone/diskdrake	(working copy)
@@ -71,15 +71,8 @@
     $in->exit(0);
 }
 
-my $all_hds = fsedit::get_hds({}, $in);
+my $all_hds = reload();
 
-fs::get_raw_hds('', $all_hds);
-
-fs::get_info_from_fstab($all_hds);
-fs::merge_info_from_mtab([ fs::get::really_all_fstab($all_hds) ]);
-
-$all_hds->{current_fstab} = fs::fstab_to_string($all_hds, '');
-
 if ($type eq 'list-hd') {
     print partition_table::description($_), "\n" foreach fs::get::fstab($all_hds);    
 } elsif ($type eq 'change-geometry') {
@@ -90,7 +83,7 @@
     partition_table::write($hd);
 } elsif ($type eq 'hd') {
     require diskdrake::interactive;
-    diskdrake::interactive::main($in, $all_hds, '');
+    diskdrake::interactive::main($in, $all_hds, \&reload);
 } elsif ($type eq 'removable') {
     require diskdrake::removable;
     my ($raw_hd) = $para ?
@@ -119,3 +112,15 @@
 }
 
 $in->exit(0);
+
+sub reload {
+    my $all_hds = fsedit::get_hds({}, $in);
+
+    fs::get_raw_hds('', $all_hds);
+
+    fs::get_info_from_fstab($all_hds);
+    fs::merge_info_from_mtab([ fs::get::really_all_fstab($all_hds) ]);
+
+    $all_hds->{current_fstab} = fs::fstab_to_string($all_hds, '');
+    return $all_hds;
+}
Index: perl-install/diskdrake/hd_gtk.pm
===================================================================
--- perl-install/diskdrake/hd_gtk.pm	(revision 6209)
+++ perl-install/diskdrake/hd_gtk.pm	(working copy)
@@ -190,7 +190,7 @@
 
     my @actions = (
 		   diskdrake::interactive::general_possible_actions($in, $all_hds), 
-		   N_("Done"));
+		   N_("Refresh"), N_("Done"));
     my $box_end = gtknew('HButtonBox', layout => 'end', spacing => 5);
     foreach my $s (@actions) {
 	my $button = Gtk2::Button->new(translate($s));
Index: perl-install/diskdrake/interactive.pm
===================================================================
--- perl-install/diskdrake/interactive.pm	(revision 6209)
+++ perl-install/diskdrake/interactive.pm	(working copy)
@@ -273,6 +273,11 @@
     if_($::isInstall, N_("More"));
 }
 
+sub Refresh {
+    my ($in, $all_hds) = @_;
+    return "force_reload";
+}
+
 sub Done {
     my ($in, $all_hds) = @_;
     eval { raid::verify($all_hds->{raids}) };

Reply via email to