hendrikschneider
hendrikschneider

Reputation: 1846

Update Gedit side panel

I'm writing my first gedit plugin, a directory browser for the sidebar.

Show sidepanel with content of the cwd.

self._side_widget = self.get_dir() #returns a Gtk.Treestore obj

self.side_panel = self.window.get_side_panel()

self.side_panel.add_item(self._side_widget, "dir-browser", "Directory Browser", None)

self.side_panel.activate_item(self._side_widget)

With a double click on a file, i open the document in gedit.

With a double click on a directory I change the directory and I want to update the content of the side panel.

I can build the a new treestore from the current working directory with self.get_dir() but I don't know how to update self.side_panel.

Upvotes: 0

Views: 593

Answers (1)

ptomato
ptomato

Reputation: 57890

Either empty the current tree store and fill it again from the new directory, or call set_model(new_treestore) on the tree view widget. It will update itself.

Upvotes: 1

Related Questions