[Glade-devel] ( libglade ) Small issue with Gtk2::GladeXML and glade-3 ... text markup not working
- From: ali at juiblex.co.uk (J. Ali Harlow)
- Subject: [Glade-devel] ( libglade ) Small issue with Gtk2::GladeXML and glade-3 ... text markup not working
- Date: Mon May 22 14:33:10 2006
On 22/05/06 06:13:09, Daniel Kasak wrote:
When I try to use markup in a label ( eg to make the text bold ), I
get the expected results both in the glade-3 builder, and if I view
the project in the glade-2 builder, but when I use Gtk2::GladeXML to
construct a window based on a glade-3 xml file, the markup is not
being used.
I ran into this recently. It seems to be because glade-3 is outputing
"pattern" as the empty string whereas it needs to be NULL (not in the
glade file) for GtkLabel to honour markup (or underlining). I just
added a rule to the xslt file that I use to remove empty patterns.
Something like this should work (untested):
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://glade.gnome.org/glade-2.0.dtd"
exclude-result-prefixes="#default">
<xsl:output method="xml" standalone="no"
doctype-system="http://glade.gnome.org/glade-2.0.dtd"/>
<!-- Elide some default attributes that the DTD introduces -->
<xsl:template match="@context[.='no']"/>
<xsl:template match="@translatable[.='no']"/>
<xsl:template match="@after[.='no']"/>
<!-- Preserve attributes -->
<xsl:template match="@*">
<xsl:copy/>
</xsl:template>
<!-- Copy -->
<xsl:template match="*">
<xsl:choose>
<!-- Drop empty label patterns (from glade-3) which kill markup
etc. -->
<xsl:when test="name()='property' and @name='pattern' and
not(text()) and parent::node()[name()='widget' and @class='GtkLabel']"/
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:transform>
HTH,
Ali.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]