Re: upgrade gtk 1.2 code to 2.2, conditional compilation?



On Tue, 2003-03-18 at 13:07, Filip Hroch wrote:
Hi,

I've a gtk1.2 application with GtkStyle->font structure member
(in non-important part of code). I know it isn't a right way
on gtk1.2 but I'd not found other way. Also, the 'font' isn't more
in GtkStyle class for 2.2 version.

This is a problematic part of code:

  /* set optimal column width */
  for( i = 0; i < NT; i++ ) {
    ipix = gdk_string_width(style->font,title[i]);
    gtk_clist_set_column_width (GTK_CLIST(clist),i,ipix);
  }

Is there some way (conditional compilation both versions for example) 
for correction?

Is there some way to smoothly upgrade the code to more portable shape
usable for a portable code?

A) Trying to make code compile with GTK+-1.2 and GTK+-2.2 at the
   same time is just a bad idea. You do work without being able
   to take advantage of the improvements in GTK+-2.2.

B) gtk_widget_create_pango_layout() and pango_layout_get_pixel_size()
   (followed by g_object_unref() the layout) is the right way
   to get the size of a string in GTK+-2.x

Regards,
                                                Owen
 




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