Remove use of GtkObject system in src/ui/*

Signed-off-by: Nickolas Lloyd <ultrageek.lloyd@gmail.com>

---

 src/ui/frames.c         |   82 +++++++++++++++++++++++++---------------------
 src/ui/frames.h         |    4 ++-
 src/ui/menu.c           |   30 ++++++++++-------
 src/ui/metaaccellabel.c |   70 ++++++++++++++++++++++++---------------
 src/ui/metaaccellabel.h |    3 +-
 src/ui/preview-widget.c |   68 ++++++++++++++++++++++----------------
 src/ui/preview-widget.h |    1 +
 src/ui/themewidget.c    |   71 ++++++++++++++++++++++------------------
 src/ui/themewidget.h    |    3 ++
 9 files changed, 193 insertions(+), 139 deletions(-)

diff --git a/src/ui/frames.c b/src/ui/frames.c
index 01e5027..8315997 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -41,14 +41,15 @@
 
 #define DEFAULT_INNER_BUTTON_BORDER 3
 
-static void meta_frames_class_init (MetaFramesClass *klass);
-static void meta_frames_init       (MetaFrames      *frames);
-static void meta_frames_destroy    (GtkObject       *object);
-static void meta_frames_finalize   (GObject         *object);
-static void meta_frames_style_set  (GtkWidget       *widget,
-                                    GtkStyle        *prev_style);
-static void meta_frames_realize    (GtkWidget       *widget);
-static void meta_frames_unrealize  (GtkWidget       *widget);
+static void meta_frames_class_init   (gpointer         g_class);
+static void meta_frames_instance_init(GTypeInstance   *instance,
+                                      gpointer         g_class);
+static void meta_frames_destroy      (GtkObject       *object);
+static void meta_frames_finalize     (GObject         *object);
+static void meta_frames_style_set    (GtkWidget       *widget,
+                                      GtkStyle        *prev_style);
+static void meta_frames_realize      (GtkWidget       *widget);
+static void meta_frames_unrealize    (GtkWidget       *widget);
 
 static void meta_frames_update_prelit_control (MetaFrames      *frames,
                                                MetaUIFrame     *frame,
@@ -111,40 +112,37 @@ static GtkWidgetClass *parent_class = NULL;
 GType
 meta_frames_get_type (void)
 {
-  static GType frames_type = 0;
+  return g_type_from_name ("MetaFrames");
+}
 
-  if (!frames_type)
+GTypeInfo
+meta_frames_get_type_info (void)
+{
+  static const GTypeInfo frames_info =
     {
-      static const GtkTypeInfo frames_info =
-      {
-        "MetaFrames",
-        sizeof (MetaFrames),
-        sizeof (MetaFramesClass),
-        (GtkClassInitFunc) meta_frames_class_init,
-        (GtkObjectInitFunc) meta_frames_init,
-        /* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-
-      frames_type = gtk_type_unique (GTK_TYPE_WINDOW, &frames_info);
-    }
+      sizeof (MetaFramesClass),
+      (GBaseInitFunc) NULL,
+      (GBaseFinalizeFunc) NULL,
+      (GClassInitFunc) meta_frames_class_init,
+      (GClassFinalizeFunc) NULL,
+      NULL,
+      sizeof (MetaFrames),
+      0,
+      (GInstanceInitFunc) meta_frames_instance_init,
+      NULL,
+    };
 
-  return frames_type;
+  return frames_info;
 }
 
 static void
-meta_frames_class_init (MetaFramesClass *class)
+meta_frames_class_init (gpointer g_class)
 {
-  GObjectClass   *gobject_class;
-  GtkObjectClass *object_class;
-  GtkWidgetClass *widget_class;
-
-  gobject_class = G_OBJECT_CLASS (class);
-  object_class = (GtkObjectClass*) class;
-  widget_class = (GtkWidgetClass*) class;
+  GObjectClass   *gobject_class = G_OBJECT_CLASS (g_class);
+  GtkObjectClass *object_class = GTK_OBJECT_CLASS (g_class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (g_class);
 
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (g_class);
 
   gobject_class->finalize = meta_frames_finalize;
   object_class->destroy = meta_frames_destroy;
@@ -201,8 +199,10 @@ prefs_changed_callback (MetaPreference pref,
 }
 
 static void
-meta_frames_init (MetaFrames *frames)
+meta_frames_instance_init (GTypeInstance *instance, gpointer g_class)
 {
+  MetaFrames *frames = (MetaFrames *)instance;
+
   GTK_WINDOW (frames)->type = GTK_WINDOW_POPUP;
 
   frames->text_heights = g_hash_table_new (NULL, NULL);
@@ -570,11 +570,19 @@ MetaFrames*
 meta_frames_new (int screen_number)
 {
   GdkScreen *screen;
+  GTypeInfo frames_info = meta_frames_get_type_info ();
+  GType frames_type = meta_frames_get_type ();
+
+  if (!frames_type)
+    frames_type = g_type_register_static (GTK_TYPE_WINDOW,
+                                          "MetaFrames",
+                                          &frames_info,
+                                          FALSE);
 
   screen = gdk_display_get_screen (gdk_display_get_default (),
                                    screen_number);
 
-  return g_object_new (META_TYPE_FRAMES,
+  return g_object_new (frames_type,
                        "screen", screen,
                        NULL);  
 }
diff --git a/src/ui/frames.h b/src/ui/frames.h
index ad8d361..0b0f8d2 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -111,7 +111,9 @@ struct _MetaFramesClass
 
 };
 
-GType        meta_frames_get_type               (void) G_GNUC_CONST;
+GTypeInfo        meta_frames_get_type_info          (void) G_GNUC_CONST;
+
+GType meta_frames_get_type (void);
 
 MetaFrames *meta_frames_new (int screen_number);
 
diff --git a/src/ui/menu.c b/src/ui/menu.c
index b3c616c..2d37ba6 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -106,6 +106,12 @@ static MenuItem menuitems[] = {
 };
 
 static void
+meta_closure_notify (gpointer data, GClosure *closure)
+{
+  g_free (data);
+}
+
+static void
 popup_position_func (GtkMenu   *menu,
                      gint      *x,
                      gint      *y,
@@ -443,12 +449,12 @@ meta_window_menu_new   (MetaFrames         *frames,
                           "workspace",
                           GINT_TO_POINTER (j));
 
-                      gtk_signal_connect_full (GTK_OBJECT (submi),
-                          "activate",
-                          G_CALLBACK (activate_cb),
-                          NULL,
-                          md,
-                          g_free, FALSE, FALSE);
+                      g_signal_connect_data (GTK_OBJECT (submi),
+                                             "activate",
+                                             G_CALLBACK (activate_cb),
+                                             md,
+                                             meta_closure_notify,
+                                             FALSE);
 
                       gtk_menu_shell_append (GTK_MENU_SHELL (submenu), submi);
 
@@ -471,12 +477,12 @@ meta_window_menu_new   (MetaFrames         *frames,
               md->menu = menu;
               md->op = menuitem.op;
               
-              gtk_signal_connect_full (GTK_OBJECT (mi),
-                                       "activate",
-                                       G_CALLBACK (activate_cb),
-                                       NULL,
-                                       md,
-                                       g_free, FALSE, FALSE);
+             g_signal_connect_data (GTK_OBJECT (mi),
+                                    "activate",
+                                    G_CALLBACK (activate_cb),
+                                    md,
+                                    meta_closure_notify,
+                                    FALSE);
             }
 
           if (mi)
diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c
index f4f06ac..70ec1e6 100644
--- a/src/ui/metaaccellabel.c
+++ b/src/ui/metaaccellabel.c
@@ -37,8 +37,9 @@
 #include <string.h>
 #include "util.h"
 
-static void     meta_accel_label_class_init   (MetaAccelLabelClass *klass);
-static void     meta_accel_label_init         (MetaAccelLabel      *accel_label);
+static void     meta_accel_label_class_init   (gpointer             g_class);
+static void     meta_accel_label_instance_init(GTypeInstance       *instance,
+                                               gpointer             g_class);
 static void     meta_accel_label_destroy      (GtkObject           *object);
 static void     meta_accel_label_finalize     (GObject             *object);
 static void     meta_accel_label_size_request (GtkWidget           *widget,
@@ -56,36 +57,38 @@ static GtkLabelClass *parent_class = NULL;
 GType
 meta_accel_label_get_type (void)
 {
-  static GType accel_label_type = 0;
+  return g_type_from_name ("MetaAccelLabel");
+}
 
-  if (!accel_label_type)
+GTypeInfo
+meta_accel_label_get_type_info (void)
+{
+  static const GTypeInfo accel_label_info =
     {
-      static const GtkTypeInfo accel_label_info =
-      {
-	"MetaAccelLabel",
-	sizeof (MetaAccelLabel),
-	sizeof (MetaAccelLabelClass),
-	(GtkClassInitFunc) meta_accel_label_class_init,
-	(GtkObjectInitFunc) meta_accel_label_init,
-        /* reserved_1 */ NULL,
-	/* reserved_2 */ NULL,
-	(GtkClassInitFunc) NULL,
-      };
-
-      accel_label_type = gtk_type_unique (GTK_TYPE_LABEL, &accel_label_info);
-    }
-
-  return accel_label_type;
+      sizeof (MetaAccelLabelClass),
+      (GBaseInitFunc) NULL,
+      (GBaseFinalizeFunc) NULL,
+      (GClassInitFunc) meta_accel_label_class_init,
+      (GClassFinalizeFunc) NULL,
+      NULL,
+      sizeof (MetaAccelLabel),
+      0,
+      (GInstanceInitFunc) meta_accel_label_instance_init,
+      NULL,
+    };
+
+  return accel_label_info;
 }
 
 static void
-meta_accel_label_class_init (MetaAccelLabelClass *class)
+meta_accel_label_class_init (gpointer g_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
-  GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+  MetaAccelLabelClass *class = META_ACCEL_LABEL_CLASS (g_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GtkObjectClass *object_class = GTK_OBJECT_CLASS (g_class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (g_class);
 
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (g_class);
 
   gobject_class->finalize = meta_accel_label_finalize;
 
@@ -163,8 +166,10 @@ meta_accel_label_class_init (MetaAccelLabelClass *class)
 }
 
 static void
-meta_accel_label_init (MetaAccelLabel *accel_label)
+meta_accel_label_instance_init (GTypeInstance *instance, gpointer g_class)
 {
+  MetaAccelLabel *accel_label = META_ACCEL_LABEL (instance);
+
   accel_label->accel_padding = 3;
   accel_label->accel_string = NULL;
 
@@ -175,10 +180,21 @@ GtkWidget*
 meta_accel_label_new_with_mnemonic (const gchar *string)
 {
   MetaAccelLabel *accel_label;
+  GTypeInfo accel_label_info;
+  GType accel_label_type;
 
   g_return_val_if_fail (string != NULL, NULL);
 
-  accel_label = g_object_new (META_TYPE_ACCEL_LABEL, NULL);
+  accel_label_info = meta_accel_label_get_type_info ();
+  accel_label_type = meta_accel_label_get_type ();
+
+  if (!accel_label_type)
+    accel_label_type = g_type_register_static (GTK_TYPE_LABEL,
+                                               "MetaAccelLabel",
+                                               &accel_label_info,
+                                               FALSE);
+
+  accel_label = g_object_new (accel_label_type, NULL);
 
   gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), string);
 
diff --git a/src/ui/metaaccellabel.h b/src/ui/metaaccellabel.h
index 0a3b563..8d33d8b 100644
--- a/src/ui/metaaccellabel.h
+++ b/src/ui/metaaccellabel.h
@@ -91,7 +91,8 @@ struct _MetaAccelLabelClass
   void (*_gtk_reserved4) (void);
 };
 
-GType	   meta_accel_label_get_type          (void) G_GNUC_CONST;
+GTypeInfo  meta_accel_label_get_type_info     (void) G_GNUC_CONST;
+GType      meta_accel_label_get_type          (void);
 GtkWidget* meta_accel_label_new_with_mnemonic (const gchar            *string);
 void       meta_accel_label_set_accelerator   (MetaAccelLabel         *accel_label,
                                                guint                   accelerator_key,
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 32fbc70..f8bc3ea 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -28,8 +28,9 @@
 #include <gtk/gtk.h>
 #include "preview-widget.h"
 
-static void     meta_preview_class_init    (MetaPreviewClass *klass);
-static void     meta_preview_init          (MetaPreview      *preview);
+static void     meta_preview_class_init    (gpointer g_class);
+static void     meta_preview_instance_init (GTypeInstance *instance,
+                                            gpointer g_class);
 static void     meta_preview_size_request  (GtkWidget        *widget,
                                             GtkRequisition   *req);
 static void     meta_preview_size_allocate (GtkWidget        *widget,
@@ -43,36 +44,36 @@ static GtkWidgetClass *parent_class;
 GType
 meta_preview_get_type (void)
 {
-  static GType preview_type = 0;
+  return g_type_from_name ("MetaPreview");
+}
 
-  if (!preview_type)
+GTypeInfo
+meta_preview_get_type_info (void)
+{
+  static const GTypeInfo preview_info = 
     {
-      static const GtkTypeInfo preview_info =
-      {
-	"MetaPreview",
-	sizeof (MetaPreview),
-	sizeof (MetaPreviewClass),
-	(GtkClassInitFunc) meta_preview_class_init,
-	(GtkObjectInitFunc) meta_preview_init,
-	/* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-
-      preview_type = gtk_type_unique (GTK_TYPE_BIN, &preview_info);
-    }
-
-  return preview_type;
+      sizeof (MetaPreviewClass),
+      (GBaseInitFunc) NULL,
+      (GBaseFinalizeFunc) NULL,
+      (GClassInitFunc) meta_preview_class_init,
+      (GClassFinalizeFunc) NULL,
+      NULL,
+      sizeof (MetaPreview),
+      0,
+      (GInstanceInitFunc) meta_preview_instance_init,
+      NULL,
+    };
+
+  return preview_info;
 }
 
 static void
-meta_preview_class_init (MetaPreviewClass *class)
+meta_preview_class_init (gpointer g_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
-  GtkWidgetClass *widget_class;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (g_class);
 
-  widget_class = (GtkWidgetClass*) class;
-  parent_class = gtk_type_class (GTK_TYPE_BIN);
+  parent_class = g_type_class_peek_parent (g_class);
 
   gobject_class->finalize = meta_preview_finalize;
 
@@ -82,10 +83,11 @@ meta_preview_class_init (MetaPreviewClass *class)
 }
 
 static void
-meta_preview_init (MetaPreview *preview)
+meta_preview_instance_init (GTypeInstance *instance, gpointer g_class)
 {
   int i;
-  
+  MetaPreview *preview = META_PREVIEW (instance);
+
   GTK_WIDGET_SET_FLAGS (preview, GTK_NO_WINDOW);
 
   i = 0;
@@ -124,8 +126,16 @@ GtkWidget*
 meta_preview_new (void)
 {
   MetaPreview *preview;
-  
-  preview = gtk_type_new (META_TYPE_PREVIEW);
+  GTypeInfo preview_info = meta_preview_get_type_info ();
+  GType preview_type = meta_preview_get_type ();
+
+  if (!preview_type)
+    preview_type = g_type_register_static (GTK_TYPE_BIN,
+                                           "MetaPreview",
+                                           &preview_info,
+                                           FALSE);
+
+  preview = g_object_new (preview_type, NULL);
   
   return GTK_WIDGET (preview);
 }
diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h
index 924b011..d75b201 100644
--- a/src/ui/preview-widget.h
+++ b/src/ui/preview-widget.h
@@ -64,6 +64,7 @@ struct _MetaPreviewClass
 
 
 GType    meta_preview_get_type (void) G_GNUC_CONST;
+GTypeInfo    meta_preview_get_type_info (void);
 GtkWidget* meta_preview_new	 (void);
 
 void meta_preview_set_theme         (MetaPreview            *preview,
diff --git a/src/ui/themewidget.c b/src/ui/themewidget.c
index 5eab87d..d59c624 100644
--- a/src/ui/themewidget.c
+++ b/src/ui/themewidget.c
@@ -24,52 +24,51 @@
 #include "themewidget.h"
 #include <math.h>
 
-static void meta_area_class_init   (MetaAreaClass  *klass);
-static void meta_area_init         (MetaArea       *area);
+static void meta_area_class_init   (gpointer        g_class);
+static void meta_area_instance_init(GTypeInstance  *instance,
+                                    gpointer        g_class);
 static void meta_area_size_request (GtkWidget      *widget,
                                     GtkRequisition *req);
 static gint meta_area_expose       (GtkWidget      *widget,
                                     GdkEventExpose *event);
 static void meta_area_finalize     (GObject        *object);
 
-
 static GtkMiscClass *parent_class;
 
 GType
 meta_area_get_type (void)
 {
-  static GType area_type = 0;
+  return g_type_from_name ("MetaArea");
+}
 
-  if (!area_type)
+GTypeInfo
+meta_area_get_type_info (void)
+{
+  static const GTypeInfo area_info =
     {
-      static const GtkTypeInfo area_info =
-      {
-	"MetaArea",
-	sizeof (MetaArea),
-	sizeof (MetaAreaClass),
-	(GtkClassInitFunc) meta_area_class_init,
-	(GtkObjectInitFunc) meta_area_init,
-	/* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-
-      area_type = gtk_type_unique (GTK_TYPE_MISC, &area_info);
-    }
-
-  return area_type;
+      sizeof (MetaAreaClass),
+      (GBaseInitFunc) NULL,
+      (GBaseFinalizeFunc) NULL,
+      (GClassInitFunc) meta_area_class_init,
+      (GClassFinalizeFunc) NULL,
+      NULL,
+      sizeof (MetaArea),
+      0,
+      (GInstanceInitFunc) meta_area_instance_init,
+      NULL,
+    };
+
+  return area_info;
 }
 
 static void
-meta_area_class_init (MetaAreaClass *class)
+meta_area_class_init (gpointer g_class)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
-  GtkObjectClass *object_class;
-  GtkWidgetClass *widget_class;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GtkObjectClass *object_class = GTK_OBJECT_CLASS (g_class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (g_class);
 
-  object_class = (GtkObjectClass*) class;
-  widget_class = (GtkWidgetClass*) class;
-  parent_class = gtk_type_class (gtk_misc_get_type ());
+  parent_class = g_type_class_peek_parent (g_class);
 
   gobject_class->finalize = meta_area_finalize;
 
@@ -78,17 +77,25 @@ meta_area_class_init (MetaAreaClass *class)
 }
 
 static void
-meta_area_init (MetaArea *area)
+meta_area_instance_init (GTypeInstance *instance, gpointer g_class)
 {
-  GTK_WIDGET_SET_FLAGS (area, GTK_NO_WINDOW);
+  GTK_WIDGET_SET_FLAGS ((MetaArea *)instance, GTK_NO_WINDOW);
 }
 
 GtkWidget*
 meta_area_new (void)
 {
   MetaArea *area;
-  
-  area = gtk_type_new (META_TYPE_AREA);
+  GTypeInfo area_info = meta_area_get_type_info ();
+  GType area_type = meta_area_get_type ();
+
+  if (!area_type)
+    area_type = g_type_register_static (GTK_TYPE_MISC,
+                                        "MetaArea",
+                                        &area_info,
+                                        FALSE);
+
+  area = g_object_new (area_type, NULL);
   
   return GTK_WIDGET (area);
 }
diff --git a/src/ui/themewidget.h b/src/ui/themewidget.h
index a94584a..5e047d3 100644
--- a/src/ui/themewidget.h
+++ b/src/ui/themewidget.h
@@ -66,6 +66,9 @@ struct _MetaAreaClass
 
 
 GType    meta_area_get_type	 (void) G_GNUC_CONST;
+
+GTypeInfo meta_area_get_type_info (void);
+
 GtkWidget* meta_area_new	 (void);
 
 void meta_area_setup (MetaArea           *area,
