diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-10 14:28:20 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-10 14:28:20 +0000 |
commit | 2335feed4d37ced1c5851f634c1fe8eddb6acc5a (patch) | |
tree | 9c38755eef03591ec50f8373adfa8257c4647c81 | |
parent | fb2479ca2771f18f799e89c6e08c5a04bc80ec6d (diff) | |
download | rpmdrake-2335feed4d37ced1c5851f634c1fe8eddb6acc5a.tar rpmdrake-2335feed4d37ced1c5851f634c1fe8eddb6acc5a.tar.gz rpmdrake-2335feed4d37ced1c5851f634c1fe8eddb6acc5a.tar.bz2 rpmdrake-2335feed4d37ced1c5851f634c1fe8eddb6acc5a.tar.xz rpmdrake-2335feed4d37ced1c5851f634c1fe8eddb6acc5a.zip |
- add the possibility to view more infos on each package, when
presenting a list of deps
- factorize the packtable code of rpmnew dialog and more infos on package
-rwxr-xr-x | rpmdrake | 71 | ||||
-rw-r--r-- | rpmdrake.pm | 30 | ||||
-rw-r--r-- | rpmdrake.spec | 2 |
3 files changed, 69 insertions, 34 deletions
@@ -346,10 +346,28 @@ or you already installed all of them.")); my @nodes_with_deps; my $deps_msg = sub { my ($title, $msg, $nodes, $nodes_with_deps) = @_; - my @deps = difference2($nodes_with_deps, $nodes); + my @deps = sort { $a cmp $b } difference2($nodes_with_deps, $nodes); @deps > 0 or return 1; - interactive_msg_($title, $msg . $formatlistpkg->(sort { $a cmp $b } @deps), - yesno => 1, text => { yes => N("Ok"), no => N("Cancel") }); + deps_msg_again: + my $results = interactive_msg_($title, $msg . $formatlistpkg->(@deps), + yesno => [ N("Ok"), N("More infos"), N("Cancel") ]); + if ($results eq N("More infos")) { + interactive_packtable(N("Information on packages"), + $w->{rwindow}, + undef, + [ map { my $pkg = $_; + [ gtkpack__(Gtk2::HBox->new(0, 0), gtkset_selectable(Gtk2::Label->new($pkg), 1)), + gtksignal_connect(Gtk2::Button->new(N("More information on package...")), + clicked => sub { + interactive_msg(N("More information on package..."), + $options->{get_info}->($pkg), scroll => 1) + }) ] } @deps ], + [ gtksignal_connect(Gtk2::Button->new(N("Ok")), + clicked => sub { Gtk2->main_quit }) ]); + goto deps_msg_again; + } else { + return $results eq N("Ok"); + } }; if ($MODE eq 'remove') { if ($new_state) { @@ -837,11 +855,10 @@ sub dialog_rpmnew { @{$p2r{$_}} = grep { !member($_, @ignores_rpmnew) } @{$p2r{$_}} foreach keys %p2r; my $sum_rpmnew = sum(map { int @{$p2r{$_}} } keys %p2r); $sum_rpmnew == 0 and return 1; - my $d = ugtk2->new(N("Installation finished")); my @inspect_wsize = ($typical_width*2.5, 500); my $inspect = sub { my ($file) = @_; - my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1); + my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1, transient => $w->{rwindow}); my $save_wsize = sub { @inspect_wsize = $d->{rwindow}->get_size }; my ($rpmnew, $rpmsave) = ("$file.rpmnew", "$file.rpmsave"); my $rpmfile = 'rpmnew'; @@ -879,31 +896,25 @@ sub dialog_rpmnew { $d->{rwindow}->set_default_size(@inspect_wsize); $d->main; }; - my $packtable = create_packtable({}, - map { my $pkg = $_; - map { - my $f = $_; - my $b; - [ gtkpack__(Gtk2::HBox->new(0, 0), - gtkset_markup(gtkset_selectable(Gtk2::Label->new, 1), - "$pkg:<span font_desc=\"monospace\">$f</span>")), - $b = gtksignal_connect(Gtk2::Button->new(but(N("Inspect..."))), - clicked => sub { - $inspect->($f); - -r "$f.rpmnew" || -r "$f.rpmsave" or $b->set_sensitive(0) - }) ] - } @{$p2r{$pkg}} - } keys %p2r); - gtkadd($d->{window}, - gtkpack_(Gtk2::VBox->new(0,5), - 0, Gtk2::Label->new($msg), - 1, create_scrolled_window($packtable), - 0, gtkpack__(create_hbox(), gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit })))); - my ($xpreq, $ypreq) = $packtable->size_request->values; - my ($xwreq, $ywreq) = $d->{rwindow}->size_request->values; - $d->{rwindow}->set_default_size(max($typical_width, min($typical_width*2.5, $xpreq+$xwreq)), - max(200, min(450, $ypreq+$ywreq))); - $d->main; + + interactive_packtable(N("Installation finished"), + $w->{rwindow}, + $msg, + [ map { my $pkg = $_; + map { + my $f = $_; + my $b; + [ gtkpack__(Gtk2::HBox->new(0, 0), + gtkset_markup(gtkset_selectable(Gtk2::Label->new, 1), + "$pkg:<span font_desc=\"monospace\">$f</span>")), + gtksignal_connect($b = Gtk2::Button->new(N("Inspect...")), clicked => sub { + $inspect->($f); + -r "$f.rpmnew" || -r "$f.rpmsave" or $b->set_sensitive(0) + }) ] + } @{$p2r{$pkg}} + } keys %p2r ], + [ gtksignal_connect(Gtk2::Button->new(N("Ok")), + clicked => sub { Gtk2->main_quit }) ]); return 0; } diff --git a/rpmdrake.pm b/rpmdrake.pm index ae335e27..aa4dbca8 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -86,15 +86,37 @@ sub interactive_msg { $typical_width*2, 300)) : Gtk2::Label->new($contents), 0, gtkpack(create_hbox(), - $options{yesno} ? (gtksignal_connect(Gtk2::Button->new($options{text}{yes} || N("Yes")), - clicked => sub { $d->{retval} = 1; Gtk2->main_quit }), - gtksignal_connect(Gtk2::Button->new($options{text}{no} || N("No")), - clicked => sub { $d->{retval} = 0; Gtk2->main_quit })) + ref($options{yesno}) eq 'ARRAY' ? map { + my $label = $_; + gtksignal_connect(Gtk2::Button->new($label), clicked => sub { $d->{retval} = $label; Gtk2->main_quit }) + } @{$options{yesno}} + : $options{yesno} ? (gtksignal_connect(Gtk2::Button->new($options{text}{yes} || N("Yes")), + clicked => sub { $d->{retval} = 1; Gtk2->main_quit }), + gtksignal_connect(Gtk2::Button->new($options{text}{no} || N("No")), + clicked => sub { $d->{retval} = 0; Gtk2->main_quit })) : gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit }) ))); $d->main; } +sub interactive_packtable { + my ($title, $parent_window, $top_label, $lines, $action_buttons) = @_; + + my $w = ugtk2->new($title, grab => 1, transient => $parent_window); + my $packtable = create_packtable({}, @$lines); + + gtkadd($w->{window}, + gtkpack_(Gtk2::VBox->new(0, 5), + if_($top_label, 0, Gtk2::Label->new($top_label)), + 1, create_scrolled_window($packtable), + 0, gtkpack__(create_hbox(), @$action_buttons))); + my ($xpreq, $ypreq) = $packtable->size_request->values; + my ($xwreq, $ywreq) = $w->{rwindow}->size_request->values; + $w->{rwindow}->set_default_size(max($typical_width, min($typical_width*2.5, $xpreq+$xwreq)), + max(200, min(450, $ypreq+$ywreq))); + $w->main; +} + sub interactive_list { my ($title, $contents, $list, $callback, %options) = @_; my $d = ugtk2->new($title, grab => 1, if_(exists $options{transient}, transient => $options{transient})); diff --git a/rpmdrake.spec b/rpmdrake.spec index 79378002..d3364dde 100644 --- a/rpmdrake.spec +++ b/rpmdrake.spec @@ -126,6 +126,8 @@ rm -rf $RPM_BUILD_ROOT - try to have a more sensible default size for the rpmnew dialog - fix "Can't call method set_sensitive on an undefined value" stopping the program after resolving a rpmnew + - add the possibility to view more infos on each package, when + presenting a list of deps * Wed Jan 8 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-1mdk - gtk2 (possibly contains important breakages, use with care) |