| ... |
... |
@@ -80,8 +80,7 @@ def _can_use_libindicator() -> bool: |
|
80
|
80
|
app.is_installed('AYATANA_APPINDICATOR'))
|
|
81
|
81
|
|
|
82
|
82
|
def _on_setting_changed(self, *args: Any) -> None:
|
|
83
|
|
- count = app.window.get_total_unread_count()
|
|
84
|
|
- self._backend.update_state(count=count)
|
|
|
83
|
+ self._backend.update_state()
|
|
85
|
84
|
|
|
86
|
85
|
def connect_unread_widget(self, widget: Gtk.Widget, signal: str) -> None:
|
|
87
|
86
|
widget.connect(signal, self._on_unread_count_changed)
|
| ... |
... |
@@ -89,8 +88,7 @@ def connect_unread_widget(self, widget: Gtk.Widget, signal: str) -> None: |
|
89
|
88
|
def _on_unread_count_changed(self, *args: Any) -> None:
|
|
90
|
89
|
if not app.settings.get('trayicon_notification_on_events'):
|
|
91
|
90
|
return
|
|
92
|
|
- count = app.window.get_total_unread_count()
|
|
93
|
|
- self._backend.update_state(count=count)
|
|
|
91
|
+ self._backend.update_state()
|
|
94
|
92
|
|
|
95
|
93
|
def is_visible(self) -> bool:
|
|
96
|
94
|
return self._backend.is_visible()
|
| ... |
... |
@@ -100,7 +98,7 @@ def shutdown(self) -> None: |
|
100
|
98
|
|
|
101
|
99
|
|
|
102
|
100
|
class NoneBackend:
|
|
103
|
|
- def update_state(self, count: int = 0) -> None:
|
|
|
101
|
+ def update_state(self, init: bool = False) -> None:
|
|
104
|
102
|
pass
|
|
105
|
103
|
|
|
106
|
104
|
def is_visible(self) -> bool:
|
| ... |
... |
@@ -133,7 +131,7 @@ def __init__(self) -> None: |
|
133
|
131
|
client.connect_signal('state-changed',
|
|
134
|
132
|
self._on_client_state_changed)
|
|
135
|
133
|
|
|
136
|
|
- def update_state(self, count: int = 0) -> None:
|
|
|
134
|
+ def update_state(self, init: bool = False) -> None:
|
|
137
|
135
|
raise NotImplementedError
|
|
138
|
136
|
|
|
139
|
137
|
def is_visible(self) -> bool:
|
| ... |
... |
@@ -220,9 +218,9 @@ def __init__(self) -> None: |
|
220
|
218
|
self._status_icon.connect('popup-menu', self._on_popup_menu)
|
|
221
|
219
|
self._status_icon.connect('size-changed', self._on_size_changed)
|
|
222
|
220
|
|
|
223
|
|
- self.update_state()
|
|
|
221
|
+ self.update_state(init=True)
|
|
224
|
222
|
|
|
225
|
|
- def update_state(self, count: int = 0) -> None:
|
|
|
223
|
+ def update_state(self, init: bool = False) -> None:
|
|
226
|
224
|
if self._shutdown:
|
|
227
|
225
|
# Shutdown in progress, don't update icon
|
|
228
|
226
|
return
|
| ... |
... |
@@ -233,7 +231,7 @@ def update_state(self, count: int = 0) -> None: |
|
233
|
231
|
|
|
234
|
232
|
self._status_icon.set_visible(True)
|
|
235
|
233
|
|
|
236
|
|
- if count > 0:
|
|
|
234
|
+ if not init and app.window.get_total_unread_count():
|
|
237
|
235
|
self._status_icon.set_from_icon_name('mail-message-new')
|
|
238
|
236
|
return
|
|
239
|
237
|
|
| ... |
... |
@@ -308,16 +306,16 @@ def __init__(self) -> None: |
|
308
|
306
|
self._status_icon.set_secondary_activate_target(
|
|
309
|
307
|
self._ui.toggle_window_menuitem)
|
|
310
|
308
|
|
|
311
|
|
- self.update_state()
|
|
|
309
|
+ self.update_state(init=True)
|
|
312
|
310
|
|
|
313
|
|
- def update_state(self, count: int = 0) -> None:
|
|
|
311
|
+ def update_state(self, init: bool = False) -> None:
|
|
314
|
312
|
if not app.settings.get('show_trayicon'):
|
|
315
|
313
|
self._status_icon.set_status(appindicator.IndicatorStatus.PASSIVE)
|
|
316
|
314
|
return
|
|
317
|
315
|
|
|
318
|
316
|
self._status_icon.set_status(appindicator.IndicatorStatus.ACTIVE)
|
|
319
|
317
|
|
|
320
|
|
- if count > 0:
|
|
|
318
|
+ if not init and app.window.get_total_unread_count():
|
|
321
|
319
|
icon_name = 'mail-message-new'
|
|
322
|
320
|
self._status_icon.set_icon_full(icon_name, _('Pending Event'))
|
|
323
|
321
|
return
|