diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-08-25 13:24:33 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-08-25 13:24:33 +0000 |
commit | d1a05d25ee99a0bd114f6854d13157126809d39e (patch) | |
tree | feedd1c5a34c4ce825e50cb9a28051fe8c4470c6 | |
parent | 8c39bc8f9b6001ac6adde9311516309eaf43e487 (diff) | |
download | drakx-d1a05d25ee99a0bd114f6854d13157126809d39e.tar drakx-d1a05d25ee99a0bd114f6854d13157126809d39e.tar.gz drakx-d1a05d25ee99a0bd114f6854d13157126809d39e.tar.bz2 drakx-d1a05d25ee99a0bd114f6854d13157126809d39e.tar.xz drakx-d1a05d25ee99a0bd114f6854d13157126809d39e.zip |
first step to integrate printers share
-rwxr-xr-x | perl-install/standalone/draksambashare | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/perl-install/standalone/draksambashare b/perl-install/standalone/draksambashare index dd393344b..5867590c1 100755 --- a/perl-install/standalone/draksambashare +++ b/perl-install/standalone/draksambashare @@ -54,9 +54,10 @@ local *COLUMN_FORCE_CREATE_MODE; use constant COLUMN_FORCE_CREATE_MODE => 15; local *COLUMN_FORCE_GROUP; use constant COLUMN_FORCE_GROUP => 16; local *COLUMN_DEFAULT_CASE; use constant COLUMN_DEFAULT_CASE => 17; local *COLUMN_INHERIT_PERMISSIONS; use constant COLUMN_INHERIT_PERMISSIONS => 18; +use constant COLUMN_PRINTABLE => 3; use constant COLUMN_PRINT_COMMAND => 4; use constant COLUMN_GUEST_OK => 5; my $samba = new Libconf::Glueconf::Samba::Smb_conf({ filename => '/etc/samba/smb.conf', show_commented_info => 1 }); -my (@listshare); +my (@listshare, @listprinters); my @yesno = qw(yes no); push @yesno, ""; my @default_case = qw(upper lower); push @default_case, ""; @@ -167,6 +168,23 @@ sub get_samba_share() { return @listshare; } +sub get_samba_printers() { + undef @listprinters; + foreach my $clef (keys %$samba) { + if ($samba->{$clef}{printable} =~ /yes/i || $clef =~ /print\$/) { + push @listprinters, { + path => $samba->{$clef}{path}, + comment => $samba->{$clef}{comment}, + browseable => $samba->{$clef}{'browseable'}, + printable => $samba->{$clef}{printable}, + print_command => $samba->{$clef}{'print command'}, + guest_ok => $samba->{$clef}{'guest ok'}, + }; + } + } + return @listprinters; +} + sub create_smbuser { my ($list) = @_; my @users = split(" ", $list); @@ -531,6 +549,23 @@ sub create_model() { return $model; } +sub create_model_printers() { + get_samba_printers(); + my $model_printers = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String"); + foreach my $a (@listprinters) { + my $iter = $model_printers->append; + $model_printers->set($iter, + COLUMN_PATH, $a->{path}, + COLUMN_COMMENT, $a->{comment}, + COLUMN_BROWSEABLE, $a->{browseable}, + COLUMN_PRINTABLE, $a->{printable}, + COLUMN_PRINT_COMMAND, $a->{print_command}, + COLUMN_GUEST_OK, $a->{guest_ok}, + ); + } + return $model_printers; +} + # add colum to model sub add_columns { my $treeview = shift; |