Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

changeset: show icons for added and removed files

instead of the single character 'M', 'A' and 'R'.

- Modified files have no icon
- Headers are now invisible

Changeset 734fbd6b4dea

Parent f867acb265ee

by Adrian Buehlmann

Changes to one file · Browse files at 734fbd6b4dea Showing diff from parent f867acb265ee Diff from another changeset...

 
15
16
17
18
 
19
20
21
 
637
638
639
 
640
641
642
 
664
665
666
667
 
 
668
669
670
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
672
673
 
15
16
17
 
18
19
20
21
 
637
638
639
640
641
642
643
 
665
666
667
 
668
669
670
 
 
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
@@ -15,7 +15,7 @@
 from mercurial import cmdutil, util, patch, mdiff    from tortoisehg.util.i18n import _ -from tortoisehg.util import shlib, hglib +from tortoisehg.util import shlib, hglib, paths    from tortoisehg.hgtk import csinfo, gdialog, gtklib, hgcmd, statusbar   @@ -637,6 +637,7 @@
    ## file list   filelist_tree = gtk.TreeView() + filelist_tree.set_headers_visible(False)   filesel = filelist_tree.get_selection()   filesel.connect('changed', self.filelist_rowchanged)   self._filesel = filesel @@ -664,10 +665,37 @@
  gobject.TYPE_STRING, # filename   )   filelist_tree.set_model(self._filelist) - column = gtk.TreeViewColumn(_('Stat'), gtk.CellRendererText(), text=0) + + column = gtk.TreeViewColumn()   filelist_tree.append_column(column) - column = gtk.TreeViewColumn(_('Files'), gtk.CellRendererText(), text=1) - filelist_tree.append_column(column) + + iconcell = gtk.CellRendererPixbuf() + filecell = gtk.CellRendererText() + + column.pack_start(iconcell, expand=False) + column.pack_start(filecell, expand=False) + column.add_attribute(filecell, 'text', 1) + + iconw, iconh = gtk.icon_size_lookup(gtk.ICON_SIZE_SMALL_TOOLBAR) + + def get_pixbuf(iconfilename): + iconpath = paths.get_tortoise_icon(iconfilename) + return gtk.gdk.pixbuf_new_from_file_at_size( + iconpath, iconw, iconh) + + addedpixbuf = get_pixbuf('menuadd.ico') + removedpixbuf = get_pixbuf('menudelete.ico') + + def cell_seticon(column, cell, model, iter): + state = model.get_value(iter, 0) + pixbuf = None + if state == 'A': + pixbuf = addedpixbuf + elif state == 'R': + pixbuf = removedpixbuf + cell.set_property('pixbuf', pixbuf) + + column.set_cell_data_func(iconcell, cell_seticon)     list_frame = gtk.Frame()   list_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)