aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/ManaTools/Rpmdragora/gui.pm39
-rw-r--r--lib/ManaTools/Shared/GUI/ReplacePoint.pm6
-rwxr-xr-xmodules/rpmdragora/rpmdragora32
3 files changed, 46 insertions, 31 deletions
diff --git a/lib/ManaTools/Rpmdragora/gui.pm b/lib/ManaTools/Rpmdragora/gui.pm
index 9a79de3d..4dd2d56b 100644
--- a/lib/ManaTools/Rpmdragora/gui.pm
+++ b/lib/ManaTools/Rpmdragora/gui.pm
@@ -55,6 +55,7 @@ use ManaTools::Shared::RunProgram qw(get_stdout raw);
use yui;
use feature 'state';
use Carp;
+use POSIX qw/uname/;
use Exporter;
our @ISA = qw(Exporter);
@@ -668,6 +669,11 @@ sub add_tree_item {
=item B<$select>: select given package
+=item B<$skip_other_arch>: true if other archs have to be skipped
+
+=head3 OUTPUT
+ return 1 if item is added 0 otherwise
+
=head3 DESCRIPTION
populates the item list for the table view with the given rpm package
@@ -676,7 +682,7 @@ sub add_tree_item {
#=============================================================
sub add_package_item {
- my ($item_list, $pkg_name, $select) = @_;
+ my ($item_list, $pkg_name, $select, $skip_other_arch) = @_;
return if !$pkg_name;
@@ -687,6 +693,9 @@ sub add_package_item {
my $iter;
if (is_a_package($pkg_name)) {
my ($name, $version, $release, $arch) = split_fullname($pkg_name);
+ my ($sysname, $nodename, $rel, $ver, $machine) = POSIX::uname();
+
+ return 0 if $skip_other_arch&& $arch ne $machine && $arch ne "noarch";
$name = "" if !defined($name);
$version = "" if !defined($version);
@@ -711,8 +720,10 @@ sub add_package_item {
}
else {
carp $pkg_name . " is not a leaf package and that is not managed!";
+ return 0;
}
+ return 1;
}
#
@@ -951,14 +962,6 @@ sub fast_toggle {
my $old_status = node_state($name);
- # $DB::single = 1;
-
-# my $old_state;
-# if($item->checked()){
-# $old_state = "to_install";
-# }else{
-# $old_state = "to_remove";
-# }
toggle_nodes($w->{tree}, $w->{detail_list}, \&set_leaf_state, $old_status, $name);
$w->{detail_list}->selectItem($item, 1);
@@ -1033,17 +1036,21 @@ sub ask_browse_tree_given_widgets_for_rpmdragora {
"";
$w->{detail_list}->startMultipleChanges();
+ # cleanup old changed items since we are removing all of them
+ $w->{detail_list}->setChangedItem(undef);
$w->{detail_list}->deleteAllItems();
my $itemColl = new yui::YItemCollection;
@table_item_list = ();
my $index = 0;
+
foreach(@nodes){
- add_package_item($itemColl, $_->[0], ($lastItem eq $_->[0]));
- warn "Unmanaged param " . $_->[2] if defined $_->[2];
- $ptree{$_->[0]} = [ $index ];
- $index++;
- push @table_item_list, $_->[0];
+ if (add_package_item($itemColl, $_->[0], ($lastItem eq $_->[0]), $common->{'skip_other'})) {
+ warn "Unmanaged param 3 " . $_->[2] if defined $_->[2];
+ $ptree{$_->[0]} = [ $index ];
+ $index++;
+ push @table_item_list, $_->[0];
+ }
}
update_size($common);
@@ -1071,6 +1078,7 @@ sub reset_search() {
yui::YUI::app()->busyCursor();
my $wdgt = $common->{widgets};
$wdgt->{detail_list}->startMultipleChanges();
+ $wdgt->{detail_list}->setChangedItem(undef);
$wdgt->{detail_list}->deleteAllItems();
$wdgt->{detail_list}->doneMultipleChanges();
yui::YUI::app()->normalCursor();
@@ -1140,7 +1148,8 @@ sub pkgs_provider {
foreach my $type (keys %tmp_filter_methods) {
$filter_methods{$type} = sub {
$force_rebuild = 1; # force rebuilding tree since we changed filter (FIXME: switch to SortModel)
- @filtered_pkgs = intersection($filters{$filter->[0]}, $tmp_filter_methods{$type}->());
+ my $curr_filter = $filter->[0] eq 'skip_other' ? 'all' : $filter->[0];
+ @filtered_pkgs = intersection($filters{$curr_filter}, $tmp_filter_methods{$type}->());
};
}
diff --git a/lib/ManaTools/Shared/GUI/ReplacePoint.pm b/lib/ManaTools/Shared/GUI/ReplacePoint.pm
index d3ac6fd2..c8db5856 100644
--- a/lib/ManaTools/Shared/GUI/ReplacePoint.pm
+++ b/lib/ManaTools/Shared/GUI/ReplacePoint.pm
@@ -154,12 +154,12 @@ sub buildReplacePoint {
my $factory = $dialog->factory();
my $parentWidget = $self->parentWidget();
- # lock windows for multiple changes
- $ydialog->startMultipleChanges();
-
# create the replacepoint
my $replacepoint = $factory->createReplacePoint($parentWidget);
+ # lock windows for multiple changes
+ $ydialog->startMultipleChanges();
+
return $replacepoint;
}
diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora
index e2d75103..d6984159 100755
--- a/modules/rpmdragora/rpmdragora
+++ b/modules/rpmdragora/rpmdragora
@@ -51,6 +51,7 @@ use ManaTools::Rpmdragora::pkg;
use yui;
use feature 'state';
+use POSIX qw/uname/;
# OLD $ugtk2::wm_icon = get_icon('installremoverpm', "title-$MODE");
#TODO fix $wm_resource_path
@@ -119,6 +120,7 @@ sub _filterbox_callback {
my $val = $rfilters->[$curr_index];
if ($filter->[0] ne $val) {
$filter->[0] = $val;
+ $options->{'skip_other'} = $val eq 'skip_other';
reset_search();
slow_func(sub { switch_pkg_list_mode($default_list_mode) });
$options->{rebuild_tree}->();
@@ -301,8 +303,7 @@ sub _do_search($$$$$$) {
my $xml_info_file =
urpm::media::any_xml_info($urpm, $medium,
($current_search_type eq 'files' ? 'files' : 'info'),
- undef,
- sub {
+ undef, sub {
$gurpm ||= ManaTools::Rpmdragora::gurpm->new(
text => $loc->N("Please wait"),
main_dialog => $searchw,
@@ -345,8 +346,7 @@ sub _do_search($$$$$$) {
eval {
urpm::xml_info::do_something_with_nodes(
'info',
- $xml_info_file,
- sub {
+ $xml_info_file, sub {
$searchstop and die 'search aborted';
my ($node) = @_;
$update_search_pb->();
@@ -369,11 +369,9 @@ sub _do_search($$$$$$) {
$searchw->destroy;
}
-# my $iter;
if (@search_results) {
@search_results = sort_packages(@search_results);
$elems{$results_ok} = [ map { [ $_, $results_ok ] } @search_results ];
-# $iter = $options->{add_parent}->($tree, $results_ok);
ManaTools::Rpmdragora::gui::add_tree_item($tree, $results_ok, 1);
$options->{add_nodes}->(map { [ $_, $results_ok . ($options->{tree_mode} eq 'by_presence'
@@ -384,14 +382,12 @@ sub _do_search($$$$$$) {
] } @search_results);
} else {
ManaTools::Rpmdragora::gui::add_tree_item($tree, $results_none, 1);
-# $iter = $options->{add_parent}->($tree, $results_none);
# clear package list:
$options->{add_nodes}->();
my $string = $default_list_mode eq 'all' && $filter->[0] eq 'all' ? $loc->N("No search results.") :
$loc->N("No search results. You may want to switch to the '%s' view and to the '%s' filter",
$loc->N("All"), $loc->N("All"),);
statusbar_msg($string , 1);
- #gtkset_mousecursor_normal($::w->{rwindow}->window);
}
my $tree_selection = $tree->currentItem();
}
@@ -537,13 +533,21 @@ sub _run_treeview_dialog {
non_installed => $loc->N("Not installed"),
);
my @ordered_filters = (qw (all installed non_installed) );
-
- # handle migrating config file from rpmdragora <= 4.9
- if (exists $filters{$default_list_mode}) {
- $filter->[0] = $default_list_mode;
- $default_list_mode = 'all';
+ my ($sysname, $nodename, $rel, $ver, $machine) = POSIX::uname();
+ if ($machine eq "x86_64") {
+ # NOTE this should work on other architectures too, but maybe it
+ # is a nonsense, at least for i586
+ $filters{'skip_other'} = $loc->N("Show %s and noarch only", $machine);
+ push @ordered_filters, 'skip_other';
}
+# leaving the code by now waiting for rpmdrake developers comment
+# # handle migrating config file from rpmdragora <= 4.9
+# if (exists $filters{$default_list_mode}) {
+# $filter->[0] = $default_list_mode;
+# $default_list_mode = 'all';
+# }
+
$options->{tree_mode} = $default_list_mode;
my %modes = (
@@ -600,6 +604,8 @@ sub _run_treeview_dialog {
my $filter_box = $factory->createComboBox($hbox_top,"");
$itemColl = new yui::YItemCollection;
+ $options->{'skip_other'} = $filter->[0] eq 'skip_other';
+
foreach (@ordered_filters) {
my $item = yui::YItem->new("$filters{$_}", 0);
$item->setSelected(1) if defined($filters{$filter->[0]}) && $_ eq $filter->[0];