aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AdminPanel
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2014-12-02 19:04:17 +0100
committerAngelo Naselli <anaselli@linux.it>2014-12-02 19:04:17 +0100
commitddfb4a855432efa26ee8e00044074e9c19edd5b2 (patch)
treeb4f19c55d2f884628e7e5029823849608140dc9c /lib/AdminPanel
parent9228b5b393f964b988ec472d046b61cbde41ba62 (diff)
downloadcolin-keep-ddfb4a855432efa26ee8e00044074e9c19edd5b2.tar
colin-keep-ddfb4a855432efa26ee8e00044074e9c19edd5b2.tar.gz
colin-keep-ddfb4a855432efa26ee8e00044074e9c19edd5b2.tar.bz2
colin-keep-ddfb4a855432efa26ee8e00044074e9c19edd5b2.tar.xz
colin-keep-ddfb4a855432efa26ee8e00044074e9c19edd5b2.zip
- Fixed package selection, when canceled now it is in the right status
Diffstat (limited to 'lib/AdminPanel')
-rw-r--r--lib/AdminPanel/Rpmdragora/gui.pm31
-rw-r--r--lib/AdminPanel/rpmdragora.pm12
2 files changed, 26 insertions, 17 deletions
diff --git a/lib/AdminPanel/Rpmdragora/gui.pm b/lib/AdminPanel/Rpmdragora/gui.pm
index 02ecac2..f8fc396 100644
--- a/lib/AdminPanel/Rpmdragora/gui.pm
+++ b/lib/AdminPanel/Rpmdragora/gui.pm
@@ -656,7 +656,7 @@ sub add_tree_item {
=item B<$pkg_name>: package name
-=item B<$root>: string containing a path-like sequence (e.g. "foo|bar")
+=item B<$select>: select given package
=head3 DESCRIPTION
@@ -666,7 +666,7 @@ sub add_tree_item {
#=============================================================
sub add_package_item {
- my ($item_list, $pkg_name, $root) = @_;
+ my ($item_list, $pkg_name, $select) = @_;
return if !$pkg_name;
@@ -683,7 +683,6 @@ sub add_package_item {
$release = "" if !defined($release);
$arch = "" if !defined($arch);
-# TODO FIXME summary is not visible in necurses (adding a new column as in dragoraUpdate)
my $newTableItem = new yui::YCBTableItem(
$name,
get_summary($pkg_name),
@@ -692,15 +691,16 @@ sub add_package_item {
$arch
);
+ $newTableItem->setSelected($select);
+
set_node_state($newTableItem, $state);
-# TODO FIXME evaluate if $ptree is really needed.
$item_list->push($newTableItem);
$newTableItem->DISOWN();
}
else {
- warn $pkg_name . " is not a leaf package and that is not managed!";
+ carp $pkg_name . " is not a leaf package and that is not managed!";
}
}
@@ -938,14 +938,16 @@ sub fast_toggle {
interactive_msg($loc->N("Warning"), '<b>' . $loc->N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n");
}
# toggle_nodes($w->{tree}->window, $w->{detail_list_model}, \&set_leaf_state, $w->{detail_list_model}->get($iter, $pkg_columns{state}),
- my $state;
-#pasmatt checked should be to install no?
- if($item->checked()){
- $state = "to_install";
- }else{
- $state = "to_remove";
- }
- toggle_nodes($w->{tree}, $w->{detail_list}, \&set_leaf_state, $state, $name);
+ my $val = $pkgs->{$name}{selected};
+ my $old_status = $val ? 'to_install' : 'to_update';
+
+# 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);
update_size($common);
};
@@ -1000,6 +1002,7 @@ sub ask_browse_tree_given_widgets_for_rpmdragora {
yui::YUI::app()->busyCursor();
$DB::single = 1;
+ my $lastItem = $w->{detail_list}->selectedItem() ? $w->{detail_list}->selectedItem()->label() : "";
$w->{detail_list}->startMultipleChanges();
$w->{detail_list}->deleteAllItems();
my $itemColl = new yui::YItemCollection;
@@ -1007,7 +1010,7 @@ sub ask_browse_tree_given_widgets_for_rpmdragora {
@table_item_list = ();
my $index = 0;
foreach(@nodes){
- add_package_item($itemColl, $_->[0], $_->[1]);
+ add_package_item($itemColl, $_->[0], ($lastItem eq $_->[0]));
warn "Unmanaged param " . $_->[2] if defined $_->[2];
$ptree{$_->[0]} = [ $index ];
$index++;
diff --git a/lib/AdminPanel/rpmdragora.pm b/lib/AdminPanel/rpmdragora.pm
index 3ae4f31..0cf9265 100644
--- a/lib/AdminPanel/rpmdragora.pm
+++ b/lib/AdminPanel/rpmdragora.pm
@@ -341,10 +341,15 @@ sub interactive_list {
my $mainw = $factory->createPopupDialog();
my $vbox = $factory->createVBox($mainw);
my $lbltitle = $factory->createLabel($vbox, $loc->N("Dependencies"));
- my $radiobuttongroup = $factory->createRadioButtonGroup($vbox);
+ my $left = $factory->createLeft($factory->createHBox($vbox));
+ my $radiobuttongroup = $factory->createRadioButtonGroup($left);
my $rbbox = $factory->createVBox($radiobuttongroup);
- foreach my $item(@$list){
+ foreach my $item (@$list) {
my $radiobutton = $factory->createRadioButton($rbbox,$item);
+ if ($item eq $list->[0]) {
+ # select first by default
+ $radiobutton->setValue(1);
+ }
$radiobutton->setNotify(0);
$radiobuttongroup->addRadioButton($radiobutton);
}
@@ -364,7 +369,8 @@ sub interactive_list {
my $widget = $event->widget();
if($widget == $submitButton) {
- $choice = $radiobuttongroup->currentButton->label();
+ # NOTE if for any reason radio button is not checked let's take the first package
+ $choice = $radiobuttongroup->currentButton() ? $radiobuttongroup->currentButton()->label() : $list->[0];
$choice =~s/\&//g;
last;
}