From 979d05ca0eb4f8b7405449d447d3a40f0b11b884 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Wed, 6 Jul 2005 07:59:45 +0000 Subject: add editcell (disable by default) , add double clic support --- perl-install/standalone/draknfs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/perl-install/standalone/draknfs b/perl-install/standalone/draknfs index 2e410931c..5b330bd00 100644 --- a/perl-install/standalone/draknfs +++ b/perl-install/standalone/draknfs @@ -434,6 +434,30 @@ sub add_columns { } N("Share Directory"), N("Hosts Wildcard"), N("General Options"), N("Custom Options"); } +sub cell_edited { + my ($cell, $path_string, $new_text, $model) = @_; + my $path = Gtk2::TreePath->new_from_string($path_string); + my $column = $cell->get_data("column"); + my $iter = $model->get_iter($path); + + if ($column == COLUMN_DIR) { + my $i = ($path->get_indices)[0]; + $listshare[$i]{dir} = $new_text; + -d $new_text or err_dialog(N("Error!"), N("Please enter a directory to share.")) and return; + $model->set($iter, $column, $listshare[$i]{dir}); + } elsif ($column == COLUMN_ACCESS) { + my $i = ($path->get_indices)[0]; + $listshare[$i]{access} = $new_text; + $model->set($iter, $column, $listshare[$i]{access}); + } elsif ($column == COLUMN_RIGHT) { + err_dialog(N("Error!"), N("Please use the modify button to set right access.")) and return; + } elsif ($column == COLUMN_OPTIONS) { + my $i = ($path->get_indices)[0]; + $listshare[$i]{options} = $new_text; + $model->set($iter, $column, $listshare[$i]{options}); + } + write_conf(); +} ############### # Main Program @@ -452,6 +476,19 @@ $treeview->set_rules_hint(TRUE); $treeview->get_selection->set_mode('single'); add_columns($treeview); +# double clic and popup modify window +$treeview->signal_connect(button_press_event => sub { + my (undef, $event) = @_; + my $model = $treeview->get_model; + my $selection = $treeview->get_selection; + my $iter = $selection->get_selected; + if ($iter) { + my $path = $model->get_path($iter); + my $i = ($path->get_indices)[0]; + add_modify_entry($model, $treeview, "modify") if $event->type eq '2button-press'; + } + }); + # create menu my @items = get_items(); my $factory = Gtk2::ItemFactory->new('Gtk2::MenuBar', '
', undef); -- cgit v1.2.1