diff options
author | Thierry Vignaud <tv@mandriva.org> | 2010-02-02 08:43:53 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2010-02-02 08:43:53 +0000 |
commit | ec67a24e5006d7f11203a7aec718d1bcd4be58f1 (patch) | |
tree | cdd928973a253d567e25014f4b698f38ed86021f | |
parent | 5db4af99032afa0346996a1fa39aa84af74c70e7 (diff) | |
download | userdrake-ec67a24e5006d7f11203a7aec718d1bcd4be58f1.tar userdrake-ec67a24e5006d7f11203a7aec718d1bcd4be58f1.tar.gz userdrake-ec67a24e5006d7f11203a7aec718d1bcd4be58f1.tar.bz2 userdrake-ec67a24e5006d7f11203a7aec718d1bcd4be58f1.tar.xz userdrake-ec67a24e5006d7f11203a7aec718d1bcd4be58f1.zip |
(Edit) reindent
-rwxr-xr-x | userdrake | 129 |
1 files changed, 68 insertions, 61 deletions
@@ -1034,79 +1034,86 @@ sub Edit() { my ($groupname, $groupEnt, $userEnt, $primgid, $Gent); my @primgroup; $tree->get_selection->set_mode('browse'); - $tree->append_column(my $check = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 0)); + my $check = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, + 'pixbuf' => 0); + $tree->append_column($check); $check->{is_pixbuf_column} = 1; - $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 1)); + $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, + 'text' => 1)); $tree->set_headers_visible(0); my $p = $nb->get_current_page; - my $nbU = Gtk2::Notebook->new; my $nbG = Gtk2::Notebook->new; + my $nbU = Gtk2::Notebook->new; + my $nbG = Gtk2::Notebook->new; if ($p <= 0) { ($userEnt, $primgid, @primgroup) = UserEdit_widget($nbU, $tree, $model, $Gent); } elsif ($p == 1) { $groupEnt = GroupEdit_widget($nbG, $tree, $model, $groupname); } gtkpack_($w->vbox, - 1, !$p ? $nbU : $nbG); + 1, !$p ? $nbU : $nbG); gtkadd($w->action_area, - map { - my $retv = $_->[1]; - gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => sub { - if (!$retv) { - if ($p <= 0) { - UserEdit_valid($userEnt, $model, $primgid); - } elsif ($p == 1) { - GroupEdit_valid($groupEnt, $model, $groupname); - } - } - !$error and $w->destroy; $error = 0 }); - } ([ N("Cancel"), 1 ], [ N("Ok"), 0 ]), - ); + map { + my $retv = $_->[1]; + gtksignal_connect( + Gtk2::Button->new($_->[0]), clicked => sub { + if (!$retv) { + if ($p <= 0) { + UserEdit_valid($userEnt, $model, $primgid); + } elsif ($p == 1) { + GroupEdit_valid($groupEnt, $model, $groupname); + } + } + !$error and $w->destroy; $error = 0 }); + } ([ N("Cancel"), 1 ], [ N("Ok"), 0 ]), + ); $tree->show; $w->show_all; - $tree->signal_connect(button_press_event => sub { - my ($path, $column) = $tree->get_path_at_pos($_[1]->x, $_[1]->y); - if ($path && $column) { - if ($column->{is_pixbuf_column}) { - my $iter = $model->get_iter($path); - if ($iter) { - my $cp = $model->get($iter, 2); - my $item = $model->get($iter, 1); - $model->set($iter, 0 => gtkcreate_pixbuf($pix[$cp])); - $model->set($iter, 2 => !$cp); - if ($p <= 0) { - if (!$cp) { - !InArray($item, \@primgroup) and push(@primgroup, $item); - } else { - InArray($item, \@primgroup) and @primgroup = RemoveFromArray($item, \@primgroup); - } - $us->{o}{primgroup}->set_popdown_strings(@primgroup); - $Gent and $us->{o}{primgroup}->entry->set_text($Gent->GroupName($GetValue)); - } - } - } - } - }); - $tree->signal_connect(key_press_event => sub { - my $c = chr($_[1]->keyval & 0xff); - if ($_[1]->keyval >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' ') { - my (undef, $iter) = $tree->get_selection->get_selected; - return unless $iter; - my $cp = $model->get($iter, 2); - my $item = $model->get($iter, 1); - $model->set($iter, 0 => gtkcreate_pixbuf($pix[$cp])); - $model->set($iter, 2 => !$cp); - if ($p <= 0) { - if (!$cp) { - !InArray($item, \@primgroup) and push(@primgroup, $item); - } else { - InArray($item, \@primgroup) and @primgroup = RemoveFromArray($item, \@primgroup); - } - $us->{o}{primgroup}->set_popdown_strings(@primgroup); - $Gent and $us->{o}{primgroup}->entry->set_text($Gent->GroupName($GetValue)); - } - } - 0; - }); + $tree->signal_connect( + button_press_event => sub { + my ($path, $column) = $tree->get_path_at_pos($_[1]->x, $_[1]->y); + if ($path && $column) { + if ($column->{is_pixbuf_column}) { + my $iter = $model->get_iter($path); + if ($iter) { + my $cp = $model->get($iter, 2); + my $item = $model->get($iter, 1); + $model->set($iter, 0 => gtkcreate_pixbuf($pix[$cp])); + $model->set($iter, 2 => !$cp); + if ($p <= 0) { + if (!$cp) { + !InArray($item, \@primgroup) and push(@primgroup, $item); + } else { + InArray($item, \@primgroup) and @primgroup = RemoveFromArray($item, \@primgroup); + } + $us->{o}{primgroup}->set_popdown_strings(@primgroup); + $Gent and $us->{o}{primgroup}->entry->set_text($Gent->GroupName($GetValue)); + } + } + } + } + }); + $tree->signal_connect( + key_press_event => sub { + my $c = chr($_[1]->keyval & 0xff); + if ($_[1]->keyval >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' ') { + my (undef, $iter) = $tree->get_selection->get_selected; + return unless $iter; + my $cp = $model->get($iter, 2); + my $item = $model->get($iter, 1); + $model->set($iter, 0 => gtkcreate_pixbuf($pix[$cp])); + $model->set($iter, 2 => !$cp); + if ($p <= 0) { + if (!$cp) { + !InArray($item, \@primgroup) and push(@primgroup, $item); + } else { + InArray($item, \@primgroup) and @primgroup = RemoveFromArray($item, \@primgroup); + } + $us->{o}{primgroup}->set_popdown_strings(@primgroup); + $Gent and $us->{o}{primgroup}->entry->set_text($Gent->GroupName($GetValue)); + } + } + 0; + }); } sub ValidInt { |