Hi All,
I reported bug #813212 https://bugs.launchpad.net/inkscape/+bug/813212 a couple of days ago, which deals with the deprecation of GtkObject in GTK+ 3. I have taken a quick look at fixing the problem, but there a couple of things I'm not confident about. Perhaps someone with more GTK+ experience could help out here?
One of the main issues here is that SPCanvasItem (our custom implementation of GnomeCanvas) is a subclass of GtkObject. GNOME Evolution got round this problem in their own copy of GnomeCanvas by changing the parent class to GObject. This introduces a couple of issues that I could use some help with:
1) What do we do about the "::destroy" signal? GObject has no such signal... there is a "::dispose", but is it functionally equivalent? Can we just rename all the gtk_object_destroy calls to g_object_run_dispose, and replace the custom GtkObject.destroy implementations with GObject.dispose? Does the same apply for GtkObjectClass and GObjectClass?
2) What do we do about the GtkObjectFlags enumeration? This is deprecated, and no equivalent is available in GObject. Can we just add a typedef for a "SPCanvasItemFlags" enumeration in sp-canvas-item.h, and add a "guint32 flags" member to SPCanvasItem?
Thanks,
Alex
On Thu, 2011-07-21 at 13:35 +0100, Alex Valavanis wrote:
One of the main issues here is that SPCanvasItem (our custom implementation of GnomeCanvas) is a subclass of GtkObject. GNOME Evolution got round this problem in their own copy of GnomeCanvas by changing the parent class to GObject. This introduces a couple of issues that I could use some help with:
- What do we do about the "::destroy" signal? GObject has no such
signal... there is a "::dispose", but is it functionally equivalent? Can we just rename all the gtk_object_destroy calls to g_object_run_dispose, and replace the custom GtkObject.destroy implementations with GObject.dispose? Does the same apply for GtkObjectClass and GObjectClass?
They're slightly different, but for most people they should be equivalent. To over-simplify a bit, dispose is when you give up your references and destroy is when you free your memory. Most people just care about "when is this going to die" which both signify. The reason for two is to clean up inter-dependencies.
I would guess, and I haven't looked closely enough to know, that it would make sense to have the Canvas widget and perhaps others inherit from GtkWidget instead of GtkObject. This would retain some of the destroy functionality. With the new Cairo renderer this could be a huge gain as basically all a Widget is in GTK3 is a Cairo surface....
- What do we do about the GtkObjectFlags enumeration? This is
deprecated, and no equivalent is available in GObject. Can we just add a typedef for a "SPCanvasItemFlags" enumeration in sp-canvas-item.h, and add a "guint32 flags" member to SPCanvasItem?
Yes, I think making a new flags enum makes the most sense.
--Ted
2011/7/21 Ted Gould <ted@...11...>:
I would guess, and I haven't looked closely enough to know, that it would make sense to have the Canvas widget and perhaps others inherit from GtkWidget instead of GtkObject. This would retain some of the destroy functionality. With the new Cairo renderer this could be a huge gain as basically all a Widget is in GTK3 is a Cairo surface....
I am working on replacing the entire SPCanvasItem / NRArenaItem hierarchy with plain C++ classes right now, so making any large changes to this area of code might not be very productive. I expect to merge this rewrite before 0.49.
The canvas widget (SPCanvas) derives from GtkWidget right now, but it looks like it would be better to derive from GtkDrawingArea.
Regards, Krzysztof
participants (3)
-
Alex Valavanis
-
Krzysztof Kosiński
-
Ted Gould