Re: convenience API for applying PangoAttributes to a GtkLabel



On Mon, 2007-03-12 at 23:09 +0100, Sven Neumann wrote:
> libgimpwidgets includes an API for conveniently apply PangoAttributes to
> a GtkLabel and I wonder if I should propose it for inclusion in GTK+:
> 
> http://developer.gimp.org/api/2.0/libgimpwidgets/libgimpwidgets-GimpWidgets.html#gimp-label-set-attributes
> 
> It is IMO more convenient than using g_strdup_printf() to embed a string
> into PangoMarkup. Here's a short example to make a label large and bold:
> 
>   gimp_label_set_attributes (GTK_LABEL (label),
>                              PANGO_ATTR_SCALE,  PANGO_SCALE_LARGE,
>                              PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
>                              -1);
> 
> The implementation can be reviewed in
> http://svn.gnome.org/viewcvs/gimp/trunk/libgimpwidgets/gimpwidgets.c?view=markup

Oh, very nice.  This could remove the manual PangoAttribute-fu in
matchbox-desktop-2, and as Bastien says remove the markup in SJ's Glade
files.

As the arguments are a list of (PangoAttrType, value) tuples would it
makes sense to terminate with PANGO_ATTR_INVALID (which is 0), rather
than -1?

Does gcc differentiate between 0 and NULL when you mark a function with
G_GNUC_NULL_TERMINATED?  I've a feeling it would (due to the different
types) but I'm not sure.

Ross
-- 
Ross Burton                                 mail: ross burtonini com
                                          jabber: ross burtonini com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF

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]