diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-09-25 13:37:01 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-09-25 13:37:01 +0000 |
commit | 119bdfcb4ab55c942d8dee1763ca182a085c9031 (patch) | |
tree | 9d9000160b94f6f16f15eb77794680f754e5d14a | |
parent | 90e958a2a29327f91ae9972676e85b68aa63731d (diff) | |
download | control-center-119bdfcb4ab55c942d8dee1763ca182a085c9031.tar control-center-119bdfcb4ab55c942d8dee1763ca182a085c9031.tar.gz control-center-119bdfcb4ab55c942d8dee1763ca182a085c9031.tar.bz2 control-center-119bdfcb4ab55c942d8dee1763ca182a085c9031.tar.xz control-center-119bdfcb4ab55c942d8dee1763ca182a085c9031.zip |
(build_widget_element) split it out of build_list()
-rwxr-xr-x | control-center | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/control-center b/control-center index 0f878dd4..4fa51d37 100755 --- a/control-center +++ b/control-center @@ -780,6 +780,32 @@ sub clean_list { } @$subtree; } +sub build_widget_element { + my ($label) = @_; + my $icon = $programs{$label}{icon}; + + die "$label 's icon is missing" if !$programs{$label} && $::testing; + $tool_callbacks{$label} = sub { + run_tool($label, undef, #$event_box, + $icon, $programs{$label}{description}, $programs{$label}); + }; + # FIX ME: DO THIS AGAIN: + $tool_feedback{$label} = sub {}; #sub { $event_box->window && $event_box->window->set_cursor($hand_cursor) }; + my $real_icon = $icon ? '<IMG SRC="' . ugtk2::_find_imgfile($icon) . '">' : ''; + my @widgets = ( + qq(<TD>$real_icon</TD>), + qq(<TD style="text-align: $align"><DIV>) + . escape_text_for_TextView_markup_format($programs{$label}{description}) + . qq(</DIV></TD>) + ); + @widgets = reverse @widgets if mygtk2::text_direction_rtl(); + qq(<TD WIDTH="49%"> +<A HREF="$label"><TABLE align="$align2"><TR> +@widgets +</TR></TABLE></A></TD> +); +} + sub build_list() { my $i; foreach (@tree) { @@ -856,31 +882,7 @@ foreach (@tree) { map { "<TR>" . join("\n", grep { defined $_ } @$_) . "</TR>" } # "<TR>" . join("\n<TD> </TD>\n", grep { defined $_ } @$_) . "</TR>" } - group_by(2, map { - my $label = $_; - my $icon = $programs{$label}{icon}; - - die "$label 's icon is missing" if !$programs{$label} && $::testing; - $tool_callbacks{$label} = sub { - run_tool($label, undef, #$event_box, - $icon, $programs{$label}{description}, $programs{$label}); - }; - # FIX ME: DO THIS AGAIN: - $tool_feedback{$label} = sub {}; #sub { $event_box->window && $event_box->window->set_cursor($hand_cursor) }; - my $real_icon = $icon ? '<IMG SRC="' . ugtk2::_find_imgfile($icon) . '">' : ''; - my @widgets = ( - qq(<TD>$real_icon</TD>), - qq(<TD style="text-align: $align"><DIV>) - . escape_text_for_TextView_markup_format($programs{$label}{description}) - . qq(</DIV></TD>) - ); - @widgets = reverse @widgets if mygtk2::text_direction_rtl(); - qq(<TD WIDTH="49%"> -<A HREF="$label"><TABLE align="$align2"><TR> -@widgets -</TR></TABLE></A></TD> -); - } @{$subtree->{list}}) + group_by(2, map { build_widget_element($_) } @{$subtree->{list}}) ); $string .= "</TABLE>\n"; |