epiphany r7932 - trunk/src/bookmarks



Author: xan
Date: Tue Feb 12 23:07:11 2008
New Revision: 7932
URL: http://svn.gnome.org/viewvc/epiphany?rev=7932&view=rev

Log:
Use G_DEFINE_TYPE* macros in src/bookmarks/ when possible. (#516138)


Modified:
   trunk/src/bookmarks/ephy-bookmark-action.c
   trunk/src/bookmarks/ephy-bookmark-factory-action.c
   trunk/src/bookmarks/ephy-bookmark-properties.c
   trunk/src/bookmarks/ephy-bookmarks-editor.c
   trunk/src/bookmarks/ephy-related-action.c
   trunk/src/bookmarks/ephy-topic-action.c
   trunk/src/bookmarks/ephy-topic-factory-action.c
   trunk/src/bookmarks/ephy-topics-entry.c
   trunk/src/bookmarks/ephy-topics-palette.c

Modified: trunk/src/bookmarks/ephy-bookmark-action.c
==============================================================================
--- trunk/src/bookmarks/ephy-bookmark-action.c	(original)
+++ trunk/src/bookmarks/ephy-bookmark-action.c	Tue Feb 12 23:07:11 2008
@@ -78,8 +78,6 @@
 	PROP_ICON
 };
 
-static GObjectClass *parent_class;
-
 typedef struct
 {
 	GObject *weak_ptr;
@@ -87,6 +85,8 @@
 	EphyLinkFlags flags;
 } ClipboardCtx;
 
+G_DEFINE_TYPE (EphyBookmarkAction, ephy_bookmark_action, EPHY_TYPE_LINK_ACTION)
+
 static void
 clipboard_text_received_cb (GtkClipboard *clipboard,
 			    const char *text,
@@ -154,7 +154,7 @@
 
 	LOG ("Creating tool item for action %p", action);
 
-	item = GTK_ACTION_CLASS (parent_class)->create_tool_item (action);
+	item = GTK_ACTION_CLASS (ephy_bookmark_action_parent_class)->create_tool_item (action);
 
 	hbox = gtk_hbox_new (FALSE, 0);
 	gtk_widget_show (hbox);
@@ -561,7 +561,7 @@
 
 	LOG ("Connecting action %p to proxy %p", action, proxy);
 
-	GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+	GTK_ACTION_CLASS (ephy_bookmark_action_parent_class)->connect_proxy (action, proxy);
 
 	ephy_bookmark_action_sync_icon (action, NULL, proxy);
 	g_signal_connect_object (action, "notify::icon",
@@ -756,7 +756,7 @@
 		priv->cache_handler = 0;
 	}
 
-	parent_class->dispose (object);
+	G_OBJECT_CLASS (ephy_bookmark_action_parent_class)->dispose (object);
 }
 
 static void
@@ -765,8 +765,6 @@
 	GObjectClass *object_class = G_OBJECT_CLASS (class);
 	GtkActionClass *action_class = GTK_ACTION_CLASS (class);
 
-	parent_class = g_type_class_peek_parent (class);
-
 	action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
 	action_class->create_tool_item = create_tool_item;
 	action_class->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
@@ -808,34 +806,6 @@
 	g_type_class_add_private (object_class, sizeof(EphyBookmarkActionPrivate));
 }
 
-GType
-ephy_bookmark_action_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo type_info =
-		{
-			sizeof (EphyBookmarkActionClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) ephy_bookmark_action_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,
-			sizeof (EphyBookmarkAction),
-			0, /* n_preallocs */
-			(GInstanceInitFunc) ephy_bookmark_action_init,
-		};
-
-		type = g_type_register_static (EPHY_TYPE_LINK_ACTION,
-					       "EphyBookmarkAction",
-					       &type_info, 0);
-	}
-
-	return type;
-}
-
 GtkAction *
 ephy_bookmark_action_new (EphyNode *node,
 			  const char *name)

Modified: trunk/src/bookmarks/ephy-bookmark-factory-action.c
==============================================================================
--- trunk/src/bookmarks/ephy-bookmark-factory-action.c	(original)
+++ trunk/src/bookmarks/ephy-bookmark-factory-action.c	Tue Feb 12 23:07:11 2008
@@ -31,39 +31,13 @@
 #include "ephy-stock-icons.h"
 #include "egg-editable-toolbar.h"
 
+static void ephy_bookmark_factory_action_init       (EphyBookmarkFactoryAction *action);
 static void ephy_bookmark_factory_action_class_init (EphyBookmarkFactoryActionClass *class);
 
 #define EPHY_BOOKMARK_FACTORY_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARK_FACTORY_ACTION, EphyBookmarkActionPrivate))
 #define EGG_TOOLBARS_MODEL_DATA "ephy-bookmark-factory-menu"
 
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_bookmark_factory_action_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type)
-	{
-		const GTypeInfo type_info =
-		{
-			sizeof (EphyBookmarkFactoryActionClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) ephy_bookmark_factory_action_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,
-			sizeof (EphyBookmarkFactoryAction),
-			0, /* n_preallocs */
-			NULL
-		};
-
-		type = g_type_register_static (GTK_TYPE_ACTION,
-					       "EphyBookmarkFactoryAction",
-					       &type_info, 0);
-	}
-	return type;
-}
+G_DEFINE_TYPE (EphyBookmarkFactoryAction, ephy_bookmark_factory_action, GTK_TYPE_ACTION)
 
 static void
 activate_item_cb (GtkWidget *menuitem, GtkWidget *placeholder)
@@ -289,7 +263,7 @@
 {
 	GtkWidget *widget;
 	
-	(* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+	GTK_ACTION_CLASS (ephy_bookmark_factory_action_parent_class)->connect_proxy (action, proxy);
 
 	g_return_if_fail (GTK_IS_TOOL_ITEM (proxy));
 	
@@ -304,12 +278,16 @@
 }
 
 static void
+ephy_bookmark_factory_action_init (EphyBookmarkFactoryAction *action)
+{
+        /* Empty, needed for G_DEFINE_TYPE macro */
+}
+
+static void
 ephy_bookmark_factory_action_class_init (EphyBookmarkFactoryActionClass *class)
 {
 	GtkActionClass *action_class = GTK_ACTION_CLASS (class);
 
-	parent_class = g_type_class_peek_parent (class);
-
 	action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
 	action_class->connect_proxy = connect_proxy;
 	action_class->create_tool_item = create_tool_item;

Modified: trunk/src/bookmarks/ephy-bookmark-properties.c
==============================================================================
--- trunk/src/bookmarks/ephy-bookmark-properties.c	(original)
+++ trunk/src/bookmarks/ephy-bookmark-properties.c	Tue Feb 12 23:07:11 2008
@@ -80,7 +80,7 @@
 	PROP_CREATING
 };
 
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (EphyBookmarkProperties, ephy_bookmark_properties, GTK_TYPE_DIALOG)
 
 static gboolean
 update_warning (EphyBookmarkProperties *properties)
@@ -506,8 +506,9 @@
 	const char *tmp;
 	char *text;
 
-	object = parent_class->constructor (type, n_construct_properties,
-					    construct_params);
+	object = G_OBJECT_CLASS (ephy_bookmark_properties_parent_class)->constructor (type,
+                                                                                      n_construct_properties,
+                                                                                      construct_params);
 
 	widget = GTK_WIDGET (object);
 	window = GTK_WINDOW (object);
@@ -731,8 +732,6 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
-
 	object_class->constructor = ephy_bookmark_properties_constructor;
 	object_class->set_property = ephy_bookmark_properties_set_property;
 	object_class->get_property = ephy_bookmark_properties_get_property;
@@ -765,34 +764,6 @@
 
 /* public API */
 
-GType
-ephy_bookmark_properties_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo our_info =
-		{
-			sizeof (EphyBookmarkPropertiesClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) ephy_bookmark_properties_class_init,
-			NULL,
-			NULL,
-			sizeof (EphyBookmarkProperties),
-			0,
-			(GInstanceInitFunc) ephy_bookmark_properties_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_DIALOG,
-					       "EphyBookmarkProperties",
-					       &our_info, 0);
-	}
-
-	return type;
-}
-
 GtkWidget *
 ephy_bookmark_properties_new (EphyBookmarks *bookmarks,
 			      EphyNode *bookmark,

Modified: trunk/src/bookmarks/ephy-bookmarks-editor.c
==============================================================================
--- trunk/src/bookmarks/ephy-bookmarks-editor.c	(original)
+++ trunk/src/bookmarks/ephy-bookmarks-editor.c	Tue Feb 12 23:07:11 2008
@@ -174,8 +174,6 @@
 	PROP_BOOKMARKS
 };
 
-static GObjectClass *parent_class = NULL;
-
 static const GtkActionEntry ephy_bookmark_popup_entries [] = {
 	/* Toplevel */
 	{ "File", NULL, N_("_File") },
@@ -257,6 +255,8 @@
 	  VIEW_TITLE_AND_ADDRESS } 
 };
 
+G_DEFINE_TYPE (EphyBookmarksEditor, ephy_bookmarks_editor, GTK_TYPE_WINDOW)
+
 static void
 entry_selection_changed_cb (GtkWidget *widget, GParamSpec *pspec, EphyBookmarksEditor *editor)
 {
@@ -1179,34 +1179,6 @@
 	g_slist_free (svalues);
 }
 
-GType
-ephy_bookmarks_editor_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo our_info =
-		{
-			sizeof (EphyBookmarksEditorClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) ephy_bookmarks_editor_class_init,
-			NULL,
-			NULL,
-			sizeof (EphyBookmarksEditor),
-			0,
-			(GInstanceInitFunc) ephy_bookmarks_editor_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_WINDOW,
-					       "EphyBookmarksEditor",
-					       &our_info, 0);
-	}
-
-	return type;
-}
-
 static void
 ephy_bookmarks_editor_show (GtkWidget *widget)
 {
@@ -1214,7 +1186,7 @@
 
 	gtk_widget_grab_focus (editor->priv->search_entry);
 
-	GTK_WIDGET_CLASS (parent_class)->show (widget);
+	GTK_WIDGET_CLASS (ephy_bookmarks_editor_parent_class)->show (widget);
 }
 
 static void
@@ -1223,8 +1195,6 @@
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
-
 	object_class->finalize = ephy_bookmarks_editor_finalize;
 	object_class->dispose  = ephy_bookmarks_editor_dispose;
 
@@ -1262,7 +1232,7 @@
 			 (gpointer *)window);
 	}
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (ephy_bookmarks_editor_parent_class)->finalize (object);
 }
 
 static void
@@ -1517,7 +1487,7 @@
 		if (selection == NULL || selection->data == NULL)
 		{
 			editor->priv->key_view = NULL;
-			G_OBJECT_CLASS (parent_class)->dispose (object);
+			G_OBJECT_CLASS (ephy_bookmarks_editor_parent_class)->dispose (object);
 			return;
 		}
 
@@ -1526,7 +1496,7 @@
 		editor->priv->key_view = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->dispose (object);
+	G_OBJECT_CLASS (ephy_bookmarks_editor_parent_class)->dispose (object);
 }
 
 static void

Modified: trunk/src/bookmarks/ephy-related-action.c
==============================================================================
--- trunk/src/bookmarks/ephy-related-action.c	(original)
+++ trunk/src/bookmarks/ephy-related-action.c	Tue Feb 12 23:07:11 2008
@@ -121,43 +121,22 @@
 	iface->open_link = open_link;
 }
 
-GType
-ephy_related_action_get_type (void)
+static void
+ephy_related_action_class_init (EphyRelatedActionClass *klass)
 {
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo our_info =
-		{
-			sizeof (EphyRelatedActionClass),
-			NULL, /* base_init */
-			NULL, /* base_finalize */
-			NULL, /* class_init */
-			NULL,
-			NULL, /* class_data */
-			sizeof (EphyRelatedAction),
-			0,   /* n_preallocs */
-			NULL /* instance_init */
-		};
-		const GInterfaceInfo link_info = 
-		{
-			(GInterfaceInitFunc) iface_init,
-			NULL,
-			NULL
-		};
-
-		type = g_type_register_static (EPHY_TYPE_TOPIC_ACTION,
-					       "EphyRelatedAction",
-					       &our_info, 0);
-		g_type_add_interface_static (type,
-					     EPHY_TYPE_LINK,
-					     &link_info);
-	}
+        /* Empty, needed for G_DEFINE_TYPE macro */
+}
 
-	return type;
+static void
+ephy_related_action_init (EphyRelatedAction *action)
+{
+        /* Empty, needed for G_DEFINE_TYPE macro */
 }
 
+G_DEFINE_TYPE_WITH_CODE (EphyRelatedAction, ephy_related_action, EPHY_TYPE_TOPIC_ACTION,
+                         G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+                                                iface_init))
+
 GtkAction *
 ephy_related_action_new (EphyLink *link,
 			 GtkUIManager *manager,

Modified: trunk/src/bookmarks/ephy-topic-action.c
==============================================================================
--- trunk/src/bookmarks/ephy-topic-action.c	(original)
+++ trunk/src/bookmarks/ephy-topic-action.c	Tue Feb 12 23:07:11 2008
@@ -72,7 +72,7 @@
 	PROP_MANAGER
 };
 
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (EphyTopicAction, ephy_topic_action, GTK_TYPE_ACTION)
 
 static void
 drag_data_received_cb (GtkWidget *widget,
@@ -130,7 +130,7 @@
 	GtkWidget *hbox;
 	GtkWidget *label;
 
-	item = GTK_ACTION_CLASS (parent_class)->create_tool_item (action);
+	item = GTK_ACTION_CLASS (ephy_topic_action_parent_class)->create_tool_item (action);
 
 	button = gtk_toggle_button_new ();
 	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
@@ -402,7 +402,7 @@
 connect_proxy (GtkAction *action,
 	       GtkWidget *proxy)
 {
-	GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+	GTK_ACTION_CLASS (ephy_topic_action_parent_class)->connect_proxy (action, proxy);
     
 	ephy_topic_action_sync_label (action, NULL, proxy);
 	g_signal_connect_object (action, "notify::label",
@@ -561,13 +561,7 @@
 static void
 ephy_topic_action_init (EphyTopicAction *action)
 {
-	EphyTopicActionPrivate *priv;
-
-	priv = action->priv = EPHY_TOPIC_ACTION_GET_PRIVATE (action);
-	
-	priv->merge_id = 0;
-	priv->node = NULL;
-	priv->manager = NULL;
+	action->priv = EPHY_TOPIC_ACTION_GET_PRIVATE (action);
 }
 
 static void
@@ -576,8 +570,6 @@
 	GObjectClass *object_class = G_OBJECT_CLASS (class);
 	GtkActionClass *action_class = GTK_ACTION_CLASS (class);
 
-	parent_class = g_type_class_peek_parent (class);
-
 	action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
 	action_class->create_tool_item = create_tool_item;
 	action_class->connect_proxy = connect_proxy;
@@ -605,34 +597,6 @@
 	g_type_class_add_private (object_class, sizeof(EphyTopicActionPrivate));
 }
 
-GType
-ephy_topic_action_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo type_info =
-		{
-			sizeof (EphyTopicActionClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) ephy_topic_action_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,
-			sizeof (EphyTopicAction),
-			0, /* n_preallocs */
-			(GInstanceInitFunc) ephy_topic_action_init,
-		};
-
-		type = g_type_register_static (GTK_TYPE_ACTION,
-					       "EphyTopicAction",
-					       &type_info, 0);
-	}
-
-	return type;
-}
-
 GtkAction *
 ephy_topic_action_new (EphyNode *node,
 		       GtkUIManager *manager,

Modified: trunk/src/bookmarks/ephy-topic-factory-action.c
==============================================================================
--- trunk/src/bookmarks/ephy-topic-factory-action.c	(original)
+++ trunk/src/bookmarks/ephy-topic-factory-action.c	Tue Feb 12 23:07:11 2008
@@ -32,39 +32,13 @@
 #include "ephy-stock-icons.h"
 #include "egg-editable-toolbar.h"
 
+static void ephy_topic_factory_action_init       (EphyTopicFactoryAction *factory);
 static void ephy_topic_factory_action_class_init (EphyTopicFactoryActionClass *class);
 
 #define EPHY_TOPIC_FACTORY_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOPIC_FACTORY_ACTION, EphyTopicActionPrivate))
 #define EGG_TOOLBARS_MODEL_DATA "ephy-topic-factory-menu"
 
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_topic_factory_action_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type)
-	{
-		const GTypeInfo type_info =
-		{
-			sizeof (EphyTopicFactoryActionClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) ephy_topic_factory_action_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,
-			sizeof (EphyTopicFactoryAction),
-			0, /* n_preallocs */
-			NULL
-		};
-
-		type = g_type_register_static (GTK_TYPE_ACTION,
-					       "EphyTopicFactoryAction",
-					       &type_info, 0);
-	}
-	return type;
-}
+G_DEFINE_TYPE (EphyTopicFactoryAction, ephy_topic_factory_action, GTK_TYPE_ACTION)
 
 static int
 sort_topics (gconstpointer a, gconstpointer b)
@@ -288,7 +262,7 @@
 {
 	GtkWidget *widget;
 	
-	(* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+	GTK_ACTION_CLASS (ephy_topic_factory_action_parent_class)->connect_proxy (action, proxy);
 
 	g_return_if_fail (GTK_IS_TOOL_ITEM (proxy));
 	
@@ -303,12 +277,16 @@
 }
 
 static void
+ephy_topic_factory_action_init (EphyTopicFactoryAction *factory)
+{
+        /* Empty, needed for G_DEFINE_TYPE macro */
+}
+
+static void
 ephy_topic_factory_action_class_init (EphyTopicFactoryActionClass *class)
 {
 	GtkActionClass *action_class = GTK_ACTION_CLASS (class);
 
-	parent_class = g_type_class_peek_parent (class);
-
 	action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
 	action_class->connect_proxy = connect_proxy;
 	action_class->create_tool_item = create_tool_item;

Modified: trunk/src/bookmarks/ephy-topics-entry.c
==============================================================================
--- trunk/src/bookmarks/ephy-topics-entry.c	(original)
+++ trunk/src/bookmarks/ephy-topics-entry.c	Tue Feb 12 23:07:11 2008
@@ -32,7 +32,7 @@
 #include <string.h>
 
 static void ephy_topics_entry_class_init (EphyTopicsEntryClass *klass);
-static void ephy_topics_entry_init (EphyTopicsEntry *editor);
+static void ephy_topics_entry_init       (EphyTopicsEntry *editor);
 
 #define EPHY_TOPICS_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOPICS_ENTRY, EphyTopicsEntryPrivate))
 
@@ -62,35 +62,7 @@
 	COLUMNS
 };
 
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_topics_entry_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo our_info =
-		{
-			sizeof (EphyTopicsEntryClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) ephy_topics_entry_class_init,
-			NULL,
-			NULL,
-			sizeof (EphyTopicsEntry),
-			0,
-			(GInstanceInitFunc) ephy_topics_entry_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_ENTRY,
-					       "EphyTopicsEntry",
-					       &our_info, 0);
-	}
-
-	return type;
-}
+G_DEFINE_TYPE (EphyTopicsEntry, ephy_topics_entry, GTK_TYPE_ENTRY)
 
 static EphyNode *
 find_topic (EphyTopicsEntry *entry,
@@ -569,8 +541,9 @@
 	EphyTopicsEntry *entry;
 	EphyTopicsEntryPrivate *priv;
 
-	object = parent_class->constructor (type, n_construct_properties,
-                                            construct_params);
+	object = G_OBJECT_CLASS (ephy_topics_entry_parent_class)->constructor (type,
+                                                                               n_construct_properties,
+                                                                               construct_params);
 	entry = EPHY_TOPICS_ENTRY (object);
 	priv = EPHY_TOPICS_ENTRY_GET_PRIVATE (object);
 
@@ -622,7 +595,7 @@
 	g_free (entry->priv->create);
 	g_free (entry->priv->key);
 
-	parent_class->finalize (object);
+	G_OBJECT_CLASS (ephy_topics_entry_parent_class)->finalize (object);
 }
 
 GtkWidget *
@@ -647,8 +620,6 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
-
 	object_class->set_property = ephy_topics_entry_set_property;
 	object_class->constructor = ephy_topics_entry_constructor;
 	object_class->finalize = ephy_topics_entry_finalize;

Modified: trunk/src/bookmarks/ephy-topics-palette.c
==============================================================================
--- trunk/src/bookmarks/ephy-topics-palette.c	(original)
+++ trunk/src/bookmarks/ephy-topics-palette.c	Tue Feb 12 23:07:11 2008
@@ -68,35 +68,7 @@
 	MODES
 };
 
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_topics_palette_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0))
-	{
-		const GTypeInfo our_info =
-		{
-			sizeof (EphyTopicsPaletteClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) ephy_topics_palette_class_init,
-			NULL,
-			NULL,
-			sizeof (EphyTopicsPalette),
-			0,
-			(GInstanceInitFunc) ephy_topics_palette_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_TREE_VIEW,
-					       "EphyTopicsPalette",
-					       &our_info, 0);
-	}
-
-	return type;
-}
+G_DEFINE_TYPE (EphyTopicsPalette, ephy_topics_palette, GTK_TYPE_TREE_VIEW)
 
 static void
 append_topics (EphyTopicsPalette *palette,
@@ -394,8 +366,9 @@
 	EphyTopicsPalettePrivate *priv;
 	GtkCellRenderer *renderer;
 
-	object = parent_class->constructor (type, n_construct_properties,
-                                            construct_params);
+	object = G_OBJECT_CLASS (ephy_topics_palette_parent_class)->constructor (type,
+                                                                                 n_construct_properties,
+                                                                                 construct_params);
 	palette = EPHY_TOPICS_PALETTE (object);
 	priv = EPHY_TOPICS_PALETTE_GET_PRIVATE (object);
 
@@ -456,8 +429,6 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	
-	parent_class = g_type_class_peek_parent (klass);
-
 	object_class->set_property = ephy_topics_palette_set_property;
 	object_class->constructor = ephy_topics_palette_constructor;
 	



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