1 # vim:set et sts=4 sw=4:
5 # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
12 # This library 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 Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 # Boston, MA 02111-1307 USA
24 "IBUS_NOTIFICATIONS_NAME",
25 "IBUS_NOTIFICATIONS_PATH"
28 IBUS_NOTIFICATIONS_NAME = "org.freedesktop.ibus.Notifications"
29 IBUS_NOTIFICATIONS_PATH = "/org/freedesktop/ibus/Notifications"
32 from ibus import interface
34 class NotificationsBase(ibus.Object):
35 def __init__(self, bus):
36 super(NotificationsBase, self).__init__()
37 self.__proxy = NotificationsProxy(self, bus.get_dbusconn())
39 def notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
42 def close_notification(self, id):
45 def notification_closed(self, id, reason):
46 self.__proxy.NotificationClosed(id, reason)
48 def action_invoked(self, id, action_key):
49 self.__proxy.ActionInvoked(id, action_key)
51 class NotificationsProxy(interface.INotifications):
52 def __init__ (self, notify, dbusconn):
53 super(NotificationsProxy, self).__init__(dbusconn, IBUS_NOTIFICATIONS_PATH)
54 self.__dbusconn = dbusconn
55 self.__notify = notify
57 def Notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
58 return self.__notify.notify(replaces_id, app_icon, summary, body, actions, expire_timout)
60 def CloseNotification(self, id):
61 return self.__notify.close_notification(id)