[evince] [ephy-zoom] Use G_DEFINE_TYPE macro



commit 578287302a854bb01a32da0a0e1d4c73f3881fbc
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Mon May 31 17:36:42 2010 +0200

    [ephy-zoom] Use G_DEFINE_TYPE macro

 cut-n-paste/zoom-control/ephy-zoom-action.c |   36 ++------------------------
 cut-n-paste/zoom-control/ephy-zoom-action.h |    2 +-
 2 files changed, 4 insertions(+), 34 deletions(-)
---
diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.c b/cut-n-paste/zoom-control/ephy-zoom-action.c
index a264649..b6250c8 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-action.c
+++ b/cut-n-paste/zoom-control/ephy-zoom-action.c
@@ -60,35 +60,7 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_zoom_action_get_type (void)
-{
-        static GType type = 0;
-
-        if (G_UNLIKELY (type == 0))
-        {
-                const GTypeInfo our_info =
-			{
-				sizeof (EphyZoomActionClass),
-				NULL, /* base_init */
-				NULL, /* base_finalize */
-				(GClassInitFunc) ephy_zoom_action_class_init,
-				NULL,
-				NULL, /* class_data */
-				sizeof (EphyZoomAction),
-				0, /* n_preallocs */
-				(GInstanceInitFunc) ephy_zoom_action_init,
-			};
-
-                type = g_type_register_static (GTK_TYPE_ACTION,
-					       "EphyZoomAction",
-					       &our_info, 0);
-        }
-
-        return type;
-}
+G_DEFINE_TYPE (EphyZoomAction, ephy_zoom_action, GTK_TYPE_ACTION)
 
 static void
 zoom_to_level_cb (EphyZoomControl *control,
@@ -137,7 +109,7 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
 				  G_CALLBACK (zoom_to_level_cb), action);
 	}
 
-	GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+	GTK_ACTION_CLASS (ephy_zoom_action_parent_class)->connect_proxy (action, proxy);
 }
 
 static void
@@ -194,7 +166,7 @@ create_menu_item (GtkAction *action)
 
 	gtk_widget_show (menu);
 
-        menu_item = GTK_ACTION_CLASS (parent_class)->create_menu_item (action);
+        menu_item = GTK_ACTION_CLASS (ephy_zoom_action_parent_class)->create_menu_item (action);
 
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu);
 
@@ -260,8 +232,6 @@ ephy_zoom_action_class_init (EphyZoomActionClass *class)
 	object_class->set_property = ephy_zoom_action_set_property;
 	object_class->get_property = ephy_zoom_action_get_property;
 
-	parent_class = g_type_class_peek_parent (class);
-
 	action_class->toolbar_item_type = EPHY_TYPE_ZOOM_CONTROL;
 	action_class->connect_proxy = connect_proxy;
 	action_class->create_menu_item = create_menu_item;
diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.h b/cut-n-paste/zoom-control/ephy-zoom-action.h
index 2d07c69..cf9f6fe 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-action.h
+++ b/cut-n-paste/zoom-control/ephy-zoom-action.h
@@ -52,7 +52,7 @@ struct _EphyZoomActionClass
 	void (* zoom_to_level)	(EphyZoomAction *action, float level);
 };
 
-GType	ephy_zoom_action_get_type	    (void);
+GType	ephy_zoom_action_get_type	    (void) G_GNUC_CONST;
 
 void	ephy_zoom_action_set_zoom_level	    (EphyZoomAction *action,
 					     float           zoom);



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