manatools / dnfdragora

dnfdragora is a dnf frontend based on libyui abstraction
GNU General Public License v3.0
137 stars 41 forks source link

make notification balloons hide automatically in few seconds #180

Closed alexmalykh closed 3 years ago

alexmalykh commented 3 years ago

A possible fix for #178. Added a subclass of pystray.Icon with .notify() method overriden. It schedules a calling of .remove_notification() using threading.Timer right away after creating a notification request. Not sure if it is thread-safe, but it looks working.

anaselli commented 3 years ago

First of all thanks for quick patch, it looks good to me. Regarding thread safe, well since the calls seem synched i think the problem could be on self._nid tha should be a GVariant * if I'm not wrong, so always if i'm not wrong the risk could be on calling hide() (remove_notification) with a null pointer (and that can be tested apart using pystray) or while another notifcation arrives before timer expiring. Maybe this last can be tested by pressing check for updates soon after the notification rises and increasing the timer expiration time to make it happening. Another test that can be performed could be to exit dnfdragora-updater before the timer expires, just to be sure thread it does not hang.

If we have no crashes i think we can also assume to loose a balloon from time to time maybe... :) Thanks again

alexmalykh commented 3 years ago

Ok, thanks.