diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-07-29 10:34:37 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-07-29 10:34:37 +0000 |
commit | 68a3a0cdbde66767ab43082fecc3ea6f5c848c87 (patch) | |
tree | 9a42333c54b20261d25abf1c52ac8bac711aad58 /rpmdrake.pm | |
parent | 0f7a250be03619e52dfc1bcc5082b37b3dc38752 (diff) | |
download | rpmdrake-68a3a0cdbde66767ab43082fecc3ea6f5c848c87.tar rpmdrake-68a3a0cdbde66767ab43082fecc3ea6f5c848c87.tar.gz rpmdrake-68a3a0cdbde66767ab43082fecc3ea6f5c848c87.tar.bz2 rpmdrake-68a3a0cdbde66767ab43082fecc3ea6f5c848c87.tar.xz rpmdrake-68a3a0cdbde66767ab43082fecc3ea6f5c848c87.zip |
Move a load of popup messages in a status bar.
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r-- | rpmdrake.pm | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm index 6924206f..fa9d2f57 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -65,6 +65,9 @@ our @EXPORT = qw( but but_ slow_func + slow_func_statusbar + statusbar_msg + statusbar_msg_remove choose_mirror make_url_mirror make_url_mirror_dist @@ -319,7 +322,7 @@ sub remove_wait_msg { sub but { " $_[0] " } sub but_ { " $_[0] " } -sub slow_func($&) { +sub slow_func ($&) { my ($param, $func) = @_; if (ref($param) =~ /^Gtk/) { gtkset_mousecursor_wait($param); @@ -333,6 +336,39 @@ sub slow_func($&) { } } +sub statusbar_msg { + unless ($::statusbar) { #- fallback if no status bar + if (defined &::wait_msg_) { goto &::wait_msg_ } else { goto &wait_msg } + } + my ($msg) = @_; + #- always use the same context description for now + my $cx = $::statusbar->get_context_id("foo"); + #- returns a msg_id to be passed optionnally to statusbar_msg_remove + $::statusbar->push($cx, $msg); +} + +sub statusbar_msg_remove { + my ($msg_id) = @_; + if (!$::statusbar || ref $msg_id) { #- fallback if no status bar + goto &remove_wait_msg; + } + my $cx = $::statusbar->get_context_id("foo"); + if (defined $msg_id) { + $::statusbar->remove($cx, $msg_id); + } else { + $::statusbar->pop($cx); + } +} + +sub slow_func_statusbar ($$&) { + my ($msg, $w, $func) = @_; + gtkset_mousecursor_wait($w->window); + my $msg_id = statusbar_msg($msg); + gtkflush(); + $func->(); + statusbar_msg_remove($msg_id); + gtkset_mousecursor_normal($w->window); +} my %u2l = ( at => N("Austria"), |