summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/draknfs
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-07-06 07:59:45 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-07-06 07:59:45 +0000
commit979d05ca0eb4f8b7405449d447d3a40f0b11b884 (patch)
treee8fba6d68c62fada02b16e8c2e6d68a95c87ab4b /perl-install/standalone/draknfs
parent571386775f006caa24ce2690fd99ef9440b48e32 (diff)
downloaddrakx-979d05ca0eb4f8b7405449d447d3a40f0b11b884.tar
drakx-979d05ca0eb4f8b7405449d447d3a40f0b11b884.tar.gz
drakx-979d05ca0eb4f8b7405449d447d3a40f0b11b884.tar.bz2
drakx-979d05ca0eb4f8b7405449d447d3a40f0b11b884.tar.xz
drakx-979d05ca0eb4f8b7405449d447d3a40f0b11b884.zip
add editcell (disable by default) , add double clic support
Diffstat (limited to 'perl-install/standalone/draknfs')
-rw-r--r--perl-install/standalone/draknfs37
1 files changed, 37 insertions, 0 deletions
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', '<main>', undef);