workaround for bug that leads to segphault

svn: r19964
This commit is contained in:
Benny Malengier 2012-07-09 22:51:21 +00:00
parent 458ac1cdf0
commit 3430acd2d5

View File

@ -174,12 +174,23 @@ class StyledTextEditor(Gtk.TextView):
(GObject.TYPE_PYOBJECT,)), # arguments (GObject.TYPE_PYOBJECT,)), # arguments
} }
FONTS = None
def __init__(self): def __init__(self):
"""Setup initial instance variable values.""" """Setup initial instance variable values."""
self.textbuffer = UndoableStyledBuffer() self.textbuffer = UndoableStyledBuffer()
self.textbuffer.connect('style-changed', self._on_buffer_style_changed) self.textbuffer.connect('style-changed', self._on_buffer_style_changed)
self.textbuffer.connect('changed', self._on_buffer_changed) self.textbuffer.connect('changed', self._on_buffer_changed)
GObject.GObject.__init__(self, buffer=self.textbuffer) GObject.GObject.__init__(self, buffer=self.textbuffer)
if StyledTextEditor.FONTS is None:
#TODO GTK3: How to do this different?
#workaround for bug https://bugzilla.gnome.org/show_bug.cgi?id=679654
#but still gives error on output:
#/usr/local/lib/python2.7/site-packages/gi/types.py:47:
# Warning: g_value_get_object: assertion `G_VALUE_HOLDS_OBJECT (value)' failed
StyledTextEditor.FONTS = [f.get_name() for f in
self.get_pango_context().list_families()]
StyledTextEditor.FONTS.sort()
self.match = None self.match = None
self.last_match = None self.last_match = None
@ -472,14 +483,12 @@ class StyledTextEditor(Gtk.TextView):
] ]
# ...last the custom actions, which have custom proxies # ...last the custom actions, which have custom proxies
items = [f.get_name() for f in self.get_pango_context().list_families()]
items.sort()
default = StyledTextTagType.STYLE_DEFAULT[StyledTextTagType.FONTFACE] default = StyledTextTagType.STYLE_DEFAULT[StyledTextTagType.FONTFACE]
fontface_action = ValueAction(str(StyledTextTagType.FONTFACE), fontface_action = ValueAction(str(StyledTextTagType.FONTFACE),
_("Font family"), _("Font family"),
default, default,
ToolComboEntry, ToolComboEntry,
items, StyledTextEditor.FONTS,
False, #editable False, #editable
True, #shortlist True, #shortlist
None) # validator None) # validator