1# This file is part of Xpra. 2# Copyright (C) 2011-2021 Antoine Martin <antoine@xpra.org> 3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any 4# later version. See the file COPYING for details. 5 6#pylint: disable=wrong-import-position 7 8import gi 9gi.require_version('Notify', '0.7') 10from gi.repository import Notify #@UnresolvedImport 11 12from xpra.notifications.notifier_base import NotifierBase 13 14 15class GTK3_Notifier(NotifierBase): 16 17 def show_notify(self, dbus_id, tray, nid, 18 app_name, replaces_nid, app_icon, 19 summary, body, actions, hints, timeout, icon): 20 if not self.dbus_check(dbus_id): 21 return 22 icon_string = self.get_icon_string(nid, app_icon, icon) 23 Notify.init(app_name or "Xpra") 24 n = Notify.Notification.new(summary, body, icon_string) 25 def closed(*_args): 26 self.clean_notification(nid) 27 n.connect("closed", closed) 28 n.show() 29 30 31 def close_notify(self, nid): 32 self.clean_notification(nid) 33 34 def cleanup(self): 35 Notify.uninit() 36 super().cleanup() 37