From 0bcef6753fff40efc1638452575b07eb7fb1c4f5 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 9 Aug 2004 01:39:27 +0000 Subject: prefer obj->new rather than new obj for gtk+ widgets --- perl-install/standalone/logdrake | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'perl-install/standalone/logdrake') diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 1c7c75a7e..f1b66e939 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -55,12 +55,12 @@ unless ($::isEmbedded) { } $my_win->{window}->signal_connect(delete_event => \&quit); -my $cal = gtkset_sensitive(new Gtk2::Calendar(), 0); +my $cal = gtkset_sensitive(Gtk2::Calendar->new, 0); my $mday = (localtime(time()))[3]; $cal->select_day($mday); my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my $cal_mode = 0; -my $cal_butt = gtksignal_connect(new Gtk2::CheckButton(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) }); +my $cal_butt = gtksignal_connect(Gtk2::CheckButton->new(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) }); ### menus definition # the menus are not shown @@ -112,7 +112,7 @@ my %files = ( "explanations" => { file => "/var/log/explanations", desc => $explain_title } ); -my $yy = gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("search")) , clicked => \&search),0); +my $yy = gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("search")) , clicked => \&search),0); my $log_text = gtktext_insert(Gtk2::TextView->new, [ [ '' ] ]); @@ -123,29 +123,29 @@ my $refcount_search; my %toggle; gtkadd($my_win->{window}, - gtkpack_(new Gtk2::VBox(0,0), + gtkpack_(Gtk2::VBox->new(0,0), if_(!$isExplain && !$::isEmbedded, 0, N("A tool to monitor your logs")), - if_(!$isFile, 0, gtkadd(new Gtk2::Frame(N("Settings")), - gtkpack__(new Gtk2::VBox(0,2), - gtkpack__(new Gtk2::VBox(0,2), + if_(!$isFile, 0, gtkadd(Gtk2::Frame->new(N("Settings")), + gtkpack__(Gtk2::VBox->new(0,2), + gtkpack__(Gtk2::VBox->new(0,2), # N("Show lines"), - gtkpack__(new Gtk2::HBox(0,0), - " " . N("Matching") . " ", my $e_yes = new Gtk2::Entry(), - " " . N("but not matching") . " ", my $e_no = new Gtk2::Entry() + gtkpack__(Gtk2::HBox->new(0,0), + " " . N("Matching") . " ", my $e_yes = Gtk2::Entry->new, + " " . N("but not matching") . " ", my $e_no = Gtk2::Entry->new ) ), - gtkpack_(new Gtk2::HBox(0,0), - 1, gtkadd(gtkset_border_width(new Gtk2::Frame(N("Choose file")),2), + gtkpack_(Gtk2::HBox->new(0,0), + 1, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Choose file")),2), gtkpack(gtkset_border_width(Gtk2::VBox->new(0,0),0), - map { $toggle{$_} = gtksignal_connect(new Gtk2::CheckButton($files{$_}{desc}), + map { $toggle{$_} = gtksignal_connect(Gtk2::CheckButton->new($files{$_}{desc}), clicked => sub { $refcount_search++; gtkset_sensitive($yy, $refcount_search); }) } sort keys %files, ) ), - 0, gtkadd(gtkset_border_width(new Gtk2::Frame(N("Calendar")),2), - gtkpack__(gtkset_border_width(new Gtk2::VBox(0,0),5), + 0, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Calendar")),2), + gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0),5), $cal_butt, $cal ) ) @@ -154,11 +154,11 @@ gtkadd($my_win->{window}, ) ) ), - !$isExplain ? (1, gtkadd(new Gtk2::Frame(N("Content of the file")), + !$isExplain ? (1, gtkadd(Gtk2::Frame->new(N("Content of the file")), create_scrolled_window($log_text) )) : (1, create_scrolled_window($log_text)), if_(!$isExplain, 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5), - if_(!$isFile, gtksignal_connect(new Gtk2::Button(N("Mail alert")), + if_(!$isFile, gtksignal_connect(Gtk2::Button->new(N("Mail alert")), clicked => sub { eval { alert_config() }; my $err = $@; @@ -215,10 +215,10 @@ sub parse_file { $file =~ s/\.gz$//; my ($pbar, $win_pb); unless ($::isEmbedded && $isExplain) { - gtkadd($win_pb = gtkset_modal(new Gtk2::Window('toplevel'), 1), - gtkpack(new Gtk2::VBox(2,0), - new Gtk2::Label(" " . N("please wait, parsing file: %s", $descr) . " "), - $pbar = new Gtk2::ProgressBar() + gtkadd($win_pb = gtkset_modal(Gtk2::Window->new('toplevel'), 1), + gtkpack(Gtk2::VBox->new(2,0), + Gtk2::Label->new(" " . N("please wait, parsing file: %s", $descr) . " "), + $pbar = Gtk2::ProgressBar->new ) ); $win_pb->set_transient_for($my_win->{rwindow}) unless $::isEmbedded; @@ -311,7 +311,7 @@ sub logcolorize { } # Extract PID if present if ($rec[1] =~ /\[(\d+)\]:/) { - my ($pid) = $1; + my $pid = $1; $rec[1] =~ s/\[$1\]://; log_output($rec[1] . "[", undef, 'green'); log_output($pid, 'Bold', 'black'); -- cgit v1.2.1