From ecd7e11a6184f98464d8054b733d8c6851eb0d9c Mon Sep 17 00:00:00 2001 From: joncruz Date: Sat, 10 May 2008 05:20:16 +0000 Subject: [PATCH] More type registration cleanup --- src/dialogs/sp-attribute-widget.cpp | 48 ++++++++++++++++------------- src/display/sodipodi-ctrlrect.cpp | 26 +++++++++------- src/sp-polygon.cpp | 24 ++++++++------- src/svg-view-widget.cpp | 33 +++++++++++--------- 4 files changed, 72 insertions(+), 59 deletions(-) diff --git a/src/dialogs/sp-attribute-widget.cpp b/src/dialogs/sp-attribute-widget.cpp index 4424aaa1b..9848d9f26 100644 --- a/src/dialogs/sp-attribute-widget.cpp +++ b/src/dialogs/sp-attribute-widget.cpp @@ -46,23 +46,25 @@ static GtkEntryClass *parent_class; -GtkType -sp_attribute_widget_get_type (void) +GType sp_attribute_widget_get_type(void) { static GtkType type = 0; if (!type) { - static const GtkTypeInfo info = { - "SPAttributeWidget", - sizeof (SPAttributeWidget), - sizeof (SPAttributeWidgetClass), - (GtkClassInitFunc) sp_attribute_widget_class_init, - (GtkObjectInitFunc) sp_attribute_widget_init, - NULL, NULL, NULL + GTypeInfo info = { + sizeof(SPAttributeWidgetClass), + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_attribute_widget_class_init, + 0, // class_finalize + 0, // class_data + sizeof(SPAttributeWidget), + 0, // n_preallocs + (GInstanceInitFunc)sp_attribute_widget_init, + 0 // value_table }; - type = gtk_type_unique (GTK_TYPE_ENTRY, &info); + type = g_type_register_static(GTK_TYPE_ENTRY, "SPAttributeWidget", &info, static_cast(0)); } return type; - } // end of sp_attribute_widget_get_type() @@ -365,23 +367,25 @@ static GtkVBoxClass *table_parent_class; -GtkType -sp_attribute_table_get_type (void) +GType sp_attribute_table_get_type(void) { static GtkType type = 0; if (!type) { - static const GtkTypeInfo info = { - "SPAttributeTable", - sizeof (SPAttributeTable), - sizeof (SPAttributeTableClass), - (GtkClassInitFunc) sp_attribute_table_class_init, - (GtkObjectInitFunc) sp_attribute_table_init, - NULL, NULL, NULL + GTypeInfo info = { + sizeof(SPAttributeTableClass), + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_attribute_table_class_init, + 0, // class_finalize + 0, // class_data + sizeof(SPAttributeTable), + 0, // n_preallocs + (GInstanceInitFunc)sp_attribute_table_init, + 0 // value_table }; - type = gtk_type_unique (GTK_TYPE_VBOX, &info); + type = g_type_register_static(GTK_TYPE_VBOX, "SPAttributeTable", &info, static_cast(0)); } return type; - } // end of sp_attribute_table_get_type() diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index cce921b3c..be3b8dc45 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -38,22 +38,26 @@ static SPCanvasItemClass *parent_class; static const guint DASH_LENGTH = 4; -GtkType sp_ctrlrect_get_type() +GType sp_ctrlrect_get_type() { - static GtkType ctrlrect_type = 0; + static GType type = 0; - if (!ctrlrect_type) { - GtkTypeInfo ctrlrect_info = { - "SPCtrlRect", - sizeof(CtrlRect), + if (!type) { + GTypeInfo info = { sizeof(SPCtrlRectClass), - (GtkClassInitFunc) sp_ctrlrect_class_init, - (GtkObjectInitFunc) sp_ctrlrect_init, - NULL, NULL, NULL + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_ctrlrect_class_init, + 0, // class_finalize + 0, // class_data + sizeof(CtrlRect), + 0, // n_preallocs + (GInstanceInitFunc)sp_ctrlrect_init, + 0 // value_table }; - ctrlrect_type = gtk_type_unique(SP_TYPE_CANVAS_ITEM, &ctrlrect_info); + type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlRect", &info, static_cast(0)); } - return ctrlrect_type; + return type; } static void sp_ctrlrect_class_init(SPCtrlRectClass *c) diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index 4d47778cf..6012e065d 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -36,23 +36,25 @@ static SPShapeClass *parent_class; GType sp_polygon_get_type(void) { - static GType polygon_type = 0; + static GType type = 0; - if (!polygon_type) { - GTypeInfo polygon_info = { + if (!type) { + GTypeInfo info = { sizeof(SPPolygonClass), - NULL, NULL, - (GClassInitFunc) sp_polygon_class_init, - NULL, NULL, + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_polygon_class_init, + 0, // class_finalize + 0, // class_data sizeof(SPPolygon), - 16, - (GInstanceInitFunc) sp_polygon_init, - NULL, /* value_table */ + 0, // n_preallocs + (GInstanceInitFunc)sp_polygon_init, + 0 // value_table }; - polygon_type = g_type_register_static(SP_TYPE_SHAPE, "SPPolygon", &polygon_info, (GTypeFlags) 0); + type = g_type_register_static(SP_TYPE_SHAPE, "SPPolygon", &info, static_cast(0)); } - return polygon_type; + return type; } static void sp_polygon_class_init(SPPolygonClass *pc) diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 783a09cf6..10d997656 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -33,22 +33,25 @@ static SPViewWidgetClass *widget_parent_class; /** * Registers SPSVGSPViewWidget class with Gtk and returns its type number. */ -GtkType -sp_svg_view_widget_get_type (void) +GType sp_svg_view_widget_get_type(void) { - static GtkType type = 0; - if (!type) { - GtkTypeInfo info = { - "SPSVGSPViewWidget", - sizeof (SPSVGSPViewWidget), - sizeof (SPSVGSPViewWidgetClass), - (GtkClassInitFunc) sp_svg_view_widget_class_init, - (GtkObjectInitFunc) sp_svg_view_widget_init, - NULL, NULL, NULL - }; - type = gtk_type_unique (SP_TYPE_VIEW_WIDGET, &info); - } - return type; + static GType type = 0; + if (!type) { + GTypeInfo info = { + sizeof(SPSVGSPViewWidgetClass), + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_svg_view_widget_class_init, + 0, // class_finalize + 0, // class_data + sizeof(SPSVGSPViewWidget), + 0, // n_preallocs + (GInstanceInitFunc)sp_svg_view_widget_init, + 0 // value_table + }; + type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPSVGSPViewWidget", &info, static_cast(0)); + } + return type; } /** -- 2.30.2