|
Packit Service |
1d8f1c |
# vim:set et sts=4 sw=4:
|
|
Packit Service |
1d8f1c |
#
|
|
Packit Service |
1d8f1c |
# ibus - The Input Bus
|
|
Packit Service |
1d8f1c |
#
|
|
Packit Service |
1d8f1c |
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit Service |
1d8f1c |
# Copyright (c) 2007-2010 Red Hat, Inc.
|
|
Packit Service |
1d8f1c |
#
|
|
Packit Service |
1d8f1c |
# This library is free software; you can redistribute it and/or
|
|
Packit Service |
1d8f1c |
# modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
# License as published by the Free Software Foundation; either
|
|
Packit Service |
1d8f1c |
# version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d8f1c |
#
|
|
Packit Service |
1d8f1c |
# This library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d8f1c |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d8f1c |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d8f1c |
# Lesser General Public License for more details.
|
|
Packit Service |
1d8f1c |
#
|
|
Packit Service |
1d8f1c |
# You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
# License along with this library; if not, write to the Free Software
|
|
Packit Service |
1d8f1c |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit Service |
1d8f1c |
# USA
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
__all__ = (
|
|
Packit Service |
1d8f1c |
"NotificationsBase",
|
|
Packit Service |
1d8f1c |
"IBUS_SERVICE_NOTIFICATIONS",
|
|
Packit Service |
1d8f1c |
"IBUS_PATH_NOTIFICATIONS"
|
|
Packit Service |
1d8f1c |
)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBUS_SERVICE_NOTIFICATIONS = "org.freedesktop.IBus.Notifications"
|
|
Packit Service |
1d8f1c |
IBUS_PATH_NOTIFICATIONS = "/org/freedesktop/IBus/Notifications"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
import ibus
|
|
Packit Service |
1d8f1c |
from ibus import interface
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
class NotificationsBase(ibus.Object):
|
|
Packit Service |
1d8f1c |
def __init__(self, bus):
|
|
Packit Service |
1d8f1c |
super(NotificationsBase, self).__init__()
|
|
Packit Service |
1d8f1c |
self.__proxy = NotificationsProxy(self, bus.get_dbusconn())
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
|
|
Packit Service |
1d8f1c |
pass
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def close_notification(self, id):
|
|
Packit Service |
1d8f1c |
pass
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def notification_closed(self, id, reason):
|
|
Packit Service |
1d8f1c |
self.__proxy.NotificationClosed(id, reason)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def action_invoked(self, id, action_key):
|
|
Packit Service |
1d8f1c |
self.__proxy.ActionInvoked(id, action_key)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
class NotificationsProxy(interface.INotifications):
|
|
Packit Service |
1d8f1c |
def __init__ (self, notify, dbusconn):
|
|
Packit Service |
1d8f1c |
super(NotificationsProxy, self).__init__(dbusconn, IBUS_PATH_NOTIFICATIONS)
|
|
Packit Service |
1d8f1c |
self.__dbusconn = dbusconn
|
|
Packit Service |
1d8f1c |
self.__notify = notify
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def Notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
|
|
Packit Service |
1d8f1c |
return self.__notify.notify(replaces_id, app_icon, summary, body, actions, expire_timeout)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
def CloseNotification(self, id):
|
|
Packit Service |
1d8f1c |
return self.__notify.close_notification(id)
|