Re: Glade & new GTK+ 2.5.x features



On Wed, 2004-12-01 at 09:43 +0800, James Henstridge wrote:
> Damon Chaplin wrote:
> 
> >On Tue, 2004-11-30 at 16:50, Havoc Pennington wrote:
> >  
> >
> >>That longstanding bug about removing the need to use GMarkup to do
> >>bold/italic labels would be worth fixing, if it hasn't been already.
> >>    
> >>
> >
> >It's still there:
> >  http://bugzilla.gnome.org/show_bug.cgi?id=97061
> >
> >We never really agreed on how it should be saved in the XML.
> >
> >Matthias suggested something like this, with a fake "global_attributes"
> >property:
> >
> >  <widget class="GtkLabel" id="label1">
> >     <property name="label">label1</property>
> >     <property name="global_attributes">&lt;b&gt; &lt;/b&gt;</property>
> >  </widget>
> >
> >
> >I initially preferred something like this, which looks cleaner, but only
> >supports a predefined number of attributes (e.g. weight/style/font
> >size):
> >
> >  <widget class="GtkLabel" id="label1">
> >     <property name="label">label1</property>
> >     <property name="font_weight">bold</property>
> >  </widget>
> >
> >
> >Now I'm thinking maybe we should use attributes in the XML instead, so
> >it can be used for arbitrary widget/object properties:
> >
> >  <widget class="GtkLabel" id="label1">
> >     <property name="label" markup="&lt;b&gt;">label1</property>
> >  </widget>
> >
> >
> >I don't know though. None of them are that great.
> >  
> >
> Having simple font-weight, font-size and font-style GObject properties 
> on labels is probably the best option.
> 
> How many cases are there where you need more than that, but won't need 
> full markup support?  If you want to apply some attributes to only a 
> section of the string, you are going to have to expose the markup to the 
> translator anyway.
> 
> Going with GObject properties will also make this functionality 
> available to UI not being constructed by glade -- translators get 
> equally annoyed if you make them translate markup in those cases :)

I'm pretty much entirely opposed to adding *yet another* way of setting
font attributes of a label. We already have markup, attribute lists, and
gtk_widget_modify_font(). Adding something that is yet against distinct
from these is insane.

gtk_widget_modify_font(), is in my opinion the right way to make a bold
font from code if you must avoid markup. (I'm still not buying the
argument that making translators preserve markup is horribly evil.)

So, how do we make that accessible from glade/libglade? It could be
done in libglade, entirely. Or you could try add a 'font' ('modifier-
font'?) property to GtkWidget that was exactly tied to
gtk_widget_modify_font(). ("font" would take a string, like
"font" for GtkTextTag, which also has "font-desc").

Regards,
						Owen

[ If it isn't clear 
   gtk_widget_modify_font(widget, 
                          pango_font_description_from-string ("bold"));
  does the right thing ... it changes the weight and leaves
  everything else unchanged ]

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]