summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/standalone/draknfs35
1 files changed, 16 insertions, 19 deletions
diff --git a/perl-install/standalone/draknfs b/perl-install/standalone/draknfs
index 15664e403..a8adb8bd3 100644
--- a/perl-install/standalone/draknfs
+++ b/perl-install/standalone/draknfs
@@ -30,8 +30,6 @@ use ugtk2 qw(:ask :wrappers :create :dialogs);
my $in = 'interactive'->vnew('su');
$in->do_pkgs->ensure_is_installed('nfs-utils', '/usr/sbin/rpc.nfsd') or return;
-use constant FALSE => 0;
-use constant TRUE => 1;
use constant COLUMN_DIR => 0;
use constant COLUMN_ACCESS => 1;
use constant COLUMN_RIGHT => 2;
@@ -55,7 +53,7 @@ my $userid_data = {
my @yesno = qw(yes no);
-sub get_items {
+sub get_items() {
my @items = (
[ "/_File", undef, undef, undef, '<Branch>', ],
[ "/_File/_Write conf", undef, \&write_conf, 1, '<StockItem>', 'gtk-execute' ],
@@ -72,11 +70,11 @@ sub quit_all() {
ugtk2->exit;
}
-sub restart_dialog {
+sub restart_dialog() {
wait_action("service nfs restart");
}
-sub reload_dialog {
+sub reload_dialog() {
wait_action("service nfs reload");
}
@@ -98,9 +96,9 @@ my $label_and_widgets = sub {
};
my $fdwidget = sub {
- my ($data, $label) = @_;
+ my ($data) = @_;
my $fd = new Gtk2::FileSelection(N("Directory Selection"));
- $fd->set_modal(TRUE);
+ $fd->set_modal(1);
$fd->signal_connect("destroy", sub { $fd->hide });
$fd->ok_button->signal_connect(clicked => sub {
my $file = $fd->get_filename;
@@ -112,7 +110,7 @@ my $fdwidget = sub {
return $fd;
};
-sub get_nfs_data {
+sub get_nfs_data() {
# /home/nis *(async,rw,no_root_squash)
# /home/nis/guibo/Build *(async,rw,no_root_squash)
foreach (cat_($CONF)) {
@@ -126,7 +124,7 @@ sub get_nfs_data {
}
}
-sub write_conf {
+sub write_conf() {
output($CONF, "# generated by drakhosts.pl\n");
foreach my $a (@listshare) {
append_to_file($CONF, "$a->{dir} $a->{access}($a->{right}) $a->{options}\n");
@@ -262,11 +260,11 @@ sub get_user_or_group {
sub add_modify_entry {
- my ($widget, $treeview, $wanted) = @_;
+ my ($treeview, $wanted) = @_;
my $model = $treeview->get_model;
my $selection = $treeview->get_selection;
my $iter;
- my ($i, $dir, $access, $right, $anonuid, $anongid, $options);
+ my ($i, $dir, $access, $right, $options);
my ($lr, $luserid, $lsecure, $lsync, $lr_data, $lsync_data, $lsecure_data);
undef $i; undef $iter;
@@ -284,7 +282,7 @@ sub add_modify_entry {
$lsync->set_popdown_strings(@yesno);
$lsecure->set_popdown_strings(@yesno);
- my $file_dialog = $fdwidget->($dir, "");
+ my $file_dialog = $fdwidget->($dir);
my $button = Gtk2::Button->new_from_stock('gtk-open');
$button->signal_connect(clicked => sub { $file_dialog->show });
@@ -343,7 +341,7 @@ sub add_modify_entry {
if ($opt =~ /insecure/) { $lsecure->set_text("no") } else { $lsecure->set_text("yes") }
} else { next }
}
- map { if ($_->get_text =~ //) { $_->set_text("yes") } } $lsecure, $lsync;
+ foreach ($lsecure, $lsync) { if ($_->get_text =~ //) { $_->set_text("yes") } }
$lr->get_text =~ // and $lr->set_text("no");
}
@@ -554,18 +552,17 @@ my $W = $window->{window};
$W->signal_connect(delete_event => sub { ugtk2->exit });
my $treeview = Gtk2::TreeView->new_with_model($model);
-$treeview->set_rules_hint(TRUE);
+$treeview->set_rules_hint(1);
$treeview->get_selection->set_mode('single');
add_columns($treeview);
# double clic and popup modify window
$treeview->signal_connect(button_press_event => sub {
my (undef, $event) = @_;
- my $model = $treeview->get_model;
my $selection = $treeview->get_selection;
my $iter = $selection->get_selected;
if ($iter) {
- add_modify_entry($model, $treeview, "modify") if $event->type eq '2button-press';
+ add_modify_entry($treeview, "modify") if $event->type eq '2button-press';
}
});
@@ -577,7 +574,7 @@ my $menu = $factory->get_widget('<main>');
my $okcancel = create_okcancel({
cancel_clicked => sub { ugtk2->exit },
- ok_clicked => sub { write_conf; ugtk2->exit; },
+ ok_clicked => sub { &write_conf; ugtk2->exit },
},
);
@@ -590,14 +587,14 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0),
1, create_scrolled_window($treeview),
0, gtkpack_(create_vbox('start'),
0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub {
- eval { add_modify_entry($model, $treeview, "add") };
+ eval { add_modify_entry($treeview, "add") };
my $err = $@;
if ($err) {
err_dialog(N("Error"), N("Failed to add NFS share.") . "\n\n" . $err);
}
}),
0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub {
- eval { add_modify_entry($model, $treeview, "modify") };
+ eval { add_modify_entry($treeview, "modify") };
my $err = $@;
if ($err) {
err_dialog(N("Error"), N("Failed to Modify NFS share.") . "\n\n" . $err);