summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlogdrake56
1 files changed, 43 insertions, 13 deletions
diff --git a/logdrake b/logdrake
index 7f063b28..b4cb09ae 100755
--- a/logdrake
+++ b/logdrake
@@ -39,12 +39,12 @@ use Config;
init Gtk;
# for i18n
-sub _ {
- my $s = shift @_; my $t = I_($s);
- $t && ref $t or return sprintf $t, @_;
- my ($T, @p) = @$t;
- sprintf $T, @_[@p];
-}
+#sub _ {
+# my $s = shift @_; my $t = I_($s);
+# $t && ref $t or return sprintf $t, @_;
+# my ($T, @p) = @$t;
+# sprintf $T, @_[@p];
+#}
$::isInstall and die "Not supported during install.\n";
@@ -141,6 +141,7 @@ my $col=$cyan;
######### font and colors end
+
# Create root tree
my $tree = new Gtk::Tree();
my $leaf;
@@ -151,12 +152,18 @@ fill_tree ("");
#### far from window
-
gtkadd($window,
gtkpack_(new Gtk::VBox(0,5),
0, _("see your log"),
1, gtkadd(new Gtk::Frame(_("Choose a file")),
- createScrolledWindow($tree)
+ gtkpack_(new Gtk::VBox(0,5),
+ 1, createScrolledWindow($tree),
+ 0, gtkpack(new Gtk::HBox(0,5),
+ gtksignal_connect(new Gtk::Button(_("syslog")), clicked => \&select_item, "/var/log/syslog"),
+ gtksignal_connect(new Gtk::Button(_("dmesg")), clicked => \&select_item, "/var/log/dmesg"),
+ gtksignal_connect(new Gtk::Button(_("user.log")), clicked => \&select_item, "/var/log/user.log")
+ )
+ )
),
1, gtkadd(new Gtk::Frame(_("Content of the file")),
createScrolledWindow(my $log = new Gtk::Text(undef, undef))
@@ -164,10 +171,10 @@ gtkadd($window,
)
);
+
$window->realize;
$window->show_all();
-
Gtk->main_iteration while Gtk->events_pending;
$::isEmbedded and kill USR2, $::CCPID;
Gtk->main;
@@ -243,13 +250,33 @@ sub collapse_tree {
sub select_item {
my ($widget, $file) = @_;
return if (-d $file);
+
$log->backward_delete($log->get_length());
$file =~ s/\.gz$//;
$log->freeze();
- foreach (catMaybeCompressed ($file)){
+ my @all=catMaybeCompressed ($file);
+ my $taille= @all +1;
+ my $i=1;
+ gtkadd(my $win_pb = new Gtk::Window(),
+ gtkpack(new Gtk::VBox(5,0),
+ _("please wait"),
+ my $pbar = new Gtk::ProgressBar()
+ )
+ );
+ $win_pb->realize();
+ $win_pb->show_all();
+
+ foreach (@all) {
+ if ($i % 10) {
+ $pbar->update($i/$taille);
+ Gtk->main_iteration while Gtk->events_pending;
+ }
logcolorize($_);
+ $i++;
+
}
$log->thaw();
+ $win_pb->destroy();
}
sub log_output {
@@ -296,9 +323,9 @@ sub logcolorize {
foreach (@word_note) { $col=$col_note if ($_ eq $rec[$therest]);}
# Watch for words that indicate entire lines should be highlighted
- foreach (@line_good) { $col=$col_good if ($_ eq $rec[$therest]);}
- foreach (@line_warn) { $col=$col_warn if ($_ eq $rec[$therest]);}
- foreach (@line_bad) { $col=$col_bad if ($_ eq $rec[$therest]);}
+ #foreach (@line_good) { $col=$col_good if ($_ eq $rec[$therest]);}
+ #foreach (@line_warn) { $col=$col_warn if ($_ eq $rec[$therest]);}
+ #foreach (@line_bad) { $col=$col_bad if ($_ eq $rec[$therest]);}
log_output($col,"$rec[$therest] ",$n);
}
@@ -363,6 +390,9 @@ sub destroy_window {
# log
# $Log$
+# Revision 1.7 2001/07/16 16:48:21 yduret
+# update
+#
# Revision 1.6 2001/07/03 19:40:48 pablo
# updated Danish file,
# i18n'd logdrake