summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-01-13 17:45:11 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-01-13 17:45:11 +0000
commit9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060 (patch)
tree3aed7a3f5417d4bdd2a37a4c82c5a8969a814a43 /perl-install/standalone
parent0ba56cce3e0255f0ed2dec02f158f37b718c0e61 (diff)
downloaddrakx-backup-do-not-use-9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060.tar
drakx-backup-do-not-use-9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060.tar.gz
drakx-backup-do-not-use-9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060.tar.bz2
drakx-backup-do-not-use-9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060.tar.xz
drakx-backup-do-not-use-9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060.zip
sanitize buttons through reusing create_okcancel()
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/drakboot9
-rwxr-xr-xperl-install/standalone/drakclock34
-rwxr-xr-xperl-install/standalone/drakconnect47
-rwxr-xr-xperl-install/standalone/drakfloppy50
-rwxr-xr-xperl-install/standalone/drakfont19
-rwxr-xr-xperl-install/standalone/drakperm77
-rwxr-xr-xperl-install/standalone/draksec29
7 files changed, 136 insertions, 129 deletions
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index 7368de0ef..7bf48382c 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -284,13 +284,14 @@ gtkadd($window,
)
),
1, Gtk2::VBox->new,
- 0, gtkadd(Gtk2::HButtonBox->new,
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { ugtk2->exit(0) }),
- gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
+ 0, create_okcancel({
+ cancel_clicked => sub { ugtk2->exit(0) },
+ ok_clicked => sub {
Xconfig::various::runlevel($x_mode ? 5 : 3);
updateAutologin();
ugtk2->exit(0);
- }),
+ }
+ },
)
)
);
diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock
index 4637e1b46..2dbbf6877 100755
--- a/perl-install/standalone/drakclock
+++ b/perl-install/standalone/drakclock
@@ -95,19 +95,10 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0),
),
),
),
- 0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { ugtk2->exit(0) }),
- $button_reset = gtksignal_connect(Gtk2::Button->new(N("Reset")), clicked => sub {
- $its_reset = 1;
- $timer = Glib::Timeout->add(120, \&update_time);
- Repaint($drawing_area, 1);
- $calendar->select_month($old_month, $old_year);
- $calendar->select_day($old_day);
- $button_reset->set_sensitive(0);
- $its_reset = 0;
- }),
- gtksignal_connect(Gtk2::Button->new(N("Ok")),
- clicked => sub {
+ 0, create_okcancel(my $w =
+ {
+ cancel_clicked => sub { ugtk2->exit(0) },
+ ok_clicked => sub {
if ($check_ntp->get_active) {
my $choosed_serv = $combo_ntpserver->entry->get_text;
$choosed_serv =~ s/(\S+)\s*(.*)$/$1/;
@@ -128,10 +119,23 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0),
-e '/sbin/hwclock' and system('/sbin/hwclock --systohc');
system("dcop kicker Panel restart") if $ENV{DESKTOP} eq 'kde';
ugtk2->exit(0);
- }),
- )
+ },
+ },
+ undef, undef, '',
+ [ N("Reset"), sub {
+ $its_reset = 1;
+ $timer = Glib::Timeout->add(120, \&update_time);
+ Repaint($drawing_area, 1);
+ $calendar->select_month($old_month, $old_year);
+ $calendar->select_day($old_day);
+ $button_reset->set_sensitive(0);
+ $its_reset = 0;
+ } ]
+ ),
)
);
+$button_reset = $w->{buttons}{N("Reset")};
+
my $servers = get_server();
$combo_ntpserver->set_popdown_strings(@$servers);
if (-e $ntpfile && -e $ntpdlock) {
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 69e5a0237..45b08ba47 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -203,17 +203,7 @@ sub manage {
my $notebook = Gtk2::Notebook->new;
$notebook->set_property('show-tabs', 0);
$notebook->set_property('show-border', 0);
-
my $apply_button;
- $apply_button = gtksignal_connect(Gtk2::Button->new(N("Apply")),
- clicked => sub { save($netc, $netcnx, $intf, $gui, $apply_button) });
-
- each_index {
- my $interface = $_;
- $gui->{$interface}{index} = $::i;
- build_notebook($window, $netc, $intf->{$interface}, $gui->{$interface}, $interface, $apply_button);
- $notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $gui->{$interface}{notebook}));
- } (sort keys %$intf);
$window->{rwindow}->add(gtkpack_(Gtk2::VBox->new,
0, $interface_menu = gtksignal_connect(Gtk2::OptionMenu->new,
@@ -223,20 +213,31 @@ sub manage {
},
),
1, $notebook,
- 0, gtkpack(Gtk2::HButtonBox->new,
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $window->destroy;
- Gtk2->main_quit }),
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub {}),
- $apply_button,
- gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
- if ($apply_button->get_property('sensitive')) {
- save($netc, $netcnx, $intf, $gui, $apply_button);
- $window->destroy;
- Gtk2->main_quit;
- }
- }),
+ 0, create_okcancel(my $oc =
+ {
+ cancel_clicked => sub { $window->destroy; Gtk2->main_quit },
+ ok_clicked => sub {
+ if ($apply_button->get_property('sensitive')) {
+ save($netc, $netcnx, $intf, $gui, $apply_button);
+ $window->destroy;
+ Gtk2->main_quit;
+ }
+ },
+ },
+ undef, undef, '',
+ [ N("Help"), sub { exec("drakhelp --id internet-connection") unless fork() } ],
+ [ N("Apply"), sub { save($netc, $netcnx, $intf, $gui, $apply_button) } ],
+ ),
),
- ));
+ );
+ $apply_button = $oc->{buttons}{N("Apply")};
+ each_index {
+ my $interface = $_;
+ $gui->{$interface}{index} = $::i;
+ build_notebook($window, $netc, $intf->{$interface}, $gui->{$interface}, $interface, $apply_button);
+ $notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $gui->{$interface}{notebook}));
+ } (sort keys %$intf);
+
$interface_menu->set_popdown_strings(sort keys %$intf);
$apply_button->set_sensitive(0);
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index a1fcc48b8..6dac2a782 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -99,17 +99,13 @@ $window->{window}->add(
),
),
1, Gtk2::VBox->new,
- 0, gtkpack__(new Gtk2::HButtonBox(),
- gtksignal_connect(Gtk2::Button->new(N("Cancel")),
- clicked => sub { ugtk2->exit(0) }
- ),
- gtksignal_connect(Gtk2::Button->new(N("Preferences")), clicked => \&pref_dialog),
- gtksignal_connect(gtkset_tip($tips,
- Gtk2::Button->new(N("Ok")),
- N("Build the disk")),
- clicked => \&build_it
- ),
- ),
+ 0, create_okcancel({
+ cancel_clicked => sub { ugtk2->exit(0) },
+ ok_clicked => \&build_it,
+ },
+ undef, undef, '',
+ [ N("Preferences"), \&pref_dialog, 0 ],
+ ),
),
);
@@ -188,21 +184,23 @@ sub pref_dialog() {
$remove_but->set_sensitive(scalar @modules);
@temp_modules = ();
- gtkpack($dialog->action_area,
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }),
- gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
- # save values:
- $options{$_} = $buttons{$_}->get_active foreach keys %buttons;
- my $val;
- @modules = ();
- $list_model->foreach(sub {
- my ($model, $_path, $iter) = @_;
- push @modules, $model->get($iter, 0);
- return 0;
- }, $val);
- $dialog->destroy;
- }),
- );
+ gtkadd($dialog->action_area,
+ create_okcancel({
+ cancel_clicked => sub { $dialog->destroy },
+ ok_clicked => sub {
+ # save values:
+ $options{$_} = $buttons{$_}->get_active foreach keys %buttons;
+ my $val;
+ @modules = ();
+ $list_model->foreach(sub {
+ my ($model, $_path, $iter) = @_;
+ push @modules, $model->get($iter, 0);
+ return 0;
+ }, $val);
+ $dialog->destroy;
+ },
+ }),
+ );
$dialog->show_all;
$dialog->run;
}
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
index 443b5150e..5c8bb918a 100755
--- a/perl-install/standalone/drakfont
+++ b/perl-install/standalone/drakfont
@@ -482,21 +482,24 @@ sub interactive_mode() {
my $button = {};
my $disable = sub { my ($b) = @_; $button->{$_}->set_sensitive($_ ne $b) foreach keys %$button };
+ local $::Wizard_no_previous = 1;
gtkadd($window1->{window},
gtkpack_(Gtk2::VBox->new(0, 2),
if_(!$::isEmbedded, 0, gtkcreate_img("drakfont.620x57")),
0, Gtk2::WrappedLabel->new(N("Font List")),
1, create_fontsel(),
- 0, gtkpack(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
- gtksignal_connect(Gtk2::Button->new(N("About")), clicked => \&help),
- gtksignal_connect(Gtk2::Button->new(N("Options")), clicked => \&appli_choice),
- gtksignal_connect(Gtk2::Button->new(N("Uninstall")), clicked => \&uninstall),
- gtksignal_connect(Gtk2::Button->new(N("Import")), clicked => \&advanced_install),
- Gtk2::Label->new(" "),
- gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { Gtk2->main_quit }),
- ),
+ 0, create_okcancel( my $oc = {
+ ok_clicked => sub { Gtk2->main_quit },
+ },
+ undef, undef, '',
+ [ N("About"), \&help, 1 ],
+ [ N("Options"), \&appli_choice, 1 ],
+ [ N("Uninstall"), \&uninstall, 1 ],
+ [ N("Import"), \&advanced_install, 1 ],
+ ),
),
);
+ $oc->{ok}->set_label(N("Close"));
$disable->('font_list');
$window1->{rwindow}->show_all;
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm
index afcbfca94..8e631ffa0 100755
--- a/perl-install/standalone/drakperm
+++ b/perl-install/standalone/drakperm
@@ -126,13 +126,13 @@ Select permissions to see/edit", $level)),
0, Gtk2::VBox->new,
),
),
- 0, gtkpack(Gtk2::HButtonBox->new,
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked =>
- sub { unless (fork()) { exec("drakhelp --id drakperm") } }),
- Gtk2::Label->new(""),
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { ugtk2->exit }),
- gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => \&save_perm),
- )
+ 0, create_okcancel({
+ cancel_clicked => sub { ugtk2->exit },
+ ok_clicked => \&save_perm,
+ },
+ undef, undef, '',
+ [ N("Help"), sub { unless (fork()) { exec("drakhelp --id drakperm") } } ],
+ )
)
);
$W->show_all;
@@ -239,8 +239,6 @@ sub row_setting_dialog {
$dlg->set_transient_for($w->{rwindow}) unless $::isEmbedded;
$dlg->set_modal(1);
# $dlg->set_resizable(0);
- my $ok = Gtk2::Button->new(N("Ok"));
- my $cancel = Gtk2::Button->new(N("Cancel"));
my $browse = new Gtk2::Button(N("browse"));
my $file = new Gtk2::Entry;
my ($other, $group, $user, $s) = reverse(split(//, $model->get($iter, 4))) if $iter;
@@ -270,8 +268,8 @@ sub row_setting_dialog {
#- dlg widgets settings
my %s_right = get_right($s);
+ my $alrd_exsts = defined $iter;
$file->set_text($model->get($iter, 1)) if $iter;
- $ok->set_sensitive(!$model->get($iter, 0)) if $iter;
my $users = Gtk2::OptionMenu->new;
$users->set_popdown_strings(&get_user_or_group('users'));
@@ -299,7 +297,6 @@ sub row_setting_dialog {
}
- $cancel->signal_connect(clicked => sub { $dlg->destroy });
$browse->signal_connect(clicked => sub {
my $file_dlg = new Gtk2::FileSelection(N("Path selection"));
$file_dlg->set_modal(1);
@@ -313,29 +310,6 @@ sub row_setting_dialog {
});
});
my %perms;
- $ok->signal_connect(clicked => sub {
- my ($path, $user, $group, $perms, $_idx);
- $path = $file->get_text;
- if ($usr_check->get_active) {
- $user = 'current';
- $group = '';
- } else {
- $user = $users->entry->get_text;
- $group = $groups->entry->get_text;
- }
- $perms = sprintf("%03o", eval(join('', "0b",
- (map { $perms{$_}->get_active || 0 } reverse @bits),
- (map { my $owner = $_;map_index { $perms{$owner}{$_}->get_active || 0 } @rights } @owners))));
- # create new item if needed (that is when adding a new one) at end of list
- if (!$iter) {
- $iter = $model->append;
- push @rules, { path => $path, user => $user, group => $group, perms => $perms, index => $index };
- $model->set($iter, 5 => $index++);
- }
- $model->set($iter, 1 => $path, 2 => $user, 3 => $group, 4 => $perms);
- $dlg->destroy;
- $modified++;
- });
gtkpack_($dlg->vbox,
0, gtkadd(Gtk2::Frame->new(N("Path")),
@@ -385,11 +359,40 @@ sub row_setting_dialog {
$perms{gid}->set_active($s_right{write});
$perms{suid}->set_active($s_right{read});
- gtkadd($dlg->action_area,
- $cancel,
- $ok
+ gtkadd($dlg->action_area,
+ create_okcancel(my $w =
+ {
+ cancel_clicked => sub { $dlg->destroy },
+ ok_clicked => sub {
+ my ($path, $user, $group, $perms, $_idx);
+ $path = $file->get_text;
+ if ($usr_check->get_active) {
+ $user = 'current';
+ $group = '';
+ } else {
+ $user = $users->entry->get_text;
+ $group = $groups->entry->get_text;
+ }
+ $perms = sprintf("%03o", eval(join('', "0b",
+ (map { $perms{$_}->get_active || 0 } reverse @bits),
+ (map { my $owner = $_;map_index {
+ $perms{$owner}{$_}->get_active || 0
+ } @rights } @owners))));
+ # create new item if needed (that is when adding a new one) at end of list
+ if (!$iter) {
+ $iter = $model->append;
+ push @rules, { path => $path, user => $user, group => $group, perms => $perms, index => $index };
+ $model->set($iter, 5 => $index++);
+ }
+ $model->set($iter, 1 => $path, 2 => $user, 3 => $group, 4 => $perms);
+ $dlg->destroy;
+ $modified++;
+ }
+ },
+ ),
);
+ $w->{ok}->set_sensitive(!$model->get($iter, 0)) if $alrd_exsts;
$dlg->show_all;
}
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec
index 7b53b96ad..c6d6afca4 100755
--- a/perl-install/standalone/draksec
+++ b/perl-install/standalone/draksec
@@ -227,8 +227,12 @@ $notebook->append_page(gtkshow(create_scrolled_window(gtkpack_(new Gtk2::VBox(0,
####################### OK CANCEL BUTTONS ##################################
-my $bok = gtksignal_connect(Gtk2::Button->new(N("Ok")),
- 'clicked' => sub {
+gtkpack_($vbox,
+ 1, gtkshow($notebook),
+ 0, create_okcancel(my $oc =
+ {
+ cancel_clicked => sub { ugtk2->exit(0) },
+ ok_clicked => sub {
my $seclevel_value = $seclevel_entry->entry->get_text;
my $secadmin_check_value = $secadmin_check->get_active;
my $secadmin_value = $secadmin_entry->get_text;
@@ -272,21 +276,14 @@ my $bok = gtksignal_connect(Gtk2::Button->new(N("Ok")),
remove_wait_msg($w);
ugtk2->exit(0);
- });
-
-my $bcancel = gtksignal_connect(Gtk2::Button->new(N("Cancel")),
- 'clicked' => sub { ugtk2->exit(0) });
-gtkpack_($vbox,
- 1, gtkshow($notebook),
- 0, gtkpack(Gtk2::HButtonBox->new,
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { unless (fork()) { exec("drakhelp --id draksec") } }),
- Gtk2::Label->new(""),
- $bcancel,
- $bok,
- ),
+ }
+ },
+ undef, undef, '',
+ [ N("Help"), sub { unless (fork()) { exec("drakhelp --id draksec") } } ],
+ ),
);
-$bcancel->can_default(1);
-$bcancel->grab_default;
+$oc->{cancel}->can_default(1);
+$oc->{cancel}->grab_default;
$w->main;
ugtk2->exit(0);