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 / ServicesConfig.pm < prev    next >
Encoding:
Perl POD Document  |  2011-09-23  |  2.0 KB  |  74 lines

  1. #-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  
  3. # DBus object for the Services config
  4. #
  5. # Copyright (C) 2005 Carlos Garnacho
  6. #
  7. # Authors: Carlos Garnacho Parro  <carlosg@gnome.org>
  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 ServicesConfig;
  24.  
  25. use base qw(StbObject);
  26. use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX);
  27. use Init::Services;
  28. use ServiceConfig;
  29.  
  30. my $OBJECT_NAME = "ServicesConfig";
  31. my $OBJECT_PATH = "$Utils::Backend::DBUS_PATH/$OBJECT_NAME";
  32. my $format = [[ "array", "string" ],
  33.               "string",
  34.               [ "array", $ServiceConfig::SERVICE_FORMAT ]];
  35.  
  36. sub new
  37. {
  38.   my $class = shift;
  39.   my $self  = $class->SUPER::new ($OBJECT_PATH, $OBJECT_NAME);
  40.  
  41.   bless $self, $class;
  42.  
  43. #  Utils::Monitor::monitor_files (&Users::Groups::get_files (),
  44. #                                 $self, $OBJECT_NAME, "changed");
  45.  
  46.   return $self;
  47. }
  48.  
  49. dbus_method ("get", [], $format);
  50. dbus_method ("set", $format, []);
  51. dbus_signal ("changed", []);
  52.  
  53. sub get
  54. {
  55.   my ($self) = @_;
  56.   $self->SUPER::reset_counter ();
  57.  
  58.   return (&Init::Services::get_runlevels (),
  59.           &Init::Services::get_default_runlevel (),
  60.           &Init::Services::get ());
  61. }
  62.  
  63. sub set
  64. {
  65.   my ($self, @config) = @_;
  66.   $self->SUPER::reset_counter ();
  67.  
  68.   &Init::Services::set ($config[2]);
  69. }
  70.  
  71. my $config = ServicesConfig->new ();
  72.  
  73. 1;
  74.