forked from cromer/pamac-classic
use GObjectIntrospection API for pamac-tray notifications
This commit is contained in:
parent
30c28341c7
commit
8f48135ef0
6
pamac-tray.py
Executable file → Normal file
6
pamac-tray.py
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
from gi.repository import Gtk, GObject
|
from gi.repository import Gtk, GObject, Notify
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
import dbus
|
import dbus
|
||||||
from pamac import common, transaction
|
from pamac import common, transaction
|
||||||
@ -82,17 +82,17 @@ def set_icon(updates):
|
|||||||
else:
|
else:
|
||||||
info = update_info.format(number = updates)
|
info = update_info.format(number = updates)
|
||||||
if not common.pid_file_exists():
|
if not common.pid_file_exists():
|
||||||
Popen(['notify-send', '-i', '/usr/share/pamac/icons/32x32/apps/pamac-updater.png', '-u', 'normal', _('Update Manager'), info])
|
Notify.Notification.new(_('Update Manager'), info, '/usr/share/pamac/icons/32x32/apps/pamac-updater.png').show()
|
||||||
else:
|
else:
|
||||||
icon = noupdate_icon
|
icon = noupdate_icon
|
||||||
info = noupdate_info
|
info = noupdate_info
|
||||||
print(info)
|
print(info)
|
||||||
tray.update_icon(icon, info)
|
tray.update_icon(icon, info)
|
||||||
return False
|
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
bus.add_signal_receiver(set_icon, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
|
bus.add_signal_receiver(set_icon, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
|
||||||
tray = Tray()
|
tray = Tray()
|
||||||
|
Notify.init(_('Update Manager'))
|
||||||
refresh()
|
refresh()
|
||||||
GObject.timeout_add(3*3600*1000, refresh)
|
GObject.timeout_add(3*3600*1000, refresh)
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user