/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 diff.py

  • Committer: Vincent Ladeuil
  • Date: 2009-08-25 13:18:28 UTC
  • mfrom: (654.1.3 bzr-gtk)
  • Revision ID: v.ladeuil+lp@free.fr-20090825131828-wd8qbtnmqzcfucfb
(vila) Switch to python sdist

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
from dialog import error_dialog, info_dialog, warning_dialog
47
47
 
48
48
 
 
49
def fallback_guess_language(slm, content_type):
 
50
    for lang_id in slm.get_language_ids():
 
51
        lang = slm.get_language(lang_id)
 
52
        if "text/x-patch" in lang.get_mime_types():
 
53
            return lang
 
54
    return None
 
55
 
 
56
 
49
57
class SelectCancelled(Exception):
50
58
 
51
59
    pass
66
74
        if have_gtksourceview:
67
75
            self.buffer = gtksourceview2.Buffer()
68
76
            slm = gtksourceview2.LanguageManager()
69
 
            gsl = slm.guess_language(content_type="text/x-patch")
 
77
            guess_language = getattr(gtksourceview2.LanguageManager, 
 
78
                "guess_language", fallback_guess_language)
 
79
            gsl = guess_language(slm, content_type="text/x-patch")
70
80
            if have_gconf:
71
81
                self.apply_gedit_colors(self.buffer)
72
82
            self.apply_colordiff_colors(self.buffer)