From f8ad5ddb37020e5546e860bcb8b14f707711ac6f Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 14 Oct 2008 18:56:09 +0000 Subject: [PATCH] Changing filenames of files within a folder will keep the file in the folder. --- deluge/ui/gtkui/files_tab.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 6e87d432b..8974413a5 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -476,7 +476,20 @@ class FilesTab(Tab): def _on_filename_edited(self, renderer, path, new_text): index = self.treestore[path][5] - client.rename_files(self.torrent_id, [(index, new_text)]) + itr = self.treestore.get_iter(path) + # Recurse through the treestore to get the actual path of the file + def get_filepath(i, fp): + if self.treestore.iter_parent(i): + fp = get_filepath(self.treestore.iter_parent(i), fp) + else: + fp += self.treestore[i][0] + return fp + return fp + + filepath = get_filepath(itr, str()) + new_text + log.debug("filepath: %s", filepath) + + client.rename_files(self.torrent_id, [(index, filepath)]) self._editing_index = None def _on_filename_editing_start(self, renderer, editable, path):