From 4744d41537604f28b948e3400d7695aa4309bf41 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 27 Sep 2007 14:34:42 +0000 Subject: (get_html_file) - split it out of ask_fromW(), - use it in load_from_uri() so that we try translated links first (#33679) --- perl-install/install/NEWS | 3 +++ perl-install/interactive/gtk.pm | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 3c0b99c79..761b03f59 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- help: + o try translated links first (#33679) + Version 10.4.216 - 27 September 2007, by Pascal "Pixel" Rigaux - allow to choose countries like "Angola" which have no locale (en_AO) in the diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 6044273d6..c0775d2ba 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -702,7 +702,7 @@ my $help_path = "/usr/share/doc/installer-help"; sub load_from_uri { my ($document, $url) = @_; - $url = "$help_path/$url" if $url !~ m!^/!; + $url = get_html_file($::o, $url); my $str = scalar(cat_($url)); c::set_tagged_utf8($str); $document->clear; @@ -710,6 +710,16 @@ sub load_from_uri { $document->write_stream($str); } +sub get_html_file { + my ($o, $url) = @_; + find { -e $_ } map { "$help_path/${_}" } + map { + my $id = $_; + require lang; + map { ("$_/$id") } (split ':', lang::getLANGUAGE($o->{locale}{lang})); + } $url; +} + sub ask_fromW { my ($o, $common, $l) = @_; @@ -728,13 +738,7 @@ sub ask_fromW { my @more_buttons = ( if_($common->{interactive_help}, [ N("Help"), sub { - if (my $file = find { -e $_ } map { "$help_path/${_}.html" } - map { - my $id = $_; - require lang; - map { "$_/$id" } (split ':', lang::getLANGUAGE($o->{locale}{lang})); - } $common->{interactive_help_id} - ) { + if (my $file = $common->{interactive_help_id}) { require Gtk2::Html2; my $view = Gtk2::Html2::View->new; my $document = Gtk2::Html2::Document->new; @@ -746,7 +750,7 @@ sub ask_fromW { $document->signal_connect('link-clicked' => \&load_from_uri); $view->set_document($document); - load_from_uri($document, $file); + load_from_uri($document, "$file.html"); my $w = ugtk2->new(N("Help"), transient => $mainw->{real_window}, modal => 1); gtkadd($w->{rwindow}, -- cgit v1.2.1