Re: [gtk-perl-xs] A bug with CellRenderer?



so, to solve a situation just like this when porting the textview portion of
gtk-demo, you might notice a bunch of constants defined at the top of the
file and used when setting the font weight on the tags....

 use constant PANGO_WEIGHT_BOLD => 700;
 ...
 $buffer->create_tag ("heading",
                      weight => PANGO_WEIGHT_BOLD
                      ...);

i, for one, don't really like that solution, because now you carry that to
every file.  the next option is to define these as constants in the Pango
module, but you'd have to refer to them with a package name (or export them,
which i would rather not do), a la Gtk2::Pango->SCALE.

i don't like any of those, so you get what you've got.

any better ideas?

personally i would vote for having them defined as EXPORT_OK symbols in the
perl modules, that way they don't really cost anything or clog up the name
space unless you ask for them. you can either import the constants use Gtk2
qw/PANGO_WEIGHT_BOLD etc/ or refer just to them as Gtk2::Pango->WEIGHT_BOLD.
at least something of that nature. i don't really think apps should have to
know what the values are, beyond that it's dangerous if the value were to
change. the perl module could even have code to get them from the c libraries
at compile if it was deemed nec.

-rm






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