/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to annotate/gannotate.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-12-01 13:02:40 UTC
  • mto: (66.6.5 gtk)
  • mto: This revision was merged to the branch mainline in revision 128.
  • Revision ID: v.ladeuil+lp@free.fr-20061201130240-puzlcnak4vcp51ct
Minimal fix for bug #73965.

* annotate/gannotate.py:
(GAnnotateWindow._create_annotate_view): Make the TEXT_LINE_COL
the searchable column.
(GAnnotateWindow._match_text): New sub to make the text column
searchable on a key contained in the line instead of being the
start of the line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
292
292
        col.add_attribute(cell, "text", TEXT_LINE_COL)
293
293
        tv.append_column(col)
294
294
 
295
 
        tv.set_search_column(LINE_NUM_COL)
296
 
        
 
295
        tv.set_search_column(TEXT_LINE_COL)
 
296
        tv.set_search_equal_func(self._match_text)
 
297
 
297
298
        return tv
298
299
 
 
300
    def _match_text(self, model, column, key, iterator):
 
301
        """Returns 0 if text entered by user matches the line."""
 
302
 
 
303
        line, = self.annomodel.get(iterator, column)
 
304
        if line == '':
 
305
            match = False
 
306
        else:
 
307
            match = (line.find(key) != -1)
 
308
        # Gtk excepts False when we match
 
309
        return not match
 
310
 
299
311
    def _create_span_selector(self):
300
312
        ss = SpanSelector()
301
313
        ss.connect("span-changed", self._span_changed_cb)