summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-08-26 13:39:16 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-08-26 13:39:16 +0000
commit169661b0aca4c2372c192276c2fbfcf6ac7ceaa0 (patch)
tree0ae4789dab7a10ceef3701c29dafbf97bb19642b /perl-install
parent04b9e7ca9c0a33a926cc0e0bd07c0a21029c01f3 (diff)
downloaddrakx-169661b0aca4c2372c192276c2fbfcf6ac7ceaa0.tar
drakx-169661b0aca4c2372c192276c2fbfcf6ac7ceaa0.tar.gz
drakx-169661b0aca4c2372c192276c2fbfcf6ac7ceaa0.tar.bz2
drakx-169661b0aca4c2372c192276c2fbfcf6ac7ceaa0.tar.xz
drakx-169661b0aca4c2372c192276c2fbfcf6ac7ceaa0.zip
enfore gc style for gtk+2 widgets creation
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakconnect91
1 files changed, 45 insertions, 46 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 8acd2b292..b015e9956 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -63,7 +63,7 @@ MDK::Common::Globals::init(
$::isEmbedded && ref($in) =~ /gtk/ or goto dd;
require ugtk2;
-ugtk2->import(qw(:helpers :wrappers :create));
+ugtk2->import(qw(:create :dialogs :helpers :wrappers));
network::netconnect::read_net_conf('', $netcnx, $netc);
modules::load_category('net');
my @all_cards = network::ethernet::conf_network_card_backend($netc, $intf);
@@ -79,16 +79,16 @@ unless ($::isEmbedded) {
}
$window1->{rwindow}->set_border_width(10);
-my $combo1 = new Gtk2::OptionMenu;
+my $combo1 = Gtk2::OptionMenu->new;
$combo1->set_popdown_strings(network::netconnect::get_profiles());
my $old_profile = $netcnx->{PROFILE};
$combo1->entry->set_text($netcnx->{PROFILE} || "default");
-my $button_del = new Gtk2::Button(N("Del profile..."));
+my $button_del = Gtk2::Button->new(N("Del profile..."));
$button_del->signal_connect(clicked => sub {
my $dialog = _create_dialog(N("Delete profile"));
gtkpack($dialog->vbox,
Gtk2::Label->new(N("Profile to delete:")),
- my $combo_dialog = new Gtk2::OptionMenu,
+ my $combo_dialog = Gtk2::OptionMenu->new,
);
$combo_dialog->set_popdown_strings(grep { ! /default/ } network::netconnect::get_profiles());
gtkpack($dialog->action_area,
@@ -108,13 +108,13 @@ $button_del->signal_connect(clicked => sub {
apply();
});
$button_del->set_sensitive(network::netconnect::get_profiles() > 1);
-my $button_new = new Gtk2::Button(N("New profile..."));
+my $button_new = Gtk2::Button->new(N("New profile..."));
$button_new->signal_connect(clicked => sub {
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(Gtk2::Label->new(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 = Gtk2::Entry->new;
$dialog->vbox->pack_start($entry_dialog,1,1,0);
- my $bbox_dialog = new Gtk2::HButtonBox;
+ my $bbox_dialog = Gtk2::HButtonBox->new;
$dialog->action_area->add($bbox_dialog);
$bbox_dialog->set_layout('end');
my $button_ok = Gtk2::Button->new(N("Ok"));
@@ -135,12 +135,12 @@ $button_new->signal_connect(clicked => sub {
});
my $hostname = chomp_(`hostname`);
-my $type_label = new Gtk2::Label($netcnx->{type});
-my $int_label = new Gtk2::Label($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
-my $interface_name = new Gtk2::Label($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
+my $type_label = Gtk2::Label->new($netcnx->{type});
+my $int_label = Gtk2::Label->new($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
+my $interface_name = Gtk2::Label->new($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
my $isconnected = -1;
-my $warning_label1 = new Gtk2::Label("");
-my $int_connect = new Gtk2::Button(N("Wait please"));
+my $warning_label1 = Gtk2::Label->new("");
+my $int_connect = Gtk2::Button->new(N("Wait please"));
$int_connect->set_sensitive(0);
$int_connect->signal_connect(clicked => sub {
if (!$isconnected) {
@@ -181,7 +181,7 @@ $window1->{window}->add(
gtkpack_(Gtk2::VBox->new(0,10),
if_($activate_profile,
0, gtkpack_(Gtk2::HBox->new(0,0),
- 0, new Gtk2::Label(N("Profile: ")),
+ 0, Gtk2::Label->new(N("Profile: ")),
0, $combo1,
0, $button_del,
0, $button_new,
@@ -189,8 +189,8 @@ $window1->{window}->add(
),
0, gtkpack_(Gtk2::HBox->new(1,0),
0, gtkpack_(Gtk2::HBox->new(0,0),
- 0, new Gtk2::Label(N("Hostname: ")),
- 0, $label_host = new Gtk2::Label($hostname),
+ 0, Gtk2::Label->new(N("Hostname: ")),
+ 0, $label_host = Gtk2::Label->new($hostname),
),
0, gtksignal_connect(Gtk2::Button->new(N("Configure hostname...")),
clicked => \&configure_hostname),
@@ -198,7 +198,7 @@ $window1->{window}->add(
0, gtkadd(Gtk2::Frame->new(N("Internet access")),
gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5),
1, gtkset_border_width(create_packtable({ col_spacings => 5, row_spacings => 5 },
- [ new Gtk2::Label(N("Type:")), $type_label ],
+ [ Gtk2::Label->new(N("Type:")), $type_label ],
[ $int_label, $interface_name ],
[ Gtk2::Label->new(N("Status:")),
$int_state = Gtk2::Label->new(N("Testing your connection...")) ]
@@ -215,8 +215,8 @@ $window1->{window}->add(
1, gtkadd(Gtk2::Frame->new(N("LAN configuration")),
gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5),
0, $list,
- 0, new Gtk2::HBox(0,0),
- 0, gtkpack_(new Gtk2::HBox(0, 0),
+ 0, Gtk2::HBox->new(0,0),
+ 0, gtkpack_(Gtk2::HBox->new(0, 0),
0, $lan_button = gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")),
clicked => \&configure_lan),
),
@@ -225,14 +225,13 @@ $window1->{window}->add(
0, gtkadd(Gtk2::HButtonBox->new,
$wiz_button = gtksignal_connect(Gtk2::Button->new(N("Launch the wizard")),
clicked => sub {
- my $err = $$;
$wizard_pid = fork();
if (defined $wizard_pid) {
# immediate exit, else forked gtk+ object destructors will badly catch up parent drakconnect
!$wizard_pid and do { exec("drakconnect") or POSIX::_exit(1) };
sensitive_buttons(0);
} else {
- error_dialog(N("Unable to fork: %s", "$!"));
+ err_dialog(N("Unable to fork: %s", "$!"));
}
}),
),
@@ -406,10 +405,10 @@ sub configure_hostname() {
my $window = _create_dialog(N("Hostname configuration"), { small => 1 });
$window->set_border_width(10);
- $window->vbox->pack_start(new Gtk2::Label(N("Hostname configuration")), 1, 1, 0);
- $window->vbox->pack_start(my $hbox = new Gtk2::HBox(0,0), 1, 0, 0);
+ $window->vbox->pack_start(Gtk2::Label->new(N("Hostname configuration")), 1, 1, 0);
+ $window->vbox->pack_start(my $hbox = Gtk2::HBox->new(0,0), 1, 0, 0);
$hbox->set_border_width(10);
- $hbox->pack_start(new Gtk2::Label(N("Hostname")), 0, 1, 0);
+ $hbox->pack_start(Gtk2::Label->new(N("Hostname")), 0, 1, 0);
$hbox->pack_start(my $entry = Gtk2::Entry->new_with_text($netc->{HOSTNAME}), 0, 1, 0);
$window->action_area->pack_start(gtkpack(Gtk2::HButtonBox->new,
@@ -447,7 +446,7 @@ sub configure_lan() {
my @card_tab;
if (@all_cards < 1) {
- $window->vbox->pack_start(new Gtk2::Label(N("You don't have any configured interface.
+ $window->vbox->pack_start(Gtk2::Label->new(N("You don't have any configured interface.
Configure them first by clicking on 'Configure'")),1,1,0);
$window->action_area->add(gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
gtksignal_connect(Gtk2::Button->new(N("Ok")),
@@ -461,12 +460,12 @@ Configure them first by clicking on 'Configure'")),1,1,0);
}
$window->set_border_width(10);
- $window->vbox->pack_start(my $vbox0 = new Gtk2::VBox(0,0),
+ $window->vbox->pack_start(my $vbox0 = Gtk2::VBox->new(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(Gtk2::Label->new(N("LAN Configuration")),0,1,0);
+ my $notebook = Gtk2::Notebook->new;
$vbox0->pack_start($notebook,0,1,0);
foreach (0..$#all_cards) {
@@ -475,9 +474,9 @@ Configure them first by clicking on 'Configure'")),1,1,0);
$card_tab[2*$_] = \@infos;
$card_tab[2*$_+1] = \@conf_data;
- my $vbox_local = new Gtk2::VBox(0,0);
+ my $vbox_local = Gtk2::VBox->new(0,0);
$vbox_local->set_border_width(10);
- $vbox_local->pack_start(new Gtk2::Label(N("Adapter %s: %s", $_+1 , $all_cards[$_][0])),1,1,0);
+ $vbox_local->pack_start(Gtk2::Label->new(N("Adapter %s: %s", $_+1 , $all_cards[$_][0])),1,1,0);
# Eth${_}Hostname = $netc->{HOSTNAME}
# Eth${_}HostAlias = " . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . "
# Eth${_}Driver = $all_cards[$_]->[1]
@@ -494,14 +493,14 @@ Configure them first by clicking on 'Configure'")),1,1,0);
my $size_group = Gtk2::SizeGroup->new('horizontal');
foreach my $j (@conf_data) {
- my $l = new Gtk2::Label($j->[0]);
+ my $l = Gtk2::Label->new($j->[0]);
$l->set_justify('left');
$infos[2*$i] = gtkpack_(Gtk2::HBox->new,
1, $l);
$vbox_local->pack_start($infos[2*$i], 1, 1, 0);
my $c;
if (defined $j->[2]) {
- $c = new Gtk2::OptionMenu;
+ $c = Gtk2::OptionMenu->new;
$c->set_popdown_strings(@{$j->[2]});
$infos[2*$i+1] = $c->entry;
$infos[2*$i]->pack_start($c,0,0,0);
@@ -516,7 +515,7 @@ Configure them first by clicking on 'Configure'")),1,1,0);
my $widget_temp;
if (-e "$::prefix/etc/sysconfig/network-scripts/ifcfg-$interface") {
- $widget_temp = gtksignal_connect(new Gtk2::Button(get_intf_status($interface)),
+ $widget_temp = gtksignal_connect(Gtk2::Button->new(get_intf_status($interface)),
clicked => sub {
system("/sbin/if" . (ethisup($interface) ? "down" : "up") . " $interface");
$_[0]->set_label(get_intf_status($interface));
@@ -525,14 +524,14 @@ Configure them first by clicking on 'Configure'")),1,1,0);
} else {
$widget_temp = N("This interface has not been configured yet.\nLaunch the configuration wizard in the main window");
}
- $vbox_local->pack_start(gtkpack__(new Gtk2::HBox(0,0),
+ $vbox_local->pack_start(gtkpack__(Gtk2::HBox->new(0,0),
$widget_temp
),0,0,0);
# $list->append($_+1, $interface, $intf->{$interface}{IPADDR}, $intf->{$interface}{BOOTPROTO}, $all_cards[$_]->[1]);
# $list->set_selectable($_, 0);
$notebook->append_page($vbox_local, Gtk2::Label->new($interface));
}
- my $bbox8 = new Gtk2::HButtonBox;
+ my $bbox8 = Gtk2::HButtonBox->new;
$vbox0->pack_start($bbox8,0,0,10);
$bbox8->set_layout('end');
@@ -588,9 +587,9 @@ sub configure_net {
};
if (!$netcnx->{type}) {
$dialog = _create_dialog(N("LAN configuration"));
- $dialog->vbox->pack_start(new Gtk2::Label(N("You don't have an Internet connection.
+ $dialog->vbox->pack_start(Gtk2::Label->new(N("You don't have an Internet connection.
Create one first by clicking on 'Configure'")),1,1,0);
- my $bbox_dialog = new Gtk2::HButtonBox;
+ my $bbox_dialog = Gtk2::HButtonBox->new;
$dialog->action_area->add($bbox_dialog);
$bbox_dialog->set_layout('end');
my $button_ok = Gtk2::Button->new(N("Ok"));
@@ -607,7 +606,7 @@ Create one first by clicking on 'Configure'")),1,1,0);
$dialog->signal_connect(delete_event => $exit_dialogsub);
$dialog->set_border_width(10);
- my $vbox2 = new Gtk2::VBox(0,0);
+ my $vbox2 = Gtk2::VBox->new(0,0);
my $i = 0;
my @mask;
@mask = (0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0) if $netcnx->{type} eq 'lan';
@@ -655,18 +654,18 @@ Create one first by clicking on 'Configure'")),1,1,0);
$i++;
next;
}
- $infos[2*$i] = new Gtk2::HBox(0,0);
- my $l = new Gtk2::Label($_->[0]);
+ $infos[2*$i] = Gtk2::HBox->new(0,0);
+ my $l = Gtk2::Label->new($_->[0]);
$l->set_justify('left');
$infos[2*$i]->pack_start($l, 0, 0, 0);
$vbox2->pack_start($infos[2*$i], 0, 0, 0);
if (defined $_->[2]) {
- my $c = new Gtk2::Combo();
+ my $c = Gtk2::Combo->new;
$c->set_popdown_strings(@{$_->[2]});
$infos[2*$i+1] = $c->entry;
$infos[2*$i]->pack_start($c,0 , 0, 0);
} else {
- $infos[2*$i+1] = new Gtk2::Entry();
+ $infos[2*$i+1] = Gtk2::Entry->new;
$infos[2*$i]->pack_start($infos[2*$i+1], 0, 0, 0);
#hide password if Entry Password
if ($_->[0] eq N("Account Password") || $_->[0] eq N("Password")) { $infos[2*$i+1]->set_visibility(0) };
@@ -675,16 +674,16 @@ Create one first by clicking on 'Configure'")),1,1,0);
$i++;
}
- gtkpack(new Gtk2::VBox(0, 0),
- new Gtk2::Label(N("Internet Connection Configuration")),
- new Gtk2::HSeparator,
+ gtkpack(Gtk2::VBox->new(0, 0),
+ Gtk2::Label->new(N("Internet Connection Configuration")),
+ Gtk2::HSeparator->new,
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,
+ Gtk2::HSeparator->new,
gtkadd(Gtk2::Frame->new(N("Parameters")), $vbox2),
);
gtkpack($dialog->action_area,