- self.swin = gtk.ScrolledWindow()
- self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self.swin.add(treeview)
-### self.swin.show_all()
- self.toplevel = self.swin
-
-# #=== Functions ============================================================
-# def show_results(self, filelist):
-# self.liststore.clear()
-# for path, size, bsize in filelist:
-# print path, size, bsize
-# self.liststore.append([path, size, bsize])
+ # Add treeview to scrolled window
+ swin = gtk.ScrolledWindow()
+ swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ swin.add(treeview)
+
+ #====================
+ # Toolbar
+ #====================
+
+ toolbar = gtk.Toolbar()
+ relpaths_tbtn = gtk.RadioToolButton(None)
+ abspaths_tbtn = gtk.RadioToolButton(relpaths_tbtn)
+
+ relpaths_tbtn.set_label(_('Relative paths'))
+ abspaths_tbtn.set_label(_('Absolute paths'))
+
+ relpaths_tbtn.connect('clicked', self._show_relpaths)
+ abspaths_tbtn.connect('clicked', self._show_abspaths)
+
+ toolbar.insert(relpaths_tbtn, -1)
+ toolbar.insert(abspaths_tbtn, -1)
+
+ #====================
+ # Others
+ #====================
+
+ vbox = gtk.VBox(False, 4)
+ vbox.pack_start(swin, True, True, 0)
+ vbox.pack_start(toolbar, False, False, 0)
+
+ self.toplevel = vbox
+
+ #=== Functions ============================================================
+
+ def _show_relpaths(self, btn):
+ self.liststore.clear()
+ for bsize, path, size in self.filelist:
+ self.liststore.append([path.replace(self.start_path,'', 1),
+ size, bsize])
+
+ def _show_abspaths(self, btn):
+ self.liststore.clear()
+ for bsize, path, size in self.filelist:
+ #self.liststore.append([abspath(path), size, bsize])
+ # Mark absolute part of path with color
+ self.liststore.append([
+ '<span background="lawngreen">' + abspath(self.start_path) + '</span>' +
+ path.replace(self.start_path,'', 1),
+ size, bsize])