diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-08-23 22:16:29 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-08-23 22:16:29 +0000 |
commit | 2249f5f6d9efccdb5fea3c867bc71e0789bf5c79 (patch) | |
tree | 463a50c2e5a369b1c91b55d65f999d4e0d4d7031 /perl-install/standalone/drakperm | |
parent | ab1bed76fbb6297d36d84c4d8ed1c5e6f0dc3aa7 (diff) | |
download | drakx-2249f5f6d9efccdb5fea3c867bc71e0789bf5c79.tar drakx-2249f5f6d9efccdb5fea3c867bc71e0789bf5c79.tar.gz drakx-2249f5f6d9efccdb5fea3c867bc71e0789bf5c79.tar.bz2 drakx-2249f5f6d9efccdb5fea3c867bc71e0789bf5c79.tar.xz drakx-2249f5f6d9efccdb5fea3c867bc71e0789bf5c79.zip |
rename $treeModel as $model since it really is a ListModel, not a
TreeModel anymore (cosmetic)
Diffstat (limited to 'perl-install/standalone/drakperm')
-rwxr-xr-x | perl-install/standalone/drakperm | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index ab7324504..b5d25b0fb 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -32,8 +32,8 @@ my $w = ugtk2->new('drakperm'); $w->{rwindow}->set_size_request(550, 400) unless $::isEmbedded; my $W = $w->{window}; $W->signal_connect(delete_event => sub { ugtk2->exit }); -my $treeModel = Gtk2::ListStore->new("Gtk2::Gdk::Pixbuf", ("Glib::String") x 4); -my $permList = Gtk2::TreeView->new_with_model($treeModel); +my $model = Gtk2::ListStore->new("Gtk2::Gdk::Pixbuf", ("Glib::String") x 4); +my $permList = Gtk2::TreeView->new_with_model($model); my $pixbuf = gtkcreate_pixbuf('non-editable'); @@ -137,10 +137,10 @@ $permList->get_selection->signal_connect('changed' => sub { my ($select) = @_; my (undef, $iter) = $select->get_selected; return if !$iter; - my $locked = $treeModel->get($iter, 0); + my $locked = $model->get($iter, 0); sensitive_buttons($iter ? $editable && !$locked : 0); return if $locked; - my $curr_path = $treeModel->get_path($iter); + my $curr_path = $model->get_path($iter); hide_up_button_iffirst_item($curr_path); hide_down_button_iflast_item($curr_path); }); @@ -151,15 +151,15 @@ ugtk2->exit; sub hide_up_button_iffirst_item { my ($curr_path) = @_; - my $first_path = $treeModel->get_path($treeModel->get_iter_first); + my $first_path = $model->get_path($model->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)); + my $next_item = $model->get_iter($curr_path); + $buttons[1]->set_sensitive($next_item && !$model->get($next_item, 0)); } sub check_save() { @@ -183,7 +183,7 @@ sub display_perm { $editable = $perm_level =~ /^level \d/ ? 0 : 1; - $treeModel->clear; + $model->clear; foreach my $file (@files) { local *F; open F, $file; @@ -192,9 +192,9 @@ sub display_perm { my $is_uneditable = $file ne $perm_files{editable}; while (<F>) { if (m/^([^#]\S+)\s+([^.\s]+)\.(\S+)?\s+(\d+)/) { - $treeModel->append_set(if_($is_uneditable, 0 => $pixbuf), 1 => $1, 2 => $2, 3 => $3, 4 => $4); + $model->append_set(if_($is_uneditable, 0 => $pixbuf), 1 => $1, 2 => $2, 3 => $3, 4 => $4); } elsif (m/^([^#]\S+)\s+current?\s+(\d+)/) { - $treeModel->append_set(if_($is_uneditable, 0 => $pixbuf), 1 => $1, 2 => 'current', 3 => '', 4 => $2); + $model->append_set(if_($is_uneditable, 0 => $pixbuf), 1 => $1, 2 => 'current', 3 => '', 4 => $2); } } close F; @@ -210,13 +210,13 @@ sub save_perm() { if ($modified) { local *F; open F, '>' . $perm_files{editable} or die("Impossible to process \"", $perm_files{editable}, "\""); - $treeModel->foreach(sub { - my ($model, $_path, $iter) = @_; - return 0 if $model->get($iter, 0); - my $line = $model->get($iter, 1) . "\t" . $model->get($iter, 2) . ($model->get($iter, 3) ? "." . $model->get($iter, 3) : "") . "\t" . $model->get($iter, 4) . "\n"; - print F $line; - return 0; - }, $val); + $model->foreach(sub { + my ($model, $_path, $iter) = @_; + return 0 if $model->get($iter, 0); + my $line = $model->get($iter, 1) . "\t" . $model->get($iter, 2) . ($model->get($iter, 3) ? "." . $model->get($iter, 3) : "") . "\t" . $model->get($iter, 4) . "\n"; + print F $line; + return 0; + }, $val); close F; } $modified = 0; @@ -238,7 +238,7 @@ sub row_setting_dialog { my $sticky = new Gtk2::CheckButton(N("Sticky-bit")); my $suid = new Gtk2::CheckButton(N("Set-UID")); my $gid = new Gtk2::CheckButton(N("Set-GID")); - my $rght = $treeModel->get($iter, 4) if $iter; + my $rght = $model->get($iter, 4) if $iter; my $s = length($rght) == 4 ? substr($rght,0,1) : 0; my $user = $s ? substr($rght,1,1) : substr($rght,0,1); my $group = $s ? substr($rght,2,1) : substr($rght,1,1); @@ -273,17 +273,17 @@ sub row_setting_dialog { $gid->set_active($s_right{write}); $suid->set_active($s_right{read}); - $file->set_text($treeModel->get($iter, 1)) if $iter; + $file->set_text($model->get($iter, 1)) if $iter; my $users = Gtk2::OptionMenu->new; $users->set_popdown_strings(&get_user_or_group('users')); - $users->entry->set_text($treeModel->get($iter, 2)) if $iter; + $users->entry->set_text($model->get($iter, 2)) if $iter; my $groups = Gtk2::OptionMenu->new; $groups->set_popdown_strings(&get_user_or_group); - $groups->entry->set_text($treeModel->get($iter, 3)) if $iter; + $groups->entry->set_text($model->get($iter, 3)) if $iter; - if ($iter && $treeModel->get($iter, 2) eq 'current') { + if ($iter && $model->get($iter, 2) eq 'current') { $usr_check->set_active(1); $groups->set_sensitive(0); $users->set_sensitive(0); @@ -310,26 +310,26 @@ sub row_setting_dialog { my %perms; $ok->signal_connect(clicked => sub { if (!$iter) { # create new item when adding a new one - $iter = $treeModel->append; - my $first_iter = $treeModel->get_iter_first; + $iter = $model->append; + my $first_iter = $model->get_iter_first; if ($first_iter) { - $treeModel->move_after($iter, $first_iter); - $treeModel->swap($iter, $first_iter); + $model->move_after($iter, $first_iter); + $model->swap($iter, $first_iter); } } - $treeModel->set($iter, 1 => $file->get_text); + $model->set($iter, 1 => $file->get_text); if ($usr_check->get_active) { - $treeModel->set($iter, 2 => 'current'); - $treeModel->set($iter, 3 => ''); + $model->set($iter, 2 => 'current'); + $model->set($iter, 3 => ''); } else { - $treeModel->set($iter, 2 => $users->entry->get_text); - $treeModel->set($iter, 3 => $groups->entry->get_text); + $model->set($iter, 2 => $users->entry->get_text); + $model->set($iter, 3 => $groups->entry->get_text); } $user = ($perms{user}{read}->get_active ? 4 : 0)+($perms{user}{write}->get_active ? 2 : 0)+($perms{user}{execute}->get_active ? 1 : 0); $group = ($perms{group}{read}->get_active ? 4 : 0)+($perms{group}{write}->get_active ? 2 : 0)+($perms{group}{execute}->get_active ? 1 : 0); $other = ($perms{other}{read}->get_active ? 4 : 0)+($perms{other}{write}->get_active ? 2 : 0)+($perms{other}{execute}->get_active ? 1 : 0); my $s = ($sticky->get_active ? 1 : 0) + ($suid->get_active ? 4 : 0) + ($gid->get_active ? 2 : 0); - $treeModel->set($iter, 4 => ($s || '') . $user . $group . $other); + $model->set($iter, 4 => ($s || '') . $user . $group . $other); $dlg->destroy; $modified++; }); |