aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-link-action.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2008-02-11 02:26:22 +0800
committerXan Lopez <xan@src.gnome.org>2008-02-11 02:26:22 +0800
commita6753733856e098e2500487fee87620f72dea530 (patch)
tree1f5a7d8ae16bd2e3070bbdc31791eef96952a233 /src/ephy-link-action.c
parent9a3e4ebc55e11c3b00b0e7464b11ecec121bc6f2 (diff)
downloadgsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar.gz
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar.bz2
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar.lz
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar.xz
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.tar.zst
gsoc2013-epiphany-a6753733856e098e2500487fee87620f72dea530.zip
Use G_DEFINE_TYPE* when possible in src/ (#515601)
svn path=/trunk/; revision=7927
Diffstat (limited to 'src/ephy-link-action.c')
-rw-r--r--src/ephy-link-action.c94
1 files changed, 21 insertions, 73 deletions
diff --git a/src/ephy-link-action.c b/src/ephy-link-action.c
index 29918bf26..8ac930759 100644
--- a/src/ephy-link-action.c
+++ b/src/ephy-link-action.c
@@ -32,7 +32,9 @@
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenutoolbutton.h>
-static GObjectClass *parent_class;
+G_DEFINE_TYPE_WITH_CODE (EphyLinkAction, ephy_link_action, GTK_TYPE_ACTION,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+ NULL))
static gboolean
proxy_button_press_event_cb (GtkButton *button,
@@ -126,7 +128,7 @@ ephy_link_action_connect_proxy (GtkAction *action, GtkWidget *proxy)
action);
}
- GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_link_action_parent_class)->connect_proxy (action, proxy);
}
static void
@@ -147,7 +149,13 @@ ephy_link_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy)
action);
}
- GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_link_action_parent_class)->disconnect_proxy (action, proxy);
+}
+
+static void
+ephy_link_action_init (EphyLinkAction *action)
+{
+ /* Empty, needed for G_DEFINE_TYPE macro */
}
static void
@@ -155,86 +163,26 @@ ephy_link_action_class_init (EphyLinkActionClass *class)
{
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
action_class->connect_proxy = ephy_link_action_connect_proxy;
action_class->disconnect_proxy = ephy_link_action_disconnect_proxy;
}
-GType
-ephy_link_action_get_type (void)
+static void
+ephy_link_action_group_class_init (EphyLinkActionGroupClass *klass)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyLinkActionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_link_action_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyLinkAction),
- 0, /* n_preallocs */
- NULL /* instance_init */
- };
- const GInterfaceInfo link_info =
- {
- NULL,
- NULL,
- NULL
- };
-
- type = g_type_register_static (GTK_TYPE_ACTION,
- "EphyLinkAction",
- &our_info, G_TYPE_FLAG_ABSTRACT);
- g_type_add_interface_static (type,
- EPHY_TYPE_LINK,
- &link_info);
- }
-
- return type;
+ /* Empty, needed for G_DEFINE_TYPE macro */
}
-GType
-ephy_link_action_group_get_type (void)
+static void
+ephy_link_action_group_init (EphyLinkActionGroup *action_group)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyLinkActionGroupClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- NULL, /* class_init */
- NULL,
- NULL, /* class_data */
- sizeof (EphyLinkActionGroup),
- 0, /* n_preallocs */
- NULL /* instance_init */
- };
- const GInterfaceInfo link_info =
- {
- NULL,
- NULL,
- NULL
- };
-
- type = g_type_register_static (GTK_TYPE_ACTION_GROUP,
- "EphyLinkActionGroup",
- &our_info, 0);
- g_type_add_interface_static (type,
- EPHY_TYPE_LINK,
- &link_info);
- }
-
- return type;
+ /* Empty, needed for G_DEFINE_TYPE macro */
}
+G_DEFINE_TYPE_WITH_CODE (EphyLinkActionGroup, ephy_link_action_group, GTK_TYPE_ACTION_GROUP,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+ NULL))
+
EphyLinkActionGroup *
ephy_link_action_group_new (const char * name)
{