home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / system-tools-backends-2.0 / scripts / SelfConfig.pm < prev    next >
Encoding:
Perl POD Document  |  2011-09-23  |  1.8 KB  |  73 lines

  1. #-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  
  3. # DBus object for self user configuration
  4. #
  5. # Copyright (C) 2009 Milan Bouchet-Valat
  6. #
  7. # Authors: Milan Bouchet-Valat <nalimilan@club.fr>.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Library General Public License as published
  11. # by the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. # GNU Library General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Library General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  22.  
  23. package SelfConfig;
  24.  
  25. use base qw(StbObject);
  26. use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX);
  27. use Users::Users;
  28.  
  29. my $OBJECT_NAME = "SelfConfig2";
  30. my $OBJECT_PATH = "$Utils::Backend::DBUS_PATH/$OBJECT_NAME";
  31.  
  32. # user is only allowed to change his own GECOS fields, locale, location
  33. my $format = [ "uint32", [ "array", "string" ], "string", "string" ];
  34.  
  35. sub new
  36. {
  37.   my $class = shift;
  38.   my $self  = $class->SUPER::new ($OBJECT_PATH, $OBJECT_NAME);
  39.  
  40.   bless $self, $class;
  41.  
  42.   return $self;
  43. }
  44.  
  45. # UID is filled by dispatcher
  46. dbus_method ("get", "uint32", $format);
  47. dbus_method ("set", $format, []);
  48.  
  49. sub get
  50. {
  51.   my ($self, $uid) = @_;
  52.  
  53.   return Users::Users::get_self ($uid);
  54. }
  55.  
  56. sub set
  57. {
  58.   my ($self, @config) = @_;
  59.  
  60.   Users::Users::set_self (@config);
  61. }
  62.  
  63. sub getFiles
  64. {
  65.   my ($self) = @_;
  66.  
  67.   return Users::Users::get_files ();
  68. }
  69.  
  70. my $config = SelfConfig->new ();
  71.  
  72. 1;
  73.