]> www.fi.muni.cz Git - evince.git/commitdiff
[ephy-zoom] Use G_DEFINE_TYPE macro
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 31 May 2010 15:36:42 +0000 (17:36 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 31 May 2010 16:57:59 +0000 (18:57 +0200)
cut-n-paste/zoom-control/ephy-zoom-action.c
cut-n-paste/zoom-control/ephy-zoom-action.h

index a264649aee374617faefcf312f8cd3b54c6d5e0e..b6250c8b063e3b5dd402cdb5198891ae73f5fa48 100644 (file)
@@ -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;
index 2d07c691331b37a453f1aa2f0687888ab7f7b097..cf9f6feb337f925682ae310b72788830023416ca 100644 (file)
@@ -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);