aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo@mageia.org>2013-01-08 18:47:09 +0000
committerMatteo Pasotti <matteo@mageia.org>2013-01-08 18:47:09 +0000
commit7deb546103eea4647985d5ec7bcbc97d1b0d886b (patch)
treed6092b9ef02b82fa0a1880e5694818527fea2d08 /modules
parenta8f28ed589e8d92e90b61ff3dd2139f21b3680f3 (diff)
downloadmanatools-7deb546103eea4647985d5ec7bcbc97d1b0d886b.tar
manatools-7deb546103eea4647985d5ec7bcbc97d1b0d886b.tar.gz
manatools-7deb546103eea4647985d5ec7bcbc97d1b0d886b.tar.bz2
manatools-7deb546103eea4647985d5ec7bcbc97d1b0d886b.tar.xz
manatools-7deb546103eea4647985d5ec7bcbc97d1b0d886b.zip
- added filter_box callback
Diffstat (limited to 'modules')
-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)