aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmodules/rpmdragora/rpmdragora97
1 files changed, 52 insertions, 45 deletions
diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora
index 36476d13..63d8f856 100755
--- a/modules/rpmdragora/rpmdragora
+++ b/modules/rpmdragora/rpmdragora
@@ -60,6 +60,42 @@ our $statusbar;
my %elems;
+my $old_value;
+sub viewbox_callback {
+ my ($selection, $options, %wanted_categories) = @_;
+ my $val = $selection;
+ $old_value="" if(!defined($old_value));
+ return if $val eq $old_value; # workarounding gtk+ sending us sometimes twice events
+ $old_value = $val;
+ $default_list_mode = $options->{rviews}{$val};
+ if (my @cat = $wanted_categories{$options->{rviews}{$val}} && @{$wanted_categories{$options->{rviews}{$val}}}) {
+ @$mandrakeupdate_wanted_categories = @cat;
+ }
+
+ if ($options->{tree_mode} ne $val) {
+ $tree_mode->[0] = $options->{tree_mode} = $options->{rviews}{$val};
+ $tree_flat->[0] = $options->{state}{flat};
+ reset_search();
+ switch_pkg_list_mode($options->{rviews}{$val});
+ $options->{rebuild_tree}->();
+ }
+}
+
+sub filterbox_callback {
+ my ($selection, $options, $rfilters) = @_;
+ state $oldval;
+ my $val = $selection;
+ return if $val eq $oldval; # workarounding gtk+ sending us sometimes twice events
+ $oldval = $val;
+ $val = $$rfilters{$val};
+ if ($filter->[0] ne $val) {
+ $filter->[0] = $val;
+ reset_search();
+ slow_func($::main_window, sub { switch_pkg_list_mode($default_list_mode) });
+ $options->{rebuild_tree}->();
+ }
+}
+
sub do_search($$$$$$$) {
my ($find_entry, $tree, $tree_model, $options, $current_search_type, $urpm, $pkgs) = @_;
my $entry = $find_entry->value() or return;
@@ -465,36 +501,7 @@ sub run_treeview_dialog {
bugfix => [ 'bugfix' ],
normal => [ 'normal' ],
);
- my $old_value;
-=comment
- * OLD *
- my $view_box = gtknew(
- 'ComboBox',
- list => [
- qw(all meta_pkgs gui_pkgs all_updates security bugfix normal),
- if_($is_backports, 'backports')
- ],
- format => sub { $views{$_[0]} }, text => $views{$default_list_mode},
- tip => N("View"),
- changed => sub {
- my $val = $_[0]->get_text;
- return if $val eq $old_value; # workarounding gtk+ sending us sometimes twice events
- $old_value = $val;
- $default_list_mode = $rviews{$val};
- if (my @cat = $wanted_categories{$rviews{$val}} && @{$wanted_categories{$rviews{$val}}}) {
- @$mandrakeupdate_wanted_categories = @cat;
- }
- if ($options->{tree_mode} ne $val) {
- $tree_mode->[0] = $options->{tree_mode} = $rviews{$val};
- $tree_flat->[0] = $options->{state}{flat};
- reset_search();
- switch_pkg_list_mode($rviews{$val});
- $options->{rebuild_tree}->();
- }
- }
- );
-=cut
my $view_box = $factory->createComboBox($hbox_top,"");
$view_box->addItem($views{all});
$view_box->addItem($views{meta_pkgs});
@@ -548,6 +555,7 @@ sub run_treeview_dialog {
$filter_box->addItem($filters{all});
$filter_box->addItem($filters{installed});
$filter_box->addItem($filters{non_installed});
+ $filter_box->setNotify(1);
my @search_types = qw(normal descriptions summaries files);
my $current_search_type = $search_types[0];
@@ -945,22 +953,21 @@ sub run_treeview_dialog {
do_action($options, $callback_action, $info);
}
elsif ($widget == $view_box) {
- my $val = $view_box->selectedItem()->label();
- $old_value="" if(!defined($old_value));
- return if $val eq $old_value; # workarounding gtk+ sending us sometimes twice events
- $old_value = $val;
- $default_list_mode = $rviews{$val};
- if (my @cat = $wanted_categories{$rviews{$val}} && @{$wanted_categories{$rviews{$val}}}) {
- @$mandrakeupdate_wanted_categories = @cat;
- }
-
- if ($options->{tree_mode} ne $val) {
- $tree_mode->[0] = $options->{tree_mode} = $rviews{$val};
- $tree_flat->[0] = $options->{state}{flat};
- reset_search();
- switch_pkg_list_mode($rviews{$val});
- $options->{rebuild_tree}->();
- }
+ viewbox_callback($view_box->selectedItem()->label(), \%$options, \%wanted_categories);
+ }
+ elsif ($widget == $filter_box) {
+ filterbox_callback($filter_box->selectedItem()->label(), \%$options, \%rfilters);
+ #state $oldval;
+ #my $val = $filter_box->selectedItem()->label();
+ #return if $val eq $oldval; # workarounding gtk+ sending us sometimes twice events
+ #$oldval = $val;
+ #$val = $rfilters{$val};
+ #if ($filter->[0] ne $val) {
+ # $filter->[0] = $val;
+ # reset_search();
+ # slow_func($::main_window, sub { switch_pkg_list_mode($default_list_mode) });
+ # $options->{rebuild_tree}->();
+ #}
}
elsif ($widget == $file_menu && $mnuItemUpdateMedia) {
update_sources_interactive($urpm, transient => $my_win)