~tualatrix/ubuntu-tweak/arb-packaging

« back to all changes in this revision

Viewing changes to ubuntutweak/backends/getconfig.py

  • Committer: TualatriX
  • Date: 2009-10-22 14:14:56 UTC
  • Revision ID: git-v1:455f01496d7149fb9832dabdf1bf0eef506a0101
WIP, make most things works

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
# Ubuntu Tweak - PyGTK based desktop configure tool
 
4
#
 
5
# Copyright (C) 2007-2008 TualatriX <tualatrix@gmail.com>
 
6
#
 
7
# Ubuntu Tweak is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 2 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# Ubuntu Tweak is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with Ubuntu Tweak; if not, write to the Free Software Foundation, Inc.,
 
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
20
 
 
21
import sys
 
22
reload(sys)
 
23
sys.setdefaultencoding('utf8')
 
24
import os
 
25
import dbus
 
26
import dbus.glib
 
27
import dbus.service
 
28
import dbus.mainloop.glib
 
29
import gobject
 
30
 
 
31
INTERFACE = "com.ubuntu_tweak.daemon.getconfig"
 
32
PATH = "/com/ubuntu_tweak/daemon/getconfig"
 
33
 
 
34
class GetConfig(dbus.service.Object):
 
35
    def __init__ (self, bus):
 
36
        bus_name = dbus.service.BusName(INTERFACE, bus=bus)
 
37
        dbus.service.Object.__init__(self, bus_name, PATH)
 
38
 
 
39
    @dbus.service.method(INTERFACE,
 
40
                         in_signature='s', out_signature='b')
 
41
    def is_exists(self, path):
 
42
        return os.path.exists(path)
 
43
 
 
44
if __name__ == '__main__':
 
45
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
46
    GetConfig(dbus.SystemBus())
 
47
 
 
48
    mainloop = gobject.MainLoop()
 
49
    mainloop.run()