diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-03-12 22:49:27 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-03-12 22:49:27 +0000 |
commit | b671de82ac171dfffe966f3c4db6c79bd511f0d6 (patch) | |
tree | 6675c683b99aa78d41ce7b826b03b82823c553dc | |
parent | 359a7ced3dda67f470783f211fabc8b6c72c6657 (diff) | |
download | drakx-net-b671de82ac171dfffe966f3c4db6c79bd511f0d6.tar drakx-net-b671de82ac171dfffe966f3c4db6c79bd511f0d6.tar.gz drakx-net-b671de82ac171dfffe966f3c4db6c79bd511f0d6.tar.bz2 drakx-net-b671de82ac171dfffe966f3c4db6c79bd511f0d6.tar.xz drakx-net-b671de82ac171dfffe966f3c4db6c79bd511f0d6.zip |
Updated draknfs to use FileChooser for directory selection (#44562).
-rwxr-xr-x | bin/draknfs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bin/draknfs b/bin/draknfs index 8ac29c2..dce5642 100755 --- a/bin/draknfs +++ b/bin/draknfs @@ -102,19 +102,20 @@ my $label_and_widgets = sub { ]); }; -my $fdwidget = sub { - my ($data) = @_; - my $fd = new Gtk2::FileSelection(N("Directory Selection")); - $fd->set_modal(1); - $fd->signal_connect("destroy", sub { $fd->hide }); - $fd->ok_button->signal_connect(clicked => sub { - my $file = $fd->get_filename; - -d $file or err_dialog(N("Error"), N("Should be a directory.")) and return; - $data->set_text($file); - $fd->hide; - }, $fd); - $fd->cancel_button->signal_connect(clicked => sub { $fd->hide }); - return $fd; +sub show_file_dialog { + my ($data) = @_; + my $file_dlg = gtknew('FileChooserDialog', title => N("Path selection"), action => 'select_folder', + modal => 1, transient_for => $dlg); + $file_dlg->set_filename($data->get_text); + $file_dlg->show; + my $answer = $file_dlg->run; + if ($answer eq 'ok') { + my $file = $file_dlg->get_filename; + -d $file or err_dialog(N("Error!"), N("Should be a directory.")) and return; + $data->set_text($file); + } + $file_dlg->hide; + $file_dlg->destroy; }; sub get_nfs_data() { @@ -265,9 +266,8 @@ sub add_modify_entry { $lsecure->set_popdown_strings(@yesno); $lsubtree_check->set_popdown_strings(@yesno); - my $file_dialog = $fdwidget->($dir); my $button = gtknew('Button', text => N("Directory")); - $button->signal_connect(clicked => sub { $file_dialog->show }); + $button->signal_connect(clicked => sub { show_file_dialog($dir); }); # test if modify or add a nfs share |