diff options
-rwxr-xr-x | userdrake2 | 40 |
1 files changed, 19 insertions, 21 deletions
@@ -118,7 +118,7 @@ foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(0) }; my $ctx = USER::ADMIN->new; Refresh($sysfilter); $nb->signal_connect('switch-page' => sub { NotebookSwitch() }); -GetEvent($usertree); GetEvent($grouptree); +#GetEvent($usertree); GetEvent($grouptree); $us->{wnd}{rwindow}->show_all; Gtk2->main; ugtk2->exit; @@ -132,24 +132,6 @@ sub NotebookSwitch { my $page = $nb->get_current_page(); $page and TreeUnselect($usertree) or TreeUnselect($grouptree); } -sub GetEvent { - my $treev = shift; - $treev->signal_connect(button_press_event => sub { - my (undef, $event) = @_; - my (undef, $iter) = $treev->get_selection->get_selected; - return unless $iter; - foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(1) }; - Edit($iter) if $event->type eq '2button-press'; - $iter->free; - }); - $treev->signal_connect(key_press_event => sub { - my (undef, $event) = @_; - my (undef, $iter) = $treev->get_selection->get_selected; - return unless $iter; - Edit($iter) if ($event->keyval == Gtk2::Gdk::Event::Key->Sym_Return); - $iter->free; - }); -} sub Refresh_Users_Full { my $filterusers = shift; my $users = $ctx->UsersEnumerateFull(); @@ -366,7 +348,7 @@ sub AddGroup { sub Delete { my $page = $nb->get_current_page(); if ($page == 0) { - print "page 0\n"; + print "page 0"; } elsif ($page == 1) { print "page 1\n"; } @@ -376,9 +358,25 @@ sub Delete { sub CreateTree { my ($tree_model) = @_; my $tree = Gtk2::TreeView->new_with_model($tree_model); - $tree->get_selection->set_mode('browse'); + $tree->get_selection->set_mode('single'); $tree->set_headers_visible(1); $tree->set_rules_hint(1); + $tree->get_selection->signal_connect('changed' => sub { foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(1);} }); + $tree->signal_connect(button_press_event => sub { + my (undef, $event) = @_; + my (undef, $iter) = $tree->get_selection->get_selected; + return unless $iter; + foreach (($tbedit, $tbdel, $checkedit, $checkdel)) { $_->set_sensitive(1) }; + Edit($iter) if $event->type eq '2button-press'; + $iter->free; + }); + $tree->signal_connect(key_press_event => sub { + my (undef, $event) = @_; + my (undef, $iter) = $tree->get_selection->get_selected; + return unless $iter; + Edit($iter) if ($event->keyval == Gtk2::Gdk::Event::Key->Sym_Return); + $iter->free; + }); $tree } sub gtkentry_hidepass { |