~ubuntu-branches/ubuntu/wily/hamster-applet/wily

« back to all changes in this revision

Viewing changes to hamster/hamsterdbus.py

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-12-15 17:42:14 UTC
  • mto: (1.1.16 upstream) (20.1.1 lucid-proposed)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20081215174214-ri1ezw1c2pdnl3i6
Tags: upstream-2.25.3
Import upstream version 2.25.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - coding: utf-8 -
 
2
 
 
3
# Copyright (C) 2008, J. Félix Ontañón <fontanon at emergya dot es>
 
4
 
 
5
# This file is part of Project Hamster.
 
6
 
 
7
# Project Hamster 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 3 of the License, or
 
10
# (at your option) any later version.
 
11
 
 
12
# Project Hamster 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 Project Hamster.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
import dbus
 
21
import dbus.service
 
22
 
 
23
HAMSTER_URI = "org.gnome.hamster"
 
24
HAMSTER_PATH = "/org/gnome/hamster"
 
25
 
 
26
class HamsterDbusController(dbus.service.Object):
 
27
    activity = "Undefined"
 
28
    fact = "Undefined"
 
29
 
 
30
    def __init__(self, bus_name):
 
31
        dbus.service.Object.__init__(self, bus_name, HAMSTER_PATH)
 
32
 
 
33
    @dbus.service.method(HAMSTER_URI)
 
34
    def get_activity(self):
 
35
        return self.activity
 
36
 
 
37
    @dbus.service.signal(HAMSTER_URI)
 
38
    def update_activity(self, activity):
 
39
        self.activity = activity
 
40
 
 
41
    @dbus.service.method(HAMSTER_URI)
 
42
    def get_fact(self):
 
43
        return self.fact
 
44
 
 
45
    @dbus.service.signal(HAMSTER_URI)
 
46
    def update_fact(self, fact):
 
47
        self.fact = fact