diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-08-24 14:08:47 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-08-24 14:08:47 +0000 |
commit | 9de983adab709c1e953abc4fe2217247ffb7d5e9 (patch) | |
tree | 2989fb130e0d98d137aa5fd7b07e1cbbe9360159 /perl-install/standalone/draksambashare | |
parent | b64442961cfd714cd1bf91d638ef3854f1d62ad0 (diff) | |
download | drakx-backup-do-not-use-9de983adab709c1e953abc4fe2217247ffb7d5e9.tar drakx-backup-do-not-use-9de983adab709c1e953abc4fe2217247ffb7d5e9.tar.gz drakx-backup-do-not-use-9de983adab709c1e953abc4fe2217247ffb7d5e9.tar.bz2 drakx-backup-do-not-use-9de983adab709c1e953abc4fe2217247ffb7d5e9.tar.xz drakx-backup-do-not-use-9de983adab709c1e953abc4fe2217247ffb7d5e9.zip |
ergo fix in modify dialog box, add more advanced options, re-enable add button (launch a wizard)
Diffstat (limited to 'perl-install/standalone/draksambashare')
-rwxr-xr-x | perl-install/standalone/draksambashare | 102 |
1 files changed, 74 insertions, 28 deletions
diff --git a/perl-install/standalone/draksambashare b/perl-install/standalone/draksambashare index 3820c5a47..35566fd64 100755 --- a/perl-install/standalone/draksambashare +++ b/perl-install/standalone/draksambashare @@ -54,7 +54,8 @@ use constant COLUMN_PRESERVE_CASE => 13; use constant COLUMN_FORCE_CREATE_MODE => 14; use constant COLUMN_FORCE_GROUP => 15; use constant COLUMN_DEFAULT_CASE => 16; -use constant NUM_COLUMNS => 17; +use constant COLUMN_INHERIT_PERMISSIONS => 17; +use constant NUM_COLUMNS => 18; my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf', show_commented_info => 1 }); my (@listshare); @@ -74,6 +75,7 @@ my %adv_options = ( preserve_case => N("Preserve case"), create_mask => N("Create mask"), directory_mask => N("Directory mask"), + inherit_permissions => N("Inherit permissions"), ); sub get_items { @@ -111,10 +113,10 @@ sub wait_action { my %size_groups = map { $_ => Gtk2::SizeGroup->new('horizontal') } qw(label widget button); my $label_and_widgets = sub { my ($label, $widget, $button) = @_; - gtkpack_(Gtk2::HBox->new(0,5), + gtkpack_(Gtk2::HBox->new(0,1), 0, gtkadd_widget($size_groups{label}, $label), - 1, gtkadd_widget($size_groups{widget}, $widget), - 2, gtkadd_widget($size_groups{button}, $button), + 0, gtkadd_widget($size_groups{widget}, $widget), + 0, gtkadd_widget($size_groups{button}, $button), ); }; @@ -159,6 +161,7 @@ sub get_samba_share() { force_create_mode => $samba->{$clef}{'force create mode'}, force_group => $samba->{$clef}{'force group'}, default_case => $samba->{$clef}{'default case'}, + inherit_permissions => $samba->{$clef}{'inherit permissions'}, }; } } @@ -222,17 +225,44 @@ sub help_b { ); } +sub add_entry { + my ($_widget, $treeview) = @_; + my $model = $treeview->get_model; + use wizards; + my $w = wizards->new; + my $wiz = { + name => N("Add a Samba share"), + pages => { + welcome => { + name => N("test"), + no_back => 1, + next => 'endadd', + }, + endadd => { + name => N("Congratulations"), + data => [ { label => N("The wizard successfully added the Samba share.") } ], + no_back => 1, + end => 1, + next => 0, + }, + } + }; + $w->process($wiz, $in); + $::isWizard = 0; + gtkset_mousecursor_normal(); +} + sub modify_entry { my ($widget, $treeview) = @_; my $model = $treeview->get_model; my $selection = $treeview->get_selection; my $iter; - my ($dir, $i, $path, $comment, $create_mask, $directory_mask, $read_list, $write_list, $admin_users, $valid_users, $force_group, $browseable, $public, $writable, $hide_files, $hide_dot_files, $force_create_mode, $preserve_case, $default_case); + my ($dir, $i, $path, $comment, $create_mask, $directory_mask, $read_list, $write_list, $admin_users, $valid_users, $force_group, $browseable, $public, $writable, $hide_files, $hide_dot_files, $force_create_mode, $preserve_case, $default_case, $inherit_permissions); $_ = Gtk2::Entry->new foreach $dir, $path, $comment, $create_mask, $directory_mask; $_ = Gtk2::Entry->new foreach $read_list, $write_list, $admin_users, $valid_users, $force_group, $force_create_mode; - $_ = Gtk2::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_files, $hide_dot_files; + $_ = Gtk2::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_files, $hide_dot_files, $inherit_permissions; $default_case->set_popdown_strings(@default_case); $_->set_popdown_strings(@yesno) foreach $browseable, $public, $writable, $hide_files, $hide_dot_files, $preserve_case; @@ -242,6 +272,7 @@ sub modify_entry { $button->signal_connect(clicked => sub { $file_dialog->show }); my $w = ugtk2->new(N("DrakSamba entry")); + $w->{window}->set_modal(1); $iter = $selection->get_selected; $iter or info_dialog(N("Error"), N("Please add a Samba share to be able to modify it.")) and return; @@ -266,12 +297,13 @@ sub modify_entry { $preserve_case->set_text($listshare[$i]{preserve_case}); $hide_files->set_text($listshare[$i]{hide_files}); $hide_dot_files->set_text($listshare[$i]{hide_dot_files}); + $inherit_permissions->set_text($listshare[$i]{inherit_permissions}); my $expander_user = Gtk2::Expander->new('User options'); $expander_user->add(gtkpack_(Gtk2::HBox->new, # 0, $label_and_widgets->($adv_options{sync}, $lsync, help_b(N_("Advanced Options Help"), $help_global)), 0, gtkadd(Gtk2::Frame->new(N("Samba user access")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), + gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), 0, $label_and_widgets->($adv_options{read_list}, $read_list, ""), 0, $label_and_widgets->($adv_options{write_list}, $write_list, ""), 0, $label_and_widgets->($adv_options{admin_users}, $admin_users, ""), @@ -279,11 +311,12 @@ sub modify_entry { ), ), 0, gtkadd(Gtk2::Frame->new(N("Mask options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), + gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), 0, $label_and_widgets->($adv_options{create_mask}, $create_mask, ""), 0, $label_and_widgets->($adv_options{directory_mask}, $directory_mask, ""), 0, $label_and_widgets->($adv_options{force_group}, $force_group, ""), 0, $label_and_widgets->($adv_options{force_create_mode}, $force_create_mode, ""), + 0, $label_and_widgets->($adv_options{inherit_permissions}, $inherit_permissions, ""), ), ), ), @@ -293,11 +326,16 @@ sub modify_entry { my $expander_file = Gtk2::Expander->new('File options'); $expander_file->add(gtkpack_(Gtk2::VBox->new, 0, gtkadd(Gtk2::Frame->new(N("Display options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), - 0, $label_and_widgets->($adv_options{hide_dot_files}, $hide_dot_files, ""), - 0, $label_and_widgets->($adv_options{hide_files}, $hide_files, ""), - 0, $label_and_widgets->($adv_options{default_case}, $default_case, ""), - 0, $label_and_widgets->($adv_options{preserve_case}, $preserve_case, ""), + gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, $label_and_widgets->($adv_options{hide_dot_files}, $hide_dot_files, ""), + 0, $label_and_widgets->($adv_options{hide_files}, $hide_files, ""), + ), + 0, Gtk2::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, $label_and_widgets->($adv_options{default_case}, $default_case, ""), + 0, $label_and_widgets->($adv_options{preserve_case}, $preserve_case, ""), + ), ), ), ), @@ -311,16 +349,22 @@ sub modify_entry { gtkadd($w->{window}, gtknew('VBox', spacing => 0, children_loose => [ gtkadd(Gtk2::Frame->new(N("Samba share directory")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3), - 0, $label_and_widgets->(N("Directory:"), $dir, $button), - 0, $label_and_widgets->(N("Comment:"), $comment, ""), - 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), - 0, $label_and_widgets->(N("Public:"), $public, ""), - 0, $label_and_widgets->(N("Writable:"), $writable, ""), + gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), + 0, $label_and_widgets->(N("Directory:"), $dir, $button), + 0, $label_and_widgets->(N("Comment:"), $comment, ""), + ), + 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), + 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), + 0, $label_and_widgets->(N("Public:"), $public, ""), + ), + 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), + 0, $label_and_widgets->(N("Writable:"), $writable, ""), + ), ), ), gtkadd(Gtk2::Frame->new("Advanced options"), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3), + gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), 0, $expander_user, 0, $expander_file, ), @@ -346,6 +390,7 @@ sub modify_entry { COLUMN_FORCE_CREATE_MODE, $force_create_mode->get_text, COLUMN_FORCE_GROUP, $force_group->get_text, COLUMN_DEFAULT_CASE, $default_case->get_text, + COLUMN_INHERIT_PERMISSIONS, $inherit_permissions->get_text, ); $w->destroy; }, @@ -373,7 +418,7 @@ sub remove_entry { sub create_model() { get_samba_share(); - my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String"); + my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String"); foreach my $a (@listshare) { my $iter = $model->append; $model->set($iter, @@ -394,6 +439,7 @@ sub create_model() { COLUMN_FORCE_CREATE_MODE, $a->{force_create_mode}, COLUMN_FORCE_GROUP, $a->{force_group}, COLUMN_DEFAULT_CASE, $a->{default_case}, + COLUMN_INHERIT_PERMISSIONS, $a->{inherit_permissions}, ); } return $model; @@ -461,13 +507,13 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), 1, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), 1, create_scrolled_window($treeview), 0, gtkpack_(create_vbox('start'), -# 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { -# eval { add_entry($model, $treeview) }; -# my $err = $@; -# if ($err) { -# err_dialog(N("Error"), N("Failed to add Samba share.") . "\n\n" . $err); -# } -# }), + 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { + eval { add_entry($model, $treeview) }; + my $err = $@; + if ($err) { + err_dialog(N("Error"), N("Failed to add Samba share.") . "\n\n" . $err); + } + }), 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { eval { modify_entry($model, $treeview) }; my $err = $@; |