diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-08-25 07:51:35 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-08-25 07:51:35 +0000 |
commit | a98c827c53b8500a7965ff76cabb2d1670ec5537 (patch) | |
tree | 66b910399a8bc54a49b3609219ccfaf117791d91 | |
parent | 3ac27158239fcdfcbb60b4e08c29be953acfc87c (diff) | |
download | drakx-backup-do-not-use-a98c827c53b8500a7965ff76cabb2d1670ec5537.tar drakx-backup-do-not-use-a98c827c53b8500a7965ff76cabb2d1670ec5537.tar.gz drakx-backup-do-not-use-a98c827c53b8500a7965ff76cabb2d1670ec5537.tar.bz2 drakx-backup-do-not-use-a98c827c53b8500a7965ff76cabb2d1670ec5537.tar.xz drakx-backup-do-not-use-a98c827c53b8500a7965ff76cabb2d1670ec5537.zip |
various perl_checker fix
-rwxr-xr-x | perl-install/standalone/draksambashare | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/perl-install/standalone/draksambashare b/perl-install/standalone/draksambashare index 2008dcaca..f957a087b 100755 --- a/perl-install/standalone/draksambashare +++ b/perl-install/standalone/draksambashare @@ -35,6 +35,8 @@ use Libconf::Glueconf::Samba::Smb_conf; my $in = 'interactive'->vnew('su'); $in->do_pkgs->ensure_is_installed('samba-server', '/usr/sbin/smbd') or return; +local *FALSE; + use constant FALSE => 0; use constant TRUE => 1; use constant COLUMN_SHARE_NAME => 0; @@ -78,7 +80,7 @@ my %adv_options = ( inherit_permissions => N("Inherit permissions"), ); -sub get_items { +sub get_items() { my @items = ( [ "/_File", undef, undef, undef, '<Branch>', ], [ "/_File/_Write conf", undef, \&write_conf, 1, '<StockItem>', 'gtk-execute' ], @@ -121,7 +123,7 @@ my $label_and_widgets = sub { }; my $fdwidget = sub { - my ($data, $label) = @_; + my ($data) = @_; my $fd = new Gtk2::FileSelection(N("Directory Selection")); $fd->set_modal(TRUE); $fd->signal_connect("destroy", sub { $fd->hide }); @@ -138,9 +140,9 @@ my $fdwidget = sub { sub get_samba_share() { undef @listshare; foreach my $clef (keys %$samba) { - if ($samba->{$clef}{printable} =~ /yes/i or $clef =~ /print\$/) { + if ($samba->{$clef}{printable} =~ /yes/i || $clef =~ /print\$/) { print "$clef is a printer\n"; - } elsif ($clef =~ /global/ or $clef =~ /cdrom$/ or $clef eq "homes" or $clef eq "profiles") { + } elsif ($clef =~ /global/ || $clef =~ /cdrom$/ || $clef eq "homes" || $clef eq "profiles") { print "unwanted (special shares)\n"; } else { push @listshare, { @@ -208,7 +210,7 @@ sub create_pango_help_box { } sub help_b { - my ($tittle, $help_data) = @_; + my ($help_data) = @_; gtksignal_connect(new Gtk2::Button->new_from_stock('gtk-dialog-info'), clicked => sub { my $dialog = _create_dialog(); $dialog->set_transient_for($::main_window); @@ -254,7 +256,7 @@ sub add_entry { } sub modify_entry { - my ($widget, $treeview) = @_; + my ($treeview) = @_; my $model = $treeview->get_model; my $selection = $treeview->get_selection; my $iter; @@ -278,7 +280,7 @@ sub modify_entry { $iter = $selection->get_selected; $iter or info_dialog(N("Error"), N("Please add a Samba share to be able to modify it.")) and return; - my $path = $model->get_path($iter); + $path = $model->get_path($iter); $i = ($path->get_indices)[0]; $share_name->set_text($listshare[$i]{share_name}); @@ -304,7 +306,6 @@ sub modify_entry { my $expander_user = Gtk2::Expander->new('User options (user access, mask option, force mode)'); $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, 1), 0, $label_and_widgets->($adv_options{read_list}, $read_list, ""), @@ -375,13 +376,13 @@ sub modify_entry { cancel_clicked => sub { $w->destroy }, ok_clicked => sub { my $share = $share_name->get_text; - $comment->get_text or $::in->ask_warn(N("Information"), N("Please enter a Comment for this share.")); - ! -d $samba->{$share}{path} or $::in->ask_warn(N("Error"), N("Please provide a directory.")); - map { - if ($_ and !/^\d+$/) { - $::in->ask_warn(N("Error"), N("Create mask, create mode and directory mask should be numeric. ie: 0755.")) and return 1; - } - } $create_mask->get_text, $directory_mask->get_text; + #$comment->get_text or $::in->ask_warn(N("Information"), N("Please enter a Comment for this share.")); + #! -d $samba->{$share}{path} or $::in->ask_warn(N("Error"), N("Please provide a directory.")); + foreach ($create_mask->get_text, $directory_mask->get_text) { + if ($_ && !/^\d+$/) { + $::in->ask_warn(N("Error"), N("Create mask, create mode and directory mask should be numeric. ie: 0755.")) and return 1; + } + } # update gui treeview $model->set($iter, COLUMN_SHARE_NAME, $share_name->get_text, @@ -405,25 +406,25 @@ sub modify_entry { COLUMN_INHERIT_PERMISSIONS, $inherit_permissions->get_text, ); # update $samba with the new value - $samba->{$share}; + # $samba->{$share}; $samba->{$share}{path} = $dir->get_text; $samba->{$share}{comment} = $comment->get_text; - $browseable->get_text and $samba->{$share}{browseable} = $browseable->get_text or delete $samba->{$share}{browseable}; - $public->get_text and $samba->{$share}{public} = $public->get_text or delete $samba->{$share}{public}; - $writable->get_text and $samba->{$share}{writable} = $writable->get_text or delete $samba->{$share}{writable}; - $create_mask->get_text and $samba->{$share}{'create mask'} = $create_mask->get_text or delete $samba->{$share}{'create mask'}; - $directory_mask->get_text and $samba->{$share}{'directory mask'} = $directory_mask->get_text or delete $samba->{$share}{'directory mask'}; - $read_list->get_text and $samba->{$share}{'read list'} = $read_list->get_text or delete $samba->{$share}{'read list'}; - $write_list->get_text and $samba->{$share}{'write list'} = $write_list->get_text or delete $samba->{$share}{'write list'}; - $admin_users->get_text and $samba->{$share}{'admin users'} = $admin_users->get_text or delete $samba->{$share}{'admin users'}; - $valid_users->get_text and $samba->{$share}{'valid users'} = $valid_users->get_text or delete $samba->{$share}{'valid users'}; - $hide_dot_files->get_text and $samba->{$share}{'hide dot files'} = $hide_dot_files->get_text or delete $samba->{$share}{'hide dot files'}; - $hide_files->get_text and $samba->{$share}{'hide files'} = $hide_files->get_text or delete $samba->{$share}{'hide files'}; - $preserve_case->get_text and $samba->{$share}{'preserve case'} = $preserve_case->get_text or delete $samba->{$share}{'preserve case'}; - $force_create_mode->get_text and $samba->{$share}{'force create mode'} = $force_create_mode->get_text or delete $samba->{$share}{'force create mode'}; - $force_group->get_text and $samba->{$share}{'force group'} = $force_group->get_text or delete $samba->{$share}{'force group'}; - $default_case->get_text and $samba->{$share}{'default case'} = $default_case->get_text or delete $samba->{$share}{'default case'}; - $inherit_permissions->get_text and $samba->{$share}{'inherit permissions'} = $inherit_permissions->get_text or delete $samba->{$share}{'inherit permissions'}; + $browseable->get_text and $samba->{$share}{browseable} = $browseable->get_text || delete $samba->{$share}{browseable}; + $public->get_text and $samba->{$share}{public} = $public->get_text || delete $samba->{$share}{public}; + $writable->get_text and $samba->{$share}{writable} = $writable->get_text || delete $samba->{$share}{writable}; + $create_mask->get_text and $samba->{$share}{'create mask'} = $create_mask->get_text || delete $samba->{$share}{'create mask'}; + $directory_mask->get_text and $samba->{$share}{'directory mask'} = $directory_mask->get_text || delete $samba->{$share}{'directory mask'}; + $read_list->get_text and $samba->{$share}{'read list'} = $read_list->get_text || delete $samba->{$share}{'read list'}; + $write_list->get_text and $samba->{$share}{'write list'} = $write_list->get_text || delete $samba->{$share}{'write list'}; + $admin_users->get_text and $samba->{$share}{'admin users'} = $admin_users->get_text || delete $samba->{$share}{'admin users'}; + $valid_users->get_text and $samba->{$share}{'valid users'} = $valid_users->get_text || delete $samba->{$share}{'valid users'}; + $hide_dot_files->get_text and $samba->{$share}{'hide dot files'} = $hide_dot_files->get_text || delete $samba->{$share}{'hide dot files'}; + $hide_files->get_text and $samba->{$share}{'hide files'} = $hide_files->get_text || delete $samba->{$share}{'hide files'}; + $preserve_case->get_text and $samba->{$share}{'preserve case'} = $preserve_case->get_text || delete $samba->{$share}{'preserve case'}; + $force_create_mode->get_text and $samba->{$share}{'force create mode'} = $force_create_mode->get_text || delete $samba->{$share}{'force create mode'}; + $force_group->get_text and $samba->{$share}{'force group'} = $force_group->get_text || delete $samba->{$share}{'force group'}; + $default_case->get_text and $samba->{$share}{'default case'} = $default_case->get_text || delete $samba->{$share}{'default case'}; + $inherit_permissions->get_text and $samba->{$share}{'inherit permissions'} = $inherit_permissions->get_text || delete $samba->{$share}{'inherit permissions'}; $w->destroy; }, }, @@ -435,14 +436,14 @@ sub modify_entry { } sub remove_entry { - my ($widget, $treeview) = @_; + my ($treeview) = @_; 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]; - ask_okcancel("Remove entry ?", "Remove $listshare[$i]{path}") or return; + ask_okcancel("Remove entry ?", "Remove $listshare[$i]{path}") and return; $model->remove($iter); splice @listshare, $i, 1; } @@ -485,7 +486,6 @@ sub add_columns { each_index { my $renderer = Gtk2::CellRendererText->new; $renderer->set(editable => 0); - $renderer->signal_connect(edited => \&cell_edited, $model); $renderer->set_data(column => $::i); $treeview->insert_column_with_attributes(-1, $_, $renderer, 'text' => $::i); } N("Share name"), N("Share directory"), N("Comment"), N("Browseable"), N("Public"), N("Writable"), N("Create mask"), N("Directory mask"), N("Read list"), N("Write list"), N("Admin users"), N("Valid users"), N("Hide dot files"), N("Hide files"), N("Preserve case"), N("Force create mode"), N("Force group"), N("Default case"), N("Inherit Permissions"); @@ -516,7 +516,7 @@ $treeview->signal_connect(button_press_event => sub { my $selection = $treeview->get_selection; my $iter = $selection->get_selected; if ($iter) { - modify_entry($model, $treeview) if $event->type eq '2button-press'; + modify_entry($treeview) if $event->type eq '2button-press'; } }); @@ -541,21 +541,21 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,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) }; + eval { add_entry($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) }; + eval { modify_entry($treeview) }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to Modify Samba share.") . "\n\n" . $err); } }), 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { - eval { remove_entry($model, $treeview) }; + eval { remove_entry($treeview) }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to remove a Samba share.") . "\n\n" . $err); |