1 # vim:set et sts=4 sw=4:
5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2010 Red Hat, Inc.
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
25 "IBUS_SERVICE_NOTIFICATIONS",
26 "IBUS_PATH_NOTIFICATIONS"
29 IBUS_SERVICE_NOTIFICATIONS = "org.freedesktop.IBus.Notifications"
30 IBUS_PATH_NOTIFICATIONS = "/org/freedesktop/IBus/Notifications"
33 from ibus import interface
35 class NotificationsBase(ibus.Object):
36 def __init__(self, bus):
37 super(NotificationsBase, self).__init__()
38 self.__proxy = NotificationsProxy(self, bus.get_dbusconn())
40 def notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
43 def close_notification(self, id):
46 def notification_closed(self, id, reason):
47 self.__proxy.NotificationClosed(id, reason)
49 def action_invoked(self, id, action_key):
50 self.__proxy.ActionInvoked(id, action_key)
52 class NotificationsProxy(interface.INotifications):
53 def __init__ (self, notify, dbusconn):
54 super(NotificationsProxy, self).__init__(dbusconn, IBUS_PATH_NOTIFICATIONS)
55 self.__dbusconn = dbusconn
56 self.__notify = notify
58 def Notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
59 return self.__notify.notify(replaces_id, app_icon, summary, body, actions, expire_timeout)
61 def CloseNotification(self, id):
62 return self.__notify.close_notification(id)