[ekiga] Modernized MultipleChatPage's GObject code



commit b9ad937624754145269a03fff2484d843199336e
Author: Snark <jpuydt gnome org>
Date:   Tue Nov 9 13:40:58 2010 +0100

    Modernized MultipleChatPage's GObject code

 lib/engine/gui/gtk-frontend/multiple-chat-page.cpp |   66 +------------------
 1 files changed, 4 insertions(+), 62 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
index 285b61f..1501226 100644
--- a/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
+++ b/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
@@ -42,7 +42,7 @@ struct _MultipleChatPagePrivate {
   GtkWidget* area;
 };
 
-static GObjectClass *parent_class = NULL;
+G_DEFINE_TYPE (MultipleChatPage, multiple_chat_page, GTK_TYPE_HBOX);
 
 static void on_page_grab_focus (GtkWidget*,
 				gpointer);
@@ -59,75 +59,17 @@ static void on_page_grab_focus (GtkWidget* widget,
 }
 
 static void
-multiple_chat_page_dispose (GObject *obj)
+multiple_chat_page_init (MultipleChatPage* self)
 {
-  MultipleChatPage* self = NULL;
-
-  self = (MultipleChatPage*)obj;
-
-  self->priv->area = NULL;
-
-  parent_class->dispose (obj);
-}
-
-static void
-multiple_chat_page_finalize (GObject *obj)
-{
-
-  parent_class->finalize (obj);
-}
-
-static void
-multiple_chat_page_init (GTypeInstance* instance,
-		       G_GNUC_UNUSED gpointer g_class)
-{
-  MultipleChatPage* self = NULL;
-
-  self = (MultipleChatPage*)instance;
-
-  self->priv = g_new (MultipleChatPagePrivate, 1);
-  self->priv->area = NULL;
+  self->priv = g_new0 (MultipleChatPagePrivate, 1);
 
   g_signal_connect (self, "grab-focus",
                     G_CALLBACK (on_page_grab_focus), NULL);
 }
 
 static void
-multiple_chat_page_class_init (gpointer g_class,
-			     G_GNUC_UNUSED gpointer class_data)
-{
-  GObjectClass* gobject_class = NULL;
-
-  parent_class = (GObjectClass*)g_type_class_peek_parent (g_class);
-
-  gobject_class = (GObjectClass*)g_class;
-  gobject_class->dispose = multiple_chat_page_dispose;
-  gobject_class->finalize = multiple_chat_page_finalize;
-}
-
-GType
-multiple_chat_page_get_type ()
+multiple_chat_page_class_init (G_GNUC_UNUSED MultipleChatPageClass* klass)
 {
-  static GType result = 0;
-  if (!result) {
-    static const GTypeInfo my_info = {
-      sizeof(MultipleChatPageClass),
-      NULL,
-      NULL,
-      multiple_chat_page_class_init,
-      NULL,
-      NULL,
-      sizeof (MultipleChatPage),
-      1,
-      multiple_chat_page_init,
-      NULL
-    };
-
-    result = g_type_register_static (GTK_TYPE_HBOX,
-				      "MultipleChatPage",
-				     &my_info, (GTypeFlags)0);
-  }
-  return result;
 }
 
 /* implementation of the public api */



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