Philipp Hörist pushed to branch master at gajim / gajim
Commits:
9d3e996d by wurstsalat at 2022-05-17T09:59:48+02:00
fix: Windows: Hide status icon on shutdown
Fixes #10862
- - - - -
2 changed files:
- gajim/common/application.py
- gajim/gtk/status_icon.py
Changes:
=====================================
gajim/common/application.py
=====================================
@@ -83,6 +83,8 @@ def _log(self) -> logging.Logger:
return app.log('gajim.application')
def start_shutdown(self, *args: Any, **kwargs: Any) -> None:
+ app.app.systray.shutdown()
+
accounts_to_disconnect: dict[str, Client] = {}
for account, client in app.connections.items():
=====================================
gajim/gtk/status_icon.py
=====================================
@@ -93,6 +93,9 @@ def _on_unread_count_changed(self, *args: Any) -> None:
def is_visible(self) -> bool:
return self._backend.is_visible()
+ def shutdown(self) -> None:
+ self._backend.shutdown()
+
class NoneBackend:
def update_state(self, count: int = 0) -> None:
@@ -101,6 +104,9 @@ def update_state(self, count: int = 0) -> None:
def is_visible(self) -> bool:
return False
+ def shutdown(self) -> None:
+ pass
+
class GtkMenuBackend(EventHelper):
def __init__(self) -> None:
@@ -215,6 +221,7 @@ class GtkStatusIcon(GtkMenuBackend):
def __init__(self) -> None:
GtkMenuBackend.__init__(self)
self._hide_menuitem_added = False
+ self._shutdown = False
self._status_icon = Gtk.StatusIcon()
self._status_icon.set_tooltip_text('Gajim') # Needed for Windows
@@ -225,6 +232,10 @@ def __init__(self) -> None:
self.update_state()
def update_state(self, count: int = 0) -> None:
+ if self._shutdown:
+ # Shutdown in progress, don't update icon
+ return
+
if app.settings.get('trayicon') == 'never':
self._status_icon.set_visible(False)
return
@@ -242,6 +253,11 @@ def update_state(self, count: int = 0) -> None:
def is_visible(self) -> bool:
return self._status_icon.get_visible()
+ def shutdown(self) -> None:
+ # Necessary on Windows in order to remove icon from tray on shutdown
+ self._shutdown = True
+ self._status_icon.set_visible(False)
+
def _on_size_changed(self,
_status_icon: Gtk.StatusIcon,
size: int) -> None:
@@ -317,3 +333,6 @@ def update_state(self, count: int = 0) -> None:
def is_visible(self) -> bool:
status = self._status_icon.get_status()
return status == appindicator.IndicatorStatus.ACTIVE
+
+ def shutdown(self) -> None:
+ pass
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9d3e996dd14bdb4c8b6deba12ec0d9c22eb6c5c5
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9d3e996dd14bdb4c8b6deba12ec0d9c22eb6c5c5
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits