diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-08-23 22:11:20 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-08-23 22:11:20 +0000 |
commit | a849af24f5a5bf900cdd0e11ed327de1a6c43bf4 (patch) | |
tree | 1fd7ad5585613de7f4279d2f74f7400fdf7d3ac1 | |
parent | 72859edc01348491bb3c265a302fd3dc9ba4b8f9 (diff) | |
download | drakx-a849af24f5a5bf900cdd0e11ed327de1a6c43bf4.tar drakx-a849af24f5a5bf900cdd0e11ed327de1a6c43bf4.tar.gz drakx-a849af24f5a5bf900cdd0e11ed327de1a6c43bf4.tar.bz2 drakx-a849af24f5a5bf900cdd0e11ed327de1a6c43bf4.tar.xz drakx-a849af24f5a5bf900cdd0e11ed327de1a6c43bf4.zip |
- disable up button when selected rule is the first one
- disable down button when selected rule is the latest one or when
next rule is non editable
-rwxr-xr-x | perl-install/standalone/drakperm | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index 06121b7f1..ab7324504 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -80,11 +80,14 @@ sub move_callback { return if !$iter2 || $model->get($iter2, 0); $model->swap($iter, $iter2); $modified = 1; + hide_up_button_iffirst_item($path); + hide_down_button_iflast_item($path); $permList->get_selection->select_iter($iter); $permList->queue_draw; } my $combo_sig = $combo_perm->entry->signal_connect(changed => sub { display_perm($rev_perm_l10n{$combo_perm->entry->get_text} , @_) }); + $permList->signal_connect(button_press_event => sub { return unless $editable; my (undef, $event) = @_; @@ -133,13 +136,32 @@ $combo_perm->entry->set_text($perm_l10n{$default_perm_level}); $permList->get_selection->signal_connect('changed' => sub { my ($select) = @_; my (undef, $iter) = $select->get_selected; - sensitive_buttons($iter ? $editable && !$treeModel->get($iter, 0) : 0); + return if !$iter; + my $locked = $treeModel->get($iter, 0); + sensitive_buttons($iter ? $editable && !$locked : 0); + return if $locked; + my $curr_path = $treeModel->get_path($iter); + hide_up_button_iffirst_item($curr_path); + hide_down_button_iflast_item($curr_path); }); $w->main; ugtk2->exit; +sub hide_up_button_iffirst_item { + my ($curr_path) = @_; + my $first_path = $treeModel->get_path($treeModel->get_iter_first); + $buttons[0]->set_sensitive($first_path && $first_path->compare($curr_path)); +} + +sub hide_down_button_iflast_item { + my ($curr_path) = @_; + $curr_path->next; + my $next_item = $treeModel->get_iter($curr_path); + $buttons[1]->set_sensitive($next_item && !$treeModel->get($next_item, 0)); +} + sub check_save() { $modified or return 0; my $sav_ = $in->ask_okcancel('Warning', 'your changed will be lost do you wish to continue?'); |