summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-07-14 19:19:15 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-07-14 19:19:15 +0000
commite93329d14b4af50b261dcab5fbeaeed8fedc8c37 (patch)
treed1ae3aabce3553a5727d53f15786437836173c16 /perl-install
parentc49d48effb07b95f332201c35513acb1cf51cae1 (diff)
downloaddrakx-e93329d14b4af50b261dcab5fbeaeed8fedc8c37.tar
drakx-e93329d14b4af50b261dcab5fbeaeed8fedc8c37.tar.gz
drakx-e93329d14b4af50b261dcab5fbeaeed8fedc8c37.tar.bz2
drakx-e93329d14b4af50b261dcab5fbeaeed8fedc8c37.tar.xz
drakx-e93329d14b4af50b261dcab5fbeaeed8fedc8c37.zip
renew drakconnect GUI:
- make sub windows be modal 'n trancient dialogs - use std layout and stock items for buttons in main window and dialogs - fix "Internet connection configuration" dialog - (new_dialog) reuse ugtk2::_create_dialog (shared with half a dozen other tools - fix layout of main window: o pack together expert mode toggle and wizard button o merge wizard label and button o make a checkbox out of the ugly expert <-> normal button
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakconnect161
1 files changed, 68 insertions, 93 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index c24e2a55c..b92557264 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -86,7 +86,7 @@ $combo1->entry->set_text($netcnx->{PROFILE} || "default");
$combo1->entry->set_editable(0);
my $button_del = new Gtk2::Button(N("Del profile..."));
$button_del->signal_connect(clicked => sub {
- my $dialog = new_dialog();
+ my $dialog = _create_dialog(N("Delete profile"));
$dialog->vbox->pack_start(new Gtk2::Label(N("Profile to delete:")),1,1,0);
my $combo_dialog = new Gtk2::Combo;
$combo_dialog->set_popdown_strings(grep { ! /default/ } network::netconnect::get_profiles());
@@ -106,8 +106,7 @@ $button_del->signal_connect(clicked => sub {
$button_cancel->signal_connect(clicked => sub { Gtk2->main_quit });
$bbox_dialog->add($button_cancel);
$dialog->show_all;
- $dialog->set_modal(1);
- Gtk2->main;
+ $dialog->run;
$dialog->destroy;
$combo1->entry->set_text(-e "/etc/sysconfig/network-scripts/drakconnect_conf." . $combo1->entry->get_text ? $combo1->entry->get_text : "default");
$combo1->set_popdown_strings(network::netconnect::get_profiles());
@@ -116,7 +115,7 @@ $button_del->signal_connect(clicked => sub {
$button_del->set_sensitive(network::netconnect::get_profiles() > 1);
my $button_new = new Gtk2::Button(N("New profile..."));
$button_new->signal_connect(clicked => sub {
- my $dialog = new_dialog();
+ my $dialog = _create_dialog("New profile...");
$dialog->vbox->pack_start(new Gtk2::Label(N("Name of the profile to create (the new profile is created as a copy of the current one) :")),1,1,0);
my $entry_dialog = new Gtk2::Entry;
$dialog->vbox->pack_start($entry_dialog,1,1,0);
@@ -134,8 +133,7 @@ $button_new->signal_connect(clicked => sub {
$button_cancel->signal_connect(clicked => sub { Gtk2->main_quit });
$bbox_dialog->add($button_cancel);
$dialog->show_all;
- $dialog->set_modal(1);
- Gtk2->main;
+ $dialog->run;
$dialog->destroy;
$combo1->entry->set_text(-e "/etc/sysconfig/network-scripts/drakconnect_conf." . $netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
$combo1->set_popdown_strings(network::netconnect::get_profiles());
@@ -178,7 +176,7 @@ build_list();
my $button_lan = gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")),
clicked => sub { configure_lan('', $netcnx, $netc, $intf) });
-my ($bbox0, $label_host, $int_state);
+my ($bbox0, $label_host, $int_state, $button_expert);
$window1->{window}->add(
gtkpack_(Gtk2::VBox->new(0,10),
@@ -217,9 +215,13 @@ $window1->{window}->add(
0, $button_lan),
)
),
- 0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
- Gtk2::Label->new(N("Click here to launch the wizard ->")),
- gtksignal_connect(Gtk2::Button->new(N("Wizard...")),
+ 0, gtkadd(Gtk2::HButtonBox->new,
+ $button_expert = gtksignal_connect(new Gtk2::CheckButton(N("Expert Mode")),
+ clicked => sub {
+ $expert_mode = $button_expert->get_active;
+ $_->set_sensitive($expert_mode) foreach $button_internet, $button_lan;
+ }),
+ gtksignal_connect(Gtk2::Button->new(N("Launch the wizard")),
clicked => sub {
system("drakconnect");
#- reload everything...
@@ -234,18 +236,12 @@ $window1->{window}->add(
}),
),
0, Gtk2::HSeparator->new,
- 0, gtkset_layout($bbox0 = new Gtk2::HButtonBox, 'end')
+ 0, $bbox0 = new Gtk2::HButtonBox,
),
);
-my $button_expert = new Gtk2::Button(N("Expert Mode"));
-$button_expert->signal_connect(clicked => sub {
- foreach ($button_internet, $button_lan) { $expert_mode ? $_->set_sensitive(0) : $_->set_sensitive(1) }
- $button_expert->child->set($expert_mode ? N("Expert Mode") : N("Normal Mode"));
- $expert_mode = !$expert_mode;
- });
-$bbox0->add($button_expert);
+$button_expert->set_active($expert_mode);
my $button_apply = new Gtk2::Button(N("Apply"));
$button_apply->signal_connect(clicked => \&apply);
$button_apply->set_sensitive(0);
@@ -256,7 +252,7 @@ $button_cancel->signal_connect(clicked => \&quit_global);
$bbox0->add($button_cancel);
my $button_ok = new Gtk2::Button(N("OK"));
$button_ok->signal_connect(clicked => sub {
- my $dialog = new_dialog();
+ my $dialog = _create_dialog(N("Please wait"));
$dialog->vbox->pack_start(new Gtk2::Label(N("Please Wait... Applying the configuration")),1,1,20);
$dialog->show_all;
gtkflush();
@@ -375,32 +371,28 @@ sub quit_global() {
sub configure_lan {
my ($prefix, $netcnx, undef, $intf) = @_;
- my $window = Gtk2::Window->new('toplevel');
-
+ my $window = _create_dialog(N("LAN configuration"));
my @card_tab;
if (@all_cards < 1) {
- my $dialog = new_dialog();
- $dialog->vbox->pack_start(new Gtk2::Label(N("You don't have any configured interface.
+ $window->vbox->pack_start(new Gtk2::Label(N("You don't have any configured interface.
Configure them first by clicking on 'Configure'")),1,1,0);
- $dialog->action_area->add(gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
- gtksignal_connect(new Gtk2::Button(N("OK")),
+ $window->action_area->add(gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'),
clicked => sub { Gtk2->main_quit })
)
);
- $dialog->show_all;
- $dialog->set_modal(1);
- Gtk2->main;
- $dialog->destroy;
+ $window->show_all;
+ $window->run;
+ $window->destroy;
return;
}
- $window->signal_connect(delete_event => sub { Gtk2->main_quit });
- $window->set_position('center');
- $window->set_title(N("LAN configuration"));
$window->set_border_width(10);
- my $vbox0 = new Gtk2::VBox(0,0);
- $window->add($vbox0);
+
+ $window->vbox->pack_start(my $vbox0 = new Gtk2::VBox(0,0),
+ 1, 1, 0,
+ );
$vbox0->pack_start(new Gtk2::Label(N("LAN Configuration")),0,1,0);
my $notebook = new Gtk2::Notebook;
$vbox0->pack_start($notebook,0,1,0);
@@ -482,27 +474,28 @@ Configure them first by clicking on 'Configure'")),1,1,0);
$button_apply->set_sensitive(1);
$window->destroy; Gtk2->main_quit;
});
- $bbox8->add($button_ok);
-
- my $button_cancel = new Gtk2::Button(N("Cancel"));
- $button_cancel->signal_connect(clicked => sub { $window->destroy; Gtk2->main_quit });
- $bbox8->add($button_cancel);
+ $window->action_area->pack_start(gtkpack(Gtk2::HButtonBox->new,
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'),
+ clicked => sub { $window->destroy; Gtk2->main_quit }),
+ $button_ok,
+ ),
+ 1, 1, 0,
+ );
- $window->set_modal(1);
$window->show_all;
foreach (0..$#all_cards) {
my @infos = @{$card_tab[2*$_]};
$intf->{"eth$_"}{BOOTPROTO} eq "dhcp" or $infos[8]->hide;
}
$window->set_position('center_always');
- Gtk2->main;
+ $window->run;
}
sub configure_net {
my ($_prefix, $netcnx, $netc, $_intf) = @_;
if (!$netcnx->{type}) {
- my $dialog = new_dialog();
+ my $dialog = _create_dialog(N("LAN configuration"));
$dialog->vbox->pack_start(new Gtk2::Label(N("You don't have an Internet connection.
Create one first by clicking on 'Configure'")),1,1,0);
my $bbox_dialog = new Gtk2::HButtonBox;
@@ -514,27 +507,15 @@ Create one first by clicking on 'Configure'")),1,1,0);
});
$bbox_dialog->add($button_ok);
$dialog->show_all;
- $dialog->set_modal(1);
- Gtk2->main;
+ $dialog->run;
$dialog->destroy;
return;
}
my $cnx = {};
$cnx = $netcnx->{$netcnx->{type}};
- my $window = Gtk2::Window->new('toplevel');
+ my $window = _create_dialog(N("Internet connection configuration"));
$window->signal_connect(delete_event => sub { Gtk2->main_quit });
- $window->set_position('center');
- $window->set_title(N("Internet connection configuration"));
$window->set_border_width(10);
- my $table1 = new Gtk2::Table(2, 4, 0);
- $table1->set_row_spacings(5);
- $table1->set_col_spacings(5);
- $table1->attach(new Gtk2::Label(N("Profile: ")), 0, 1, 0, 1, 'fill', 'fill',0,0);
- $table1->attach(new Gtk2::Label(translate($netcnx->{PROFILE})), 1, 2, 0, 1, 'fill', 'fill',0,0);
- $table1->attach(new Gtk2::Label(N("Connection type: ")), 0, 1, 1, 2, 'fill', 'fill',0,0);
- $table1->attach(new Gtk2::Label(translate($netcnx->{type})), 1, 2, 1, 2, 'fill', 'fill',0,0);
-# my $button_internet = new Gtk2::Button(N("Reconfigure using wizard..."));
-# $table1->attach($button_internet, 2, 4, 0, 2, 'fill', 'fill',0,0);
my $vbox2 = new Gtk2::VBox(0,0);
my $i = 0;
@@ -604,42 +585,36 @@ Create one first by clicking on 'Configure'")),1,1,0);
$i++;
}
- my $button_ok = new Gtk2::Button(N("OK"));
- $button_ok->signal_connect(clicked => sub {
- each_index {
- ${$conf_data[$::i][1]} = $infos[2*$::i+1]->get_text if $_;
- } @mask;
- update();
- $button_apply->set_sensitive(1);
- $window->destroy; Gtk2->main_quit;
- });
- my $button_cancel = new Gtk2::Button(N("Cancel"));
- $button_cancel->signal_connect(clicked => sub { $window->destroy; Gtk2->main_quit });
-
- $window->set_modal(1);
-
- gtkadd($window,
- gtkpack__(new Gtk2::VBox(0, 0),
- new Gtk2::Label(N("Internet Connection Configuration")),
- new Gtk2::HSeparator,
- $table1,
- new Gtk2::HSeparator,
- gtkadd(Gtk2::Frame->new(N("Parameters")), $vbox2),
- new Gtk2::HSeparator,
- gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
- $button_ok,
- $button_cancel,
- ),
- ),
- );
-
- $window->show_all->main;
-}
-sub new_dialog() {
- my $dialog = new Gtk2::Dialog();
- $dialog->set_position('center-on-parent');
- $dialog->vbox->set_border_width(10);
- $dialog->signal_connect(delete_event => sub { Gtk2->main_quit });
- $dialog;
+ $window->vbox->pack_start(gtkpack__(new Gtk2::VBox(0, 0),
+ new Gtk2::Label(N("Internet Connection Configuration")),
+ new Gtk2::HSeparator,
+ my $table1 = create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
+ [ Gtk2::Label->new(N("Profile: ")),
+ Gtk2::Label->new(translate($netcnx->{PROFILE})) ],
+ [ Gtk2::Label->new(N("Connection type: ")),
+ Gtk2::Label->new(translate($netcnx->{type})) ],
+ ),
+ new Gtk2::HSeparator,
+ gtkadd(Gtk2::Frame->new(N("Parameters")), $vbox2),
+ ),
+ 1, 1, 0
+ );
+ $window->action_area->pack_start(gtkpack(Gtk2::HButtonBox->new,
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub {
+ each_index {
+ ${$conf_data[$::i][1]} = $infos[2*$::i+1]->get_text if $_;
+ } @mask;
+ update();
+ $button_apply->set_sensitive(1);
+ $window->destroy; Gtk2->main_quit;
+ }),
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'),
+ clicked => sub { $window->destroy; Gtk2->main_quit })
+ ),
+ 1, 1, 0
+ );
+
+ $window->show_all;
+ $window->run;
}