Add refresh
This commit is contained in:
parent
8be5a56ac5
commit
0433dee8c1
1 changed files with 21 additions and 2 deletions
|
@ -231,6 +231,23 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
item.connect("notify::saved-position", update_icon)
|
item.connect("notify::saved-position", update_icon)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
|
def _refresh(self):
|
||||||
|
selected = self.selection.full_path
|
||||||
|
self._populate_file_list()
|
||||||
|
|
||||||
|
for i in range(self.list_model.get_n_items()):
|
||||||
|
item = self.list_model.get_item(i)
|
||||||
|
if not item:
|
||||||
|
continue
|
||||||
|
|
||||||
|
file_item = cast(FileItem, item)
|
||||||
|
|
||||||
|
if file_item.full_path == selected:
|
||||||
|
self.list_view.scroll_to(
|
||||||
|
i, Gtk.ListScrollFlags.SELECT | Gtk.ListScrollFlags.FOCUS, None
|
||||||
|
)
|
||||||
|
break
|
||||||
|
|
||||||
def _navigate_to(self, path: Path):
|
def _navigate_to(self, path: Path):
|
||||||
self.directory_history.append(Path(os.getcwd()))
|
self.directory_history.append(Path(os.getcwd()))
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
|
@ -262,8 +279,6 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _on_selection_changed(
|
def _on_selection_changed(
|
||||||
self,
|
self,
|
||||||
selection_model: Gtk.SingleSelection,
|
selection_model: Gtk.SingleSelection,
|
||||||
|
@ -373,6 +388,10 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
self.close()
|
self.close()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
elif keyval == Gdk.keyval_from_name("r"):
|
||||||
|
self._refresh()
|
||||||
|
return True
|
||||||
|
|
||||||
elif keyval == Gdk.keyval_from_name("w"):
|
elif keyval == Gdk.keyval_from_name("w"):
|
||||||
self._toggle_watched_status()
|
self._toggle_watched_status()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue