mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
fixed unintended revealing of back_button in PlaylistWindow
This commit is contained in:
parent
d745ba0981
commit
79183dc422
@ -2429,6 +2429,7 @@ class PlaylistWindow(Gtk.Overlay):
|
|||||||
self.add_overlay(self._back_button_revealer)
|
self.add_overlay(self._back_button_revealer)
|
||||||
|
|
||||||
def _on_show_hide_back_button(self, *args):
|
def _on_show_hide_back_button(self, *args):
|
||||||
|
def callback():
|
||||||
visible_range=self._treeview.get_visible_range() # not always accurate possibly due to a bug in Gtk
|
visible_range=self._treeview.get_visible_range() # not always accurate possibly due to a bug in Gtk
|
||||||
if visible_range is None or self._treeview.get_property("selected-path") is None:
|
if visible_range is None or self._treeview.get_property("selected-path") is None:
|
||||||
self._back_button_revealer.set_reveal_child(False)
|
self._back_button_revealer.set_reveal_child(False)
|
||||||
@ -2443,13 +2444,13 @@ class PlaylistWindow(Gtk.Overlay):
|
|||||||
self._back_button_revealer.set_reveal_child(True)
|
self._back_button_revealer.set_reveal_child(True)
|
||||||
else: # current song is visible
|
else: # current song is visible
|
||||||
self._back_button_revealer.set_reveal_child(False)
|
self._back_button_revealer.set_reveal_child(False)
|
||||||
|
GLib.idle_add(callback) # workaround for the Gtk bug from above
|
||||||
|
|
||||||
def _on_back_to_current_song_button_clicked(self, *args):
|
def _on_back_to_current_song_button_clicked(self, *args):
|
||||||
self._treeview.set_cursor(Gtk.TreePath(len(self._treeview.get_model())), None, False) # unset cursor
|
self._treeview.set_cursor(Gtk.TreePath(len(self._treeview.get_model())), None, False) # unset cursor
|
||||||
if self._treeview.get_property("selected-path") is not None:
|
if self._treeview.get_property("selected-path") is not None:
|
||||||
self._treeview.get_selection().select_path(self._treeview.get_property("selected-path"))
|
self._treeview.get_selection().select_path(self._treeview.get_property("selected-path"))
|
||||||
self._treeview.scroll_to_selected_title()
|
self._treeview.scroll_to_selected_title()
|
||||||
self._back_button_revealer.set_reveal_child(False) # workaround for Gtk bug in _on_show_hide_back_button
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# cover and lyrics #
|
# cover and lyrics #
|
||||||
|
Loading…
Reference in New Issue
Block a user