Fix window close, icon toggle logic
"Toggle" should mean "show or hide all windows", not "flip the visibility state of windows". Case: one receiver window is open. When a new receiver is connected, I also expect it to be open. Instead it is hidden, so I click the icon. Now the new receiver window is shown, but the previous one is hidden. Huh?! Indeed, let's fix that.
This commit is contained in:
parent
a4ec8ec05d
commit
a2bad425f6
|
@ -303,7 +303,7 @@ def _create(receiver):
|
||||||
window.set_skip_pager_hint(True)
|
window.set_skip_pager_hint(True)
|
||||||
window.set_keep_above(True)
|
window.set_keep_above(True)
|
||||||
# window.set_decorations(Gdk.DECOR_BORDER | Gdk.DECOR_TITLE)
|
# window.set_decorations(Gdk.DECOR_BORDER | Gdk.DECOR_TITLE)
|
||||||
window.connect('delete-event', _hide)
|
window.connect('delete-event', lambda widget, event: _hide(widget))
|
||||||
|
|
||||||
_windows[receiver.path] = window
|
_windows[receiver.path] = window
|
||||||
return window
|
return window
|
||||||
|
@ -315,19 +315,17 @@ def _destroy(receiver):
|
||||||
w.destroy()
|
w.destroy()
|
||||||
|
|
||||||
|
|
||||||
def toggle_all(trigger):
|
def toggle_all(status_icon):
|
||||||
if not _windows:
|
if not _windows:
|
||||||
return
|
return
|
||||||
|
|
||||||
visible = [w.get_visible() for w in _windows.values()]
|
visible = [w.get_visible() for w in _windows.values()]
|
||||||
if all(visible):
|
if all(visible):
|
||||||
map(_hide, _windows.values())
|
|
||||||
else:
|
|
||||||
for w in _windows.values():
|
for w in _windows.values():
|
||||||
if w.get_visible():
|
|
||||||
_hide(w)
|
_hide(w)
|
||||||
else:
|
else:
|
||||||
_show(w, trigger)
|
for w in _windows.values():
|
||||||
|
_show(w, status_icon)
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue