From a4aca13e1a42b4db1c958f879721ca9abb03086f Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 6 Oct 2008 19:08:10 +0000 Subject: (run_help_callback) factorize code --- Rpmdrake/gui.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index a5ffbfe4..f65007f7 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -151,10 +151,7 @@ sub format_pkg_simplifiedinfo { '')); # extra empty line if ($is_update) { push @$s, [ my $link = gtkshow(Gtk2::LinkButton->new($update_descr->{URL}, N("Security advisory"))) ]; - $link->set_uri_hook(sub { - my (undef, $url) = @_; - run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url); - }); + $link->set_uri_hook(\&run_help_callback); } push @$s, @{ ugtk2::markup_to_TextView_format(join("\n", @@ -187,10 +184,7 @@ sub format_pkg_simplifiedinfo { push @$details_txt, @{ ugtk2::markup_to_TextView_format(format_field("\n$spacing" . N("URL: "))) }, [ my $link = gtkshow(Gtk2::LinkButton->new($url, $url)) ]; - $link->set_uri_hook(sub { - my (undef, $url) = @_; - run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url); - }); + $link->set_uri_hook(\&run_help_callback); } push @$s, [ gtkadd(gtkshow(my $exp0 = Gtk2::Expander->new(format_field(N("Details:")))), @@ -918,4 +912,9 @@ sub sort_callback { URPM::rpmvercmp(map { $store->get_value($_, $pkg_columns{version}) } $treeiter1, $treeiter2); } +sub run_help_callback { + my (undef, $url) = @_; + run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url); +} + 1; -- cgit v1.2.1