Re: gtkdatabox and gtk3



Hi,

I had used the gtkdatabox widget a while back for a project of mine, which I will soon need to update to gtk3. I saw the new cairo-alpha branch on sourceforge, and decided to take a stab at updating it.

The attached patches should apply to cairo-alpha (but I had also applied some of the patches from the master branch).

The result seems to compile cleanly. I haven't fixed the Makefiles to generate a shared library, as configure files always look like greek to me. The examples have mostly been updated (except the Gtk+IOStream.C, and colors.c), and all compile cleanly, but you may have to type 'make basics' instead of make all.

Would appreciate help from someone in fixing the build system to use gtk3.

There are four patches to be applied in sequence, the first does the majority of the upgrading, the second is mostly to fix gcc warnings, and the 3rd and 4th fix the examples, as well as some bugs that were revealed by patching the examples.

generally, in addition to the below changes, I updated gtkdatabox_ruler to use cairo_surface, sort of following the example set by Lars-Peter's patches to gtkdatabox.c

change GTK_OBJECT() to G_OBJECT()
change GTK_CAN_DEFAULT to TRUE
eliminate all references to widget-> window (i.e. box->window) by calling gtk_widget_get_window(widget)
eliminate all includes of <gtk/*.h> except <gtk/gtk.h>
change the expose callbacks to draw callbacks (take a cairo_t parameter instead of GdkEventExpose)
change gdk_window_get_pointer to gdk_window_get_device_position
eliminate all references to widget->style and switch to GtkStyleContext from GtkStyle
change GTK_REALIZED to TRUE in calls to gtk_widget_set_realized()
eliminate all references to widget->allocation. Instead allocate an allocation and get it from the widget.
comment out references to colormap
change direct manipulation of adjustment elements (i.e. box->priv->adj_x->lower) to use gtk_adjustment_configure() instead. change gtk_hscrollbar_new to gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL,), etc. replace GdkSegment (now gone) with a privately defined copy GtkDataboxSegment implement _get_preferred_width and _get_preferred_height for gtkdatabox_ruler.c

I didn't bother trying to figure out how to get xthickness/ythickness from a StyleContext, and just defaulted them to 1.

Sincerely,
--
Amish S. Dave, MD, PhD
a m i s h @ a m i s h d a v e . n e t

Attachment: 0001-Many-changes-to-enable-gtkdatabox-to-compile-with-gt.patch.bz2
Description: application/bzip

Attachment: 0002-Miscellaneous-fixes-to-address-gcc-compile-warnings.patch.bz2
Description: application/bzip

Attachment: 0003-Updated-examples-basics2.c-and-this-revealed-need-fo.patch.bz2
Description: application/bzip

Attachment: 0004-Fixed-most-of-the-examples-to-compile-under-gtk3.-Th.patch.bz2
Description: application/bzip



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