[goffice] Canvas: fix interface derivation.



commit e2c764c5ce7e40d32add7a855bb51f0bee582f74
Author: Morten Welinder <terra gnome org>
Date:   Mon Sep 14 21:55:25 2009 -0400

    Canvas: fix interface derivation.

 ChangeLog                 |    7 +++++++
 goffice/canvas/goc-text.c |   16 +++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f26c39..ec10108 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-09-14  Morten Welinder  <terra gnome org>
+
+	* goffice/canvas/goc-text.c (goc_text_class_init): Don't cast
+	klass pointer to parent's interface type and expect to get the
+	right thing!  Instead, make this implement the interface here and
+	override the method we want to handle.
+
 2009-09-13  Morten Welinder  <terra gnome org>
 
 	* goffice/canvas/goc-widget.c (goc_widget_get_property): Add
diff --git a/goffice/canvas/goc-text.c b/goffice/canvas/goc-text.c
index 34dbc78..a3e2da5 100644
--- a/goffice/canvas/goc-text.c
+++ b/goffice/canvas/goc-text.c
@@ -380,7 +380,6 @@ static void
 goc_text_class_init (GocItemClass *item_klass)
 {
 	GObjectClass *obj_klass = (GObjectClass *) item_klass;
-	GOStyledObjectClass *gso_klass = (GOStyledObjectClass *) item_klass;
 	GocStyledItemClass *gsi_klass = (GocStyledItemClass *) item_klass;
 	parent_class = g_type_class_peek_parent (item_klass);
 
@@ -446,7 +445,6 @@ goc_text_class_init (GocItemClass *item_klass)
 			GSF_PARAM_STATIC | G_PARAM_READWRITE));
 
 	gsi_klass->init_style = goc_text_init_style;
-	gso_klass->style_changed = goc_text_style_changed;
 
 	item_klass->update_bounds = goc_text_update_bounds;
 	item_klass->distance = goc_text_distance;
@@ -455,6 +453,14 @@ goc_text_class_init (GocItemClass *item_klass)
 	item_klass->unrealize = goc_text_unrealize;
 }
 
-GSF_CLASS (GocText, goc_text,
-	   goc_text_class_init, NULL,
-	   GOC_TYPE_STYLED_ITEM)
+static void
+goc_text_item_so_init (GOStyledObjectClass *iface)
+{
+	iface->style_changed = goc_text_style_changed;
+	/* Rest of interface is defined by parent class.  */
+}
+
+GSF_CLASS_FULL (GocText, goc_text, NULL, NULL,
+		goc_text_class_init, NULL, NULL,
+		GOC_TYPE_STYLED_ITEM, 0,
+		GSF_INTERFACE (goc_text_item_so_init, GO_TYPE_STYLED_OBJECT))



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