Code

More type registration cleanup
authorjoncruz <joncruz@users.sourceforge.net>
Sat, 10 May 2008 05:20:16 +0000 (05:20 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sat, 10 May 2008 05:20:16 +0000 (05:20 +0000)
src/dialogs/sp-attribute-widget.cpp
src/display/sodipodi-ctrlrect.cpp
src/sp-polygon.cpp
src/svg-view-widget.cpp

index 4424aaa1bf7b10a8cfe68997dcfb295ceece838e..9848d9f266c86430ee12aff55b9aebac6550571b 100644 (file)
@@ -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 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<GTypeFlags>(0));
     }
     return type;
     }
     return type;
-
 } // end of sp_attribute_widget_get_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 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<GTypeFlags>(0));
     }
     return type;
     }
     return type;
-
 } // end of sp_attribute_table_get_type()
 
 
 } // end of sp_attribute_table_get_type()
 
 
index cce921b3cecb5b2ca7fbe45dd396b87dc404e8c4..be3b8dc4537be37402111cad419b6ddeabb5498a 100644 (file)
@@ -38,22 +38,26 @@ static SPCanvasItemClass *parent_class;
 
 static const guint DASH_LENGTH = 4;
 
 
 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),
             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<GTypeFlags>(0));
     }
     }
-    return ctrlrect_type;
+    return type;
 }
 
 static void sp_ctrlrect_class_init(SPCtrlRectClass *c)
 }
 
 static void sp_ctrlrect_class_init(SPCtrlRectClass *c)
index 4d47778cf7817f125898a35bb52b7dc014e6b035..6012e065d4a11c492c95b4f876c173c3d22820ad 100644 (file)
@@ -36,23 +36,25 @@ static SPShapeClass *parent_class;
 
 GType sp_polygon_get_type(void)
 {
 
 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),
             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),
             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<GTypeFlags>(0));
     }
 
     }
 
-    return polygon_type;
+    return type;
 }
 
 static void sp_polygon_class_init(SPPolygonClass *pc)
 }
 
 static void sp_polygon_class_init(SPPolygonClass *pc)
index 783a09cf667f4bc737b3b3bc62e135b3027a1ff2..10d9976566f04a3fed2b3b6f720a35e7e8504939 100644 (file)
@@ -33,22 +33,25 @@ static SPViewWidgetClass *widget_parent_class;
 /**
  * Registers SPSVGSPViewWidget class with Gtk and returns its type number.
  */
 /**
  * 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<GTypeFlags>(0));
+    }
+    return type;
 }
 
 /**
 }
 
 /**