aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/ephy-cert-manager-dialog.c35
-rw-r--r--src/ephy-completion-model.c45
-rw-r--r--src/ephy-dbus.c77
-rw-r--r--src/ephy-encoding-dialog.c34
-rw-r--r--src/ephy-encoding-menu.c34
-rw-r--r--src/ephy-extensions-manager.c47
-rw-r--r--src/ephy-find-toolbar.c38
-rw-r--r--src/ephy-fullscreen-popup.c49
-rw-r--r--src/ephy-go-action.c43
-rw-r--r--src/ephy-history-window.c38
-rw-r--r--src/ephy-home-action.c38
-rw-r--r--src/ephy-link-action.c94
-rw-r--r--src/ephy-link.c2
-rw-r--r--src/ephy-location-action.c40
-rw-r--r--src/ephy-lockdown.c48
-rw-r--r--src/ephy-navigation-action.c36
-rw-r--r--src/ephy-net-monitor.c34
-rw-r--r--src/ephy-python-extension.c205
-rw-r--r--src/ephy-python-loader.c43
-rw-r--r--src/ephy-session.c49
-rw-r--r--src/ephy-shell.c38
-rw-r--r--src/ephy-statusbar.c31
-rw-r--r--src/ephy-toolbar-editor.c39
-rw-r--r--src/ephy-toolbar.c65
-rw-r--r--src/ephy-toolbars-model.c35
-rw-r--r--src/pdm-dialog.c34
-rw-r--r--src/ppview-toolbar.c34
-rw-r--r--src/prefs-dialog.c34
28 files changed, 243 insertions, 1096 deletions
diff --git a/src/ephy-cert-manager-dialog.c b/src/ephy-cert-manager-dialog.c
index 9b30190b4..bb3eb2d8a 100644
--- a/src/ephy-cert-manager-dialog.c
+++ b/src/ephy-cert-manager-dialog.c
@@ -53,8 +53,6 @@ static void
tree_view_selection_changed_cb (GtkTreeSelection *selection,
CertsManagerDialog *dialog);
-static GObjectClass *parent_class = NULL;
-
#define EPHY_CERTIFICATE_MANAGER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_CERTS_MANAGER_DIALOG, CertsManagerDialogPrivate))
struct _CertsManagerDialogPrivate
@@ -463,7 +461,7 @@ certs_manager_dialog_finalize (GObject *object)
/* TODO free certs in the treeviews */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (certs_manager_dialog_parent_class)->finalize (object);
shell = ephy_embed_shell_get_default ();
g_object_unref (shell);
@@ -474,8 +472,6 @@ certs_manager_dialog_class_init (CertsManagerDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = certs_manager_dialog_finalize;
g_type_class_add_private (object_class, sizeof (CertsManagerDialogPrivate));
@@ -483,34 +479,7 @@ certs_manager_dialog_class_init (CertsManagerDialogClass *klass)
/* public functions */
-GType
-certs_manager_dialog_get_type (void)
-{
- static GType certs_manager_dialog_type = 0;
-
- if (certs_manager_dialog_type == 0)
- {
- const GTypeInfo our_info =
- {
- sizeof (CertsManagerDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) certs_manager_dialog_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (CertsManagerDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) certs_manager_dialog_init
- };
-
- certs_manager_dialog_type = g_type_register_static (EPHY_TYPE_DIALOG,
- "CertsManagerDialog",
- &our_info, 0);
- }
-
- return certs_manager_dialog_type;
-
-}
+G_DEFINE_TYPE (CertsManagerDialog, certs_manager_dialog, EPHY_TYPE_DIALOG)
EphyDialog *
certs_manager_dialog_new (void)
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 5e6b80c2d..72ba6494e 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -50,54 +50,15 @@ enum
BOOKMARKS_GROUP
};
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_completion_model_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyCompletionModelClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_completion_model_class_init,
- NULL,
- NULL,
- sizeof (EphyCompletionModel),
- 0,
- (GInstanceInitFunc) ephy_completion_model_init
- };
-
- const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) ephy_completion_model_tree_model_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyCompletionModel",
- &our_info, 0);
-
- g_type_add_interface_static (type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_CODE (EphyCompletionModel, ephy_completion_model, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
+ ephy_completion_model_tree_model_init))
static void
ephy_completion_model_class_init (EphyCompletionModelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
g_type_class_add_private (object_class, sizeof (EphyCompletionModelPrivate));
}
diff --git a/src/ephy-dbus.c b/src/ephy-dbus.c
index df903b6b4..9e0e2a9e8 100644
--- a/src/ephy-dbus.c
+++ b/src/ephy-dbus.c
@@ -77,7 +77,6 @@ enum
static EphyDbus *ephy_dbus_instance;
static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class;
GQuark ephy_dbus_error_quark;
/* Filter signals form session bus */
@@ -344,28 +343,7 @@ ephy_dbus_shutdown (EphyDbus *dbus)
/* Class implementation */
-static void
-ephy_dbus_init (EphyDbus *dbus)
-{
- dbus->priv = EPHY_DBUS_GET_PRIVATE (dbus);
-
- LOG ("EphyDbus initialising");
-}
-
-static void
-ephy_dbus_finalize (GObject *object)
-{
- EphyDbus *dbus = EPHY_DBUS (object);
-
- /* Have to do this after the object's weak ref notifiers have
- * been called, see https://bugs.freedesktop.org/show_bug.cgi?id=5688
- */
- ephy_dbus_shutdown (dbus);
-
- LOG ("EphyDbus finalised");
-
- parent_class->finalize (object);
-}
+G_DEFINE_TYPE (EphyDbus, ephy_dbus, G_TYPE_OBJECT)
static void
ephy_dbus_get_property (GObject *object,
@@ -395,12 +373,33 @@ ephy_dbus_set_property (GObject *object,
}
static void
+ephy_dbus_finalize (GObject *object)
+{
+ EphyDbus *dbus = EPHY_DBUS (object);
+
+ /* Have to do this after the object's weak ref notifiers have
+ * been called, see https://bugs.freedesktop.org/show_bug.cgi?id=5688
+ */
+ ephy_dbus_shutdown (dbus);
+
+ LOG ("EphyDbus finalised");
+
+ G_OBJECT_CLASS (ephy_dbus_parent_class)->finalize (object);
+}
+
+static void
+ephy_dbus_init (EphyDbus *dbus)
+{
+ dbus->priv = EPHY_DBUS_GET_PRIVATE (dbus);
+
+ LOG ("EphyDbus initialising");
+}
+
+static void
ephy_dbus_class_init (EphyDbusClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->get_property = ephy_dbus_get_property;
object_class->set_property = ephy_dbus_set_property;
object_class->finalize = ephy_dbus_finalize;
@@ -439,34 +438,6 @@ ephy_dbus_class_init (EphyDbusClass *klass)
g_type_class_add_private (object_class, sizeof(EphyDbusPrivate));
}
-GType
-ephy_dbus_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyDbusClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_dbus_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyDbus),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_dbus_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyDbus",
- &our_info, 0);
- }
-
- return type;
-}
-
EphyDbus *
ephy_dbus_get_default (void)
{
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 157bad6f0..98cedcd1c 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -78,35 +78,7 @@ struct _EphyEncodingDialogPrivate
static void ephy_encoding_dialog_class_init (EphyEncodingDialogClass *klass);
static void ephy_encoding_dialog_init (EphyEncodingDialog *ge);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_encoding_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEncodingDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_encoding_dialog_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyEncodingDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_encoding_dialog_init
- };
-
- type = g_type_register_static (EPHY_TYPE_EMBED_DIALOG,
- "EphyEncodingDialog",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEncodingDialog, ephy_encoding_dialog, EPHY_TYPE_EMBED_DIALOG)
static void
sync_encoding_against_embed (EphyEncodingDialog *dialog)
@@ -408,7 +380,7 @@ ephy_encoding_dialog_finalize (GObject *object)
g_object_unref (dialog->priv->filter);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_encoding_dialog_parent_class)->finalize (object);
}
static void
@@ -416,8 +388,6 @@ ephy_encoding_dialog_class_init (EphyEncodingDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_encoding_dialog_finalize;
g_type_class_add_private (object_class, sizeof(EphyEncodingDialogPrivate));
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index edd1e358d..59ba9ee32 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -64,35 +64,7 @@ enum
PROP_WINDOW
};
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_encoding_menu_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEncodingMenuClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_encoding_menu_class_init,
- NULL,
- NULL,
- sizeof (EphyEncodingMenu),
- 0,
- (GInstanceInitFunc) ephy_encoding_menu_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyEncodingMenu",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEncodingMenu, ephy_encoding_menu, G_TYPE_OBJECT)
static void
ephy_encoding_menu_init (EphyEncodingMenu *menu)
@@ -459,7 +431,7 @@ ephy_encoding_menu_finalize (GObject *object)
g_object_unref (menu->priv->dialog);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_encoding_menu_parent_class)->finalize (object);
}
static void
@@ -467,8 +439,6 @@ ephy_encoding_menu_class_init (EphyEncodingMenuClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_encoding_menu_finalize;
object_class->set_property = ephy_encoding_menu_set_property;
object_class->get_property = ephy_encoding_menu_get_property;
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index 069d4691e..60d7dfe6e 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -129,50 +129,13 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-static GObjectClass *parent_class = NULL;
-
static void ephy_extensions_manager_class_init (EphyExtensionsManagerClass *klass);
static void ephy_extensions_manager_iface_init (EphyExtensionIface *iface);
static void ephy_extensions_manager_init (EphyExtensionsManager *manager);
-GType
-ephy_extensions_manager_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyExtensionsManagerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_extensions_manager_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyExtensionsManager),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_extensions_manager_init
- };
-
- const GInterfaceInfo extension_info =
- {
- (GInterfaceInitFunc) ephy_extensions_manager_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyExtensionsManager",
- &our_info, 0);
-
- g_type_add_interface_static (type,
- EPHY_TYPE_EXTENSION,
- &extension_info);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_CODE (EphyExtensionsManager, ephy_extensions_manager, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
+ ephy_extensions_manager_iface_init))
/**
* ephy_extensions_manager_load:
@@ -1193,7 +1156,7 @@ ephy_extensions_manager_dispose (GObject *object)
priv->windows = NULL;
}
- parent_class->dispose (object);
+ G_OBJECT_CLASS (ephy_extensions_manager_parent_class)->dispose (object);
}
static void
@@ -1300,8 +1263,6 @@ ephy_extensions_manager_class_init (EphyExtensionsManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- parent_class = (GObjectClass *) g_type_class_peek_parent (class);
-
object_class->dispose = ephy_extensions_manager_dispose;
signals[CHANGED] =
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c
index 85b6e31a7..a6b59ff31 100644
--- a/src/ephy-find-toolbar.c
+++ b/src/ephy-find-toolbar.c
@@ -81,9 +81,7 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GObjectClass *parent_class = NULL;
+static guint signals[LAST_SIGNAL];
/* private functions */
@@ -522,6 +520,8 @@ ephy_find_toolbar_init (EphyFindToolbar *toolbar)
G_CALLBACK (case_sensitive_toggled_cb), toolbar);
}
+G_DEFINE_TYPE (EphyFindToolbar, ephy_find_toolbar, GTK_TYPE_TOOLBAR)
+
static void
ephy_find_toolbar_dispose (GObject *object)
{
@@ -546,7 +546,7 @@ ephy_find_toolbar_dispose (GObject *object)
priv->find_again_source_id = 0;
}
- parent_class->dispose (object);
+ G_OBJECT_CLASS (ephy_find_toolbar_parent_class)->dispose (object);
}
static void
@@ -581,8 +581,6 @@ ephy_find_toolbar_class_init (EphyFindToolbarClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->dispose = ephy_find_toolbar_dispose;
object_class->get_property = ephy_find_toolbar_get_property;
object_class->set_property = ephy_find_toolbar_set_property;
@@ -634,34 +632,6 @@ ephy_find_toolbar_class_init (EphyFindToolbarClass *klass)
/* public functions */
-GType
-ephy_find_toolbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyFindToolbarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_find_toolbar_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyFindToolbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_find_toolbar_init
- };
-
- type = g_type_register_static (GTK_TYPE_TOOLBAR,
- "EphyFindToolbar",
- &our_info, 0);
- }
-
- return type;
-}
-
EphyFindToolbar *
ephy_find_toolbar_new (EphyWindow *window)
{
diff --git a/src/ephy-fullscreen-popup.c b/src/ephy-fullscreen-popup.c
index 800691a02..90018c205 100644
--- a/src/ephy-fullscreen-popup.c
+++ b/src/ephy-fullscreen-popup.c
@@ -65,9 +65,9 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
+G_DEFINE_TYPE (EphyFullscreenPopup, ephy_fullscreen_popup, GTK_TYPE_WINDOW)
static void
exit_button_clicked_cb (GtkWidget *button,
@@ -227,8 +227,9 @@ ephy_fullscreen_popup_constructor (GType type,
GtkWindow *window;
GtkWidget *hbox, *frame_hbox, *icon;
- object = parent_class->constructor (type, n_construct_properties,
- construct_params);
+ object = G_OBJECT_CLASS (ephy_fullscreen_popup_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
window = GTK_WINDOW (object);
popup = EPHY_FULLSCREEN_POPUP (window);
@@ -296,7 +297,7 @@ ephy_fullscreen_popup_finalize (GObject *object)
g_signal_handlers_disconnect_matched (priv->window, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, popup);
- parent_class->finalize (object);
+ G_OBJECT_CLASS (ephy_fullscreen_popup_parent_class)->finalize (object);
}
static void
@@ -330,7 +331,7 @@ ephy_fullscreen_popup_show (GtkWidget *widget)
{
EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
- GTK_WIDGET_CLASS (parent_class)->show (widget);
+ GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->show (widget);
ephy_fullscreen_popup_update_spinner (popup);
}
@@ -340,7 +341,7 @@ ephy_fullscreen_popup_hide (GtkWidget *widget)
{
EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
- GTK_WIDGET_CLASS (parent_class)->hide (widget);
+ GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->hide (widget);
ephy_fullscreen_popup_update_spinner (popup);
}
@@ -351,7 +352,7 @@ ephy_fullscreen_popup_size_request (GtkWidget *widget,
{
EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+ GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->size_request (widget, requisition);
if (GTK_WIDGET_REALIZED (widget))
{
@@ -364,7 +365,7 @@ ephy_fullscreen_popup_realize (GtkWidget *widget)
{
EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->realize (widget);
ephy_fullscreen_popup_update_position (popup);
}
@@ -375,8 +376,6 @@ ephy_fullscreen_popup_class_init (EphyFullscreenPopupClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->constructor = ephy_fullscreen_popup_constructor;
object_class->finalize = ephy_fullscreen_popup_finalize;
object_class->get_property = ephy_fullscreen_popup_get_property;
@@ -420,34 +419,6 @@ ephy_fullscreen_popup_class_init (EphyFullscreenPopupClass *klass)
g_type_class_add_private (object_class, sizeof (EphyFullscreenPopupPrivate));
}
-GType
-ephy_fullscreen_popup_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyFullscreenPopupClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_fullscreen_popup_class_init,
- NULL,
- NULL,
- sizeof (EphyFullscreenPopup),
- 0,
- (GInstanceInitFunc) ephy_fullscreen_popup_init
- };
-
- type = g_type_register_static (GTK_TYPE_WINDOW,
- "EphyFullscreenPopup",
- &our_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
ephy_fullscreen_popup_new (EphyWindow *window)
{
diff --git a/src/ephy-go-action.c b/src/ephy-go-action.c
index 8a6079182..d67ad962d 100644
--- a/src/ephy-go-action.c
+++ b/src/ephy-go-action.c
@@ -30,35 +30,7 @@
static void ephy_go_action_class_init (EphyGoActionClass *class);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_go_action_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo type_info =
- {
- sizeof (EphyGoActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ephy_go_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EphyGoAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- type = g_type_register_static (EPHY_TYPE_LINK_ACTION,
- "EphyGoAction",
- &type_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyGoAction, ephy_go_action, EPHY_TYPE_LINK_ACTION)
static GtkWidget *
create_tool_item (GtkAction *action)
@@ -93,7 +65,7 @@ static void
connect_proxy (GtkAction *action,
GtkWidget *proxy)
{
- GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_go_action_parent_class)->connect_proxy (action, proxy);
if (GTK_IS_TOOL_ITEM (proxy))
{
@@ -110,7 +82,7 @@ disconnect_proxy (GtkAction *action,
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (gtk_action_activate), action);
- GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_go_action_parent_class)->disconnect_proxy (action, proxy);
}
static void
@@ -118,9 +90,14 @@ ephy_go_action_class_init (EphyGoActionClass *class)
{
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
action_class->create_tool_item = create_tool_item;
action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy;
}
+
+static void
+ephy_go_action_init (EphyGoAction *action)
+{
+ /* Empty, needed for G_DEFINE_TYPE macro */
+}
+
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 42164e5dd..9cbe36621 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -164,8 +164,6 @@ enum
#define TIME_LAST_TWO_DAYS_STRING "last_two_days"
#define TIME_LAST_THREE_DAYS_STRING "last_three_days"
-static GObjectClass *parent_class = NULL;
-
static const GtkActionEntry ephy_history_ui_entries [] = {
/* Toplevel */
{ "File", NULL, N_("_File") },
@@ -590,33 +588,7 @@ cmd_view_columns (GtkAction *action,
g_slist_free (svalues);
}
-GType
-ephy_history_window_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyHistoryWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_history_window_class_init,
- NULL,
- NULL,
- sizeof (EphyHistoryWindow),
- 0,
- (GInstanceInitFunc) ephy_history_window_init
- };
-
- type = g_type_register_static (GTK_TYPE_WINDOW,
- "EphyHistoryWindow",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyHistoryWindow, ephy_history_window, GTK_TYPE_WINDOW)
static void
ephy_history_window_show (GtkWidget *widget)
@@ -625,7 +597,7 @@ ephy_history_window_show (GtkWidget *widget)
gtk_widget_grab_focus (window->priv->search_entry);
- GTK_WIDGET_CLASS (parent_class)->show (widget);
+ GTK_WIDGET_CLASS (ephy_history_window_parent_class)->show (widget);
}
static void
@@ -634,8 +606,6 @@ ephy_history_window_class_init (EphyHistoryWindowClass *klass)
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_history_window_finalize;
object_class->set_property = ephy_history_window_set_property;
@@ -674,7 +644,7 @@ ephy_history_window_finalize (GObject *object)
(gpointer *)window);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_history_window_parent_class)->finalize (object);
}
static void
@@ -1649,5 +1619,5 @@ ephy_history_window_dispose (GObject *object)
save_date_filter (editor);
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_history_window_parent_class)->dispose (object);
}
diff --git a/src/ephy-home-action.c b/src/ephy-home-action.c
index 2758a6e4c..72b73292e 100644
--- a/src/ephy-home-action.c
+++ b/src/ephy-home-action.c
@@ -40,14 +40,14 @@ typedef struct
EphyLinkFlags flags;
} ClipboardCtx;
+G_DEFINE_TYPE (EphyHomeAction, ephy_home_action, EPHY_TYPE_LINK_ACTION)
+
static const GtkTargetEntry url_drag_types [] =
{
{ EPHY_DND_URI_LIST_TYPE, 0, 0 },
{ EPHY_DND_URL_TYPE, 0, 1 }
};
-static GObjectClass *parent_class = NULL;
-
static void
clipboard_text_received_cb (GtkClipboard *clipboard,
const char *text,
@@ -236,7 +236,7 @@ connect_proxy (GtkAction *action,
{
gchar *action_name;
- GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_home_action_parent_class)->connect_proxy (action, proxy);
g_object_get (action, "name", &action_name, NULL);
@@ -259,7 +259,7 @@ disconnect_proxy (GtkAction *action,
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (gtk_action_activate), action);
- GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_home_action_parent_class)->disconnect_proxy (action, proxy);
}
static void
@@ -267,37 +267,13 @@ ephy_home_action_class_init (EphyHomeActionClass *class)
{
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
action_class->activate = ephy_home_action_activate;
action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy;
}
-GType
-ephy_home_action_get_type (void)
+static void
+ephy_home_action_init (EphyHomeAction *action)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo type_info =
- {
- sizeof (EphyHomeActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ephy_home_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EphyHomeAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- type = g_type_register_static (EPHY_TYPE_LINK_ACTION,
- "EphyHomeAction",
- &type_info, 0);
- }
-
- return type;
+ /* Empty, needed for G_DEFINE_TYPE macro */
}
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)
{
diff --git a/src/ephy-link.c b/src/ephy-link.c
index 7be73742a..acf7b4be5 100644
--- a/src/ephy-link.c
+++ b/src/ephy-link.c
@@ -34,7 +34,7 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
static void
ephy_link_base_init (gpointer g_class)
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 73f817089..38ffc47f1 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -87,9 +87,9 @@ enum
LOCK_CLICKED,
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
+G_DEFINE_TYPE (EphyLocationAction, ephy_location_action, EPHY_TYPE_LINK_ACTION)
static const struct
{
@@ -220,34 +220,6 @@ completion_func (GtkEntryCompletion *completion,
return ret;
}
-GType
-ephy_location_action_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo type_info =
- {
- sizeof (EphyLocationActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ephy_location_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EphyLocationAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_location_action_init,
- };
-
- type = g_type_register_static (EPHY_TYPE_LINK_ACTION,
- "EphyLocationAction",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
action_activated_cb (GtkEntryCompletion *completion,
gint index,
@@ -552,13 +524,13 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
G_CALLBACK (get_title_cb), action, 0);
}
- GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_location_action_parent_class)->connect_proxy (action, proxy);
}
static void
disconnect_proxy (GtkAction *action, GtkWidget *proxy)
{
- GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy);
+ GTK_ACTION_CLASS (ephy_location_action_parent_class)->disconnect_proxy (action, proxy);
if (EPHY_IS_LOCATION_ENTRY (proxy))
{
@@ -664,8 +636,6 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
object_class->finalize = ephy_location_action_finalize;
object_class->get_property = ephy_location_action_get_property;
object_class->set_property = ephy_location_action_set_property;
@@ -904,7 +874,7 @@ ephy_location_action_finalize (GObject *object)
g_free (priv->lock_stock_id);
g_free (priv->lock_tooltip);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_location_action_parent_class)->finalize (object);
}
const char *
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 8229aea23..ba09a6dc0 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -36,6 +36,8 @@
#include <string.h>
+static void ephy_lockdown_iface_init (EphyExtensionIface *iface);
+
/* Make sure these don't overlap with those in ephy-window.c and ephy-toolbar.c */
enum
{
@@ -63,8 +65,6 @@ struct _EphyLockdownPrivate
GList *windows;
};
-static GObjectClass *parent_class = NULL;
-
static int
find_name (GtkActionGroup *action_group,
const char *name)
@@ -255,6 +255,10 @@ ephy_lockdown_init (EphyLockdown *lockdown)
eel_gconf_monitor_add ("/desktop/gnome/lockdown");
}
+G_DEFINE_TYPE_WITH_CODE (EphyLockdown, ephy_lockdown, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
+ ephy_lockdown_iface_init))
+
static void
ephy_lockdown_finalize (GObject *object)
{
@@ -272,7 +276,7 @@ ephy_lockdown_finalize (GObject *object)
eel_gconf_notification_remove (priv->notifier_id[i]);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_lockdown_parent_class)->finalize (object);
}
static void
@@ -313,46 +317,8 @@ ephy_lockdown_class_init (EphyLockdownClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_lockdown_finalize;
g_type_class_add_private (object_class, sizeof (EphyLockdownPrivate));
}
-GType
-ephy_lockdown_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyLockdownClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_lockdown_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyLockdown),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_lockdown_init
- };
- const GInterfaceInfo extension_info =
- {
- (GInterfaceInitFunc) ephy_lockdown_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyLockdown",
- &our_info, 0);
- g_type_add_interface_static (type,
- EPHY_TYPE_EXTENSION,
- &extension_info);
- }
-
- return type;
-}
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c
index 808ea7f7b..64cecb870 100644
--- a/src/ephy-navigation-action.c
+++ b/src/ephy-navigation-action.c
@@ -68,35 +68,7 @@ enum
static void ephy_navigation_action_init (EphyNavigationAction *action);
static void ephy_navigation_action_class_init (EphyNavigationActionClass *class);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_navigation_action_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo type_info =
- {
- sizeof (EphyNavigationActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ephy_navigation_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EphyNavigationAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_navigation_action_init,
- };
-
- type = g_type_register_static (EPHY_TYPE_LINK_ACTION,
- "EphyNavigationAction",
- &type_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyNavigationAction, ephy_navigation_action, EPHY_TYPE_LINK_ACTION)
#define MAX_LABEL_LENGTH 48
@@ -379,7 +351,7 @@ connect_proxy (GtkAction *gaction,
G_CALLBACK (menu_activated_cb), gaction);
}
- GTK_ACTION_CLASS (parent_class)->connect_proxy (gaction, proxy);
+ GTK_ACTION_CLASS (ephy_navigation_action_parent_class)->connect_proxy (gaction, proxy);
}
static void
@@ -440,7 +412,7 @@ ephy_navigation_action_finalize (GObject *object)
g_free (action->priv->arrow_tooltip);
- parent_class->finalize (object);
+ G_OBJECT_CLASS (ephy_navigation_action_parent_class)->finalize (object);
}
static void
@@ -509,8 +481,6 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class)
object_class->set_property = ephy_navigation_action_set_property;
object_class->get_property = ephy_navigation_action_get_property;
- parent_class = g_type_class_peek_parent (class);
-
action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
action_class->connect_proxy = connect_proxy;
action_class->activate = ephy_navigation_action_activate;
diff --git a/src/ephy-net-monitor.c b/src/ephy-net-monitor.c
index e73abfabb..6ac0a9363 100644
--- a/src/ephy-net-monitor.c
+++ b/src/ephy-net-monitor.c
@@ -56,7 +56,7 @@ enum
PROP_NETWORK_STATUS
};
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (EphyNetMonitor, ephy_net_monitor, G_TYPE_OBJECT)
static void
ephy_net_monitor_set_net_status (EphyNetMonitor *monitor,
@@ -331,7 +331,7 @@ ephy_net_monitor_dispose (GObject *object)
priv->notify_id = 0;
}
- parent_class->dispose (object);
+ G_OBJECT_CLASS (ephy_net_monitor_parent_class)->dispose (object);
}
static void
@@ -355,8 +355,6 @@ ephy_net_monitor_class_init (EphyNetMonitorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->dispose = ephy_net_monitor_dispose;
object_class->get_property = ephy_net_monitor_get_property;
@@ -379,34 +377,6 @@ ephy_net_monitor_class_init (EphyNetMonitorClass *klass)
/* public API */
-GType
-ephy_net_monitor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyShellClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_net_monitor_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyNetMonitor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_net_monitor_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyNetMonitor",
- &our_info, 0);
- }
-
- return type;
-}
-
EphyNetMonitor *
ephy_net_monitor_new (void)
{
diff --git a/src/ephy-python-extension.c b/src/ephy-python-extension.c
index 083870333..e96f13ab6 100644
--- a/src/ephy-python-extension.c
+++ b/src/ephy-python-extension.c
@@ -35,6 +35,8 @@
#include "ephy-file-helpers.h"
#include "ephy-debug.h"
+static void ephy_python_extension_iface_init (EphyExtensionIface *iface);
+
#define EPHY_PYTHON_EXTENSION_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PYTHON_EXTENSION, EphyPythonExtensionPrivate))
struct _EphyPythonExtensionPrivate
@@ -49,8 +51,6 @@ enum
PROP_FILENAME
};
-static GObjectClass *parent_class = NULL;
-
static int
set_python_search_path (const char *filename)
{
@@ -104,86 +104,6 @@ ephy_python_extension_init (EphyPythonExtension *extension)
extension->priv = EPHY_PYTHON_EXTENSION_GET_PRIVATE (extension);
}
-static GObject *
-ephy_python_extension_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
-{
- GObject *object;
- EphyPythonExtension *ext;
- char *module_name; /* filename minus optional ".py" */
- /* Note: could equally be a directory */
- PyObject *pModules, *pModule, *pReload;
-
- int num_temp_paths;
-
- object = parent_class->constructor (type, n_construct_properties,
- construct_params);
-
- ext = EPHY_PYTHON_EXTENSION (object);
-
- module_name = g_path_get_basename (ext->priv->filename);
-
- num_temp_paths = set_python_search_path (ext->priv->filename);
-
- pModules = PySys_GetObject ("modules");
- g_assert (pModules != NULL);
-
- pModule = PyDict_GetItemString (pModules, module_name);
-
- if (pModule == NULL)
- {
- pModule = PyImport_ImportModule (module_name);
-
- if (pModule == NULL)
- {
- PyErr_Print ();
- PyErr_Clear ();
- g_warning ("Could not initialize Python module '%s'",
- module_name);
- }
- }
- else
- {
- pReload = PyImport_ReloadModule (pModule);
-
- if (pReload == NULL)
- {
- PyErr_Print ();
- PyErr_Clear ();
- g_warning ("Could not reload Python module '%s'\n"
- "Falling back to previous version",
- module_name);
- }
- else
- {
- Py_DECREF (pReload);
- }
- }
-
- unset_python_search_path (num_temp_paths);
-
- ext->priv->module = pModule;
-
- g_free (module_name);
-
- return object;
-}
-
-static void
-ephy_python_extension_finalize (GObject *object)
-{
- EphyPythonExtension *extension =
- EPHY_PYTHON_EXTENSION (object);
-
- LOG ("EphyPythonExtension finalizing");
-
- g_free (extension->priv->filename);
- Py_XDECREF (extension->priv->module);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
static void
call_python_func (EphyExtension *extension,
const char *func_name,
@@ -283,6 +203,91 @@ ephy_python_extension_iface_init (EphyExtensionIface *iface)
iface->detach_window = impl_detach_window;
}
+G_DEFINE_TYPE_WITH_CODE (EphyPythonExtension, ephy_python_extension, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
+ ephy_python_extension_iface_init))
+
+static GObject *
+ephy_python_extension_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
+{
+ GObject *object;
+ EphyPythonExtension *ext;
+ char *module_name; /* filename minus optional ".py" */
+ /* Note: could equally be a directory */
+ PyObject *pModules, *pModule, *pReload;
+
+ int num_temp_paths;
+
+ object = G_OBJECT_CLASS (ephy_python_extension_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
+
+ ext = EPHY_PYTHON_EXTENSION (object);
+
+ module_name = g_path_get_basename (ext->priv->filename);
+
+ num_temp_paths = set_python_search_path (ext->priv->filename);
+
+ pModules = PySys_GetObject ("modules");
+ g_assert (pModules != NULL);
+
+ pModule = PyDict_GetItemString (pModules, module_name);
+
+ if (pModule == NULL)
+ {
+ pModule = PyImport_ImportModule (module_name);
+
+ if (pModule == NULL)
+ {
+ PyErr_Print ();
+ PyErr_Clear ();
+ g_warning ("Could not initialize Python module '%s'",
+ module_name);
+ }
+ }
+ else
+ {
+ pReload = PyImport_ReloadModule (pModule);
+
+ if (pReload == NULL)
+ {
+ PyErr_Print ();
+ PyErr_Clear ();
+ g_warning ("Could not reload Python module '%s'\n"
+ "Falling back to previous version",
+ module_name);
+ }
+ else
+ {
+ Py_DECREF (pReload);
+ }
+ }
+
+ unset_python_search_path (num_temp_paths);
+
+ ext->priv->module = pModule;
+
+ g_free (module_name);
+
+ return object;
+}
+
+static void
+ephy_python_extension_finalize (GObject *object)
+{
+ EphyPythonExtension *extension =
+ EPHY_PYTHON_EXTENSION (object);
+
+ LOG ("EphyPythonExtension finalizing");
+
+ g_free (extension->priv->filename);
+ Py_XDECREF (extension->priv->module);
+
+ G_OBJECT_CLASS (ephy_python_extension_parent_class)->finalize (object);
+}
+
static void
ephy_python_extension_get_property (GObject *object,
guint prop_id,
@@ -316,8 +321,6 @@ ephy_python_extension_class_init (EphyPythonExtensionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_python_extension_finalize;
object_class->constructor = ephy_python_extension_constructor;
object_class->get_property = ephy_python_extension_get_property;
@@ -335,37 +338,3 @@ ephy_python_extension_class_init (EphyPythonExtensionClass *klass)
g_type_class_add_private (object_class, sizeof (EphyPythonExtensionPrivate));
}
-GType
-ephy_python_extension_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyPythonExtensionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_python_extension_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyPythonExtension),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_python_extension_init
- };
- const GInterfaceInfo extension_info =
- {
- (GInterfaceInitFunc) ephy_python_extension_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EphyPythonExtension",
- &our_info, 0);
-
- g_type_add_interface_static (type, EPHY_TYPE_EXTENSION, &extension_info);
- }
-
- return type;
-}
diff --git a/src/ephy-python-loader.c b/src/ephy-python-loader.c
index 756be4cbd..ed8c70108 100644
--- a/src/ephy-python-loader.c
+++ b/src/ephy-python-loader.c
@@ -35,8 +35,6 @@ struct _EphyPythonLoaderPrivate
gpointer dummy;
};
-static GObjectClass *parent_class = NULL;
-
static GObject *
impl_get_object (EphyLoader *eloader,
GKeyFile *keyfile)
@@ -80,6 +78,9 @@ ephy_python_loader_iface_init (EphyLoaderIface *iface)
iface->release_object = impl_release_object;
}
+G_DEFINE_TYPE_WITH_CODE (EphyPythonLoader, ephy_python_loader, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LOADER, ephy_python_loader_iface_init))
+
static void
ephy_python_loader_init (EphyPythonLoader *loader)
{
@@ -96,7 +97,7 @@ ephy_python_loader_finalize (GObject *object)
{
LOG ("EphyPythonLoader finalising");
- parent_class->finalize (object);
+ G_OBJECT_CLASS (ephy_python_loader_parent_class)->finalize (object);
ephy_python_shutdown ();
}
@@ -106,44 +107,8 @@ ephy_python_loader_class_init (EphyPythonLoaderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_python_loader_finalize;
g_type_class_add_private (object_class, sizeof (EphyPythonLoaderPrivate));
}
-GType
-ephy_python_loader_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyPythonLoaderClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_python_loader_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyPythonLoader),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_python_loader_init
- };
- const GInterfaceInfo loader_info =
- {
- (GInterfaceInitFunc) ephy_python_loader_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EphyPythonLoader",
- &our_info, 0);
-
- g_type_add_interface_static (type, EPHY_TYPE_LOADER, &loader_info);
- }
-
- return type;
-}
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 2342d2998..cf7d24abc 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -98,46 +98,9 @@ enum
PROP_ACTIVE_WINDOW
};
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_session_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphySessionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_session_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphySession),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_session_init
- };
-
- const GInterfaceInfo extension_info =
- {
- (GInterfaceInitFunc) ephy_session_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphySession",
- &our_info, 0);
-
- g_type_add_interface_static (type,
- EPHY_TYPE_EXTENSION,
- &extension_info);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_CODE (EphySession, ephy_session, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
+ ephy_session_iface_init))
/* Gnome session client */
@@ -926,7 +889,7 @@ ephy_session_dispose (GObject *object)
g_signal_handlers_disconnect_by_func
(client, G_CALLBACK (die_cb), session);
- parent_class->dispose (object);
+ G_OBJECT_CLASS (ephy_session_parent_class)->dispose (object);
}
static void
@@ -940,7 +903,7 @@ ephy_session_finalize (GObject *object)
g_list_free (session->priv->windows);
g_list_free (session->priv->tool_windows);
- parent_class->finalize (object);
+ G_OBJECT_CLASS (ephy_session_parent_class)->finalize (object);
}
static void
@@ -983,8 +946,6 @@ ephy_session_class_init (EphySessionClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
object_class->dispose = ephy_session_dispose;
object_class->finalize = ephy_session_finalize;
object_class->get_property = ephy_session_get_property;
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 22fd81e14..27687f515 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -90,35 +90,7 @@ static void ephy_shell_dispose (GObject *object);
static void ephy_shell_finalize (GObject *object);
static GObject *impl_get_embed_single (EphyEmbedShell *embed_shell);
-static GObjectClass *parent_class;
-
-GType
-ephy_shell_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyShellClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_shell_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyShell),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_shell_init
- };
-
- type = g_type_register_static (EPHY_TYPE_EMBED_SHELL,
- "EphyShell",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyShell, ephy_shell, EPHY_TYPE_EMBED_SHELL)
static void
ephy_shell_class_init (EphyShellClass *klass)
@@ -126,8 +98,6 @@ ephy_shell_class_init (EphyShellClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
EphyEmbedShellClass *embed_shell_class = EPHY_EMBED_SHELL_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->dispose = ephy_shell_dispose;
object_class->finalize = ephy_shell_finalize;
@@ -241,7 +211,7 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
EphyShellPrivate *priv = shell->priv;
GObject *embed_single;
- embed_single = EPHY_EMBED_SHELL_CLASS (parent_class)->get_embed_single (embed_shell);
+ embed_single = EPHY_EMBED_SHELL_CLASS (ephy_shell_parent_class)->get_embed_single (embed_shell);
if (embed_single != NULL &&
priv->embed_single_connected == FALSE)
@@ -370,13 +340,13 @@ ephy_shell_dispose (GObject *object)
}
#endif /* ENABLE_NETWORK_MANAGER */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_shell_parent_class)->dispose (object);
}
static void
ephy_shell_finalize (GObject *object)
{
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_shell_parent_class)->finalize (object);
LOG ("Ephy shell finalised");
}
diff --git a/src/ephy-statusbar.c b/src/ephy-statusbar.c
index b7fac950d..6f532f638 100644
--- a/src/ephy-statusbar.c
+++ b/src/ephy-statusbar.c
@@ -60,43 +60,14 @@ enum
};
static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class;
-GType
-ephy_statusbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyStatusbarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_statusbar_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyStatusbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_statusbar_init
- };
-
- type = g_type_register_static (GTK_TYPE_STATUSBAR,
- "EphyStatusbar",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyStatusbar, ephy_statusbar, GTK_TYPE_STATUSBAR)
static void
ephy_statusbar_class_init (EphyStatusbarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
signals[LOCK_CLICKED] =
g_signal_new
("lock-clicked",
diff --git a/src/ephy-toolbar-editor.c b/src/ephy-toolbar-editor.c
index ed1c900f0..043aa3e53 100644
--- a/src/ephy-toolbar-editor.c
+++ b/src/ephy-toolbar-editor.c
@@ -93,7 +93,7 @@ enum
PROP_WINDOW
};
-static GObjectClass *parent_class = NULL;
+G_DEFINE_TYPE (EphyToolbarEditor, ephy_toolbar_editor, GTK_TYPE_DIALOG)
static gboolean
row_is_separator (GtkTreeModel *model,
@@ -180,8 +180,9 @@ ephy_toolbar_editor_constructor (GType type,
char *pref;
int i;
- object = parent_class->constructor (type, n_construct_properties,
- construct_params);
+ object = G_OBJECT_CLASS (ephy_toolbar_editor_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
dialog = GTK_WIDGET (object);
priv = EPHY_TOOLBAR_EDITOR (object)->priv;
@@ -305,7 +306,7 @@ ephy_toolbar_editor_finalize (GObject *object)
g_object_set_data (G_OBJECT (priv->window), DATA_KEY, NULL);
- parent_class->finalize (object);
+ G_OBJECT_CLASS (ephy_toolbar_editor_parent_class)->finalize (object);
}
static void
@@ -340,8 +341,6 @@ ephy_toolbar_editor_class_init (EphyToolbarEditorClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->constructor = ephy_toolbar_editor_constructor;
object_class->finalize = ephy_toolbar_editor_finalize;
object_class->get_property = ephy_toolbar_editor_get_property;
@@ -361,34 +360,6 @@ ephy_toolbar_editor_class_init (EphyToolbarEditorClass *klass)
g_type_class_add_private (object_class, sizeof (EphyToolbarEditorPrivate));
}
-GType
-ephy_toolbar_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyToolbarEditorClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_toolbar_editor_class_init,
- NULL,
- NULL,
- sizeof (EphyToolbarEditor),
- 0,
- (GInstanceInitFunc) ephy_toolbar_editor_init
- };
-
- type = g_type_register_static (GTK_TYPE_DIALOG,
- "EphyToolbarEditor",
- &our_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
ephy_toolbar_editor_show (EphyWindow *window)
{
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 0ca828670..dbb5f5a64 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -105,9 +105,16 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
+static void
+ephy_toolbar_iface_init (EphyLinkIface *iface)
+{
+}
+
+G_DEFINE_TYPE_WITH_CODE (EphyToolbar, ephy_toolbar, EGG_TYPE_EDITABLE_TOOLBAR,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+ ephy_toolbar_iface_init))
/* helper functions */
@@ -524,13 +531,13 @@ ephy_toolbar_set_zoom (EphyToolbar *toolbar,
static void
ephy_toolbar_realize (GtkWidget *widget)
{
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->realize (widget);
}
static void
ephy_toolbar_unrealize (GtkWidget *widget)
{
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+ GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->unrealize (widget);
}
static void
@@ -538,7 +545,7 @@ ephy_toolbar_show (GtkWidget *widget)
{
EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
- GTK_WIDGET_CLASS (parent_class)->show (widget);
+ GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->show (widget);
ephy_toolbar_update_spinner (toolbar);
}
@@ -548,7 +555,7 @@ ephy_toolbar_hide (GtkWidget *widget)
{
EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
- GTK_WIDGET_CLASS (parent_class)->hide (widget);
+ GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->hide (widget);
ephy_toolbar_update_spinner (toolbar);
}
@@ -571,8 +578,9 @@ ephy_toolbar_constructor (GType type,
EphyToolbarPrivate *priv;
GtkToolbar *gtoolbar;
- object = parent_class->constructor (type, n_construct_properties,
- construct_params);
+ object = G_OBJECT_CLASS (ephy_toolbar_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
toolbar = EPHY_TOOLBAR (object);
priv = toolbar->priv;
@@ -614,7 +622,7 @@ ephy_toolbar_finalize (GObject *object)
priv->set_focus_handler);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_toolbar_parent_class)->finalize (object);
}
static void
@@ -649,8 +657,6 @@ ephy_toolbar_class_init (EphyToolbarClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->constructor = ephy_toolbar_constructor;
object_class->finalize = ephy_toolbar_finalize;
object_class->set_property = ephy_toolbar_set_property;
@@ -705,43 +711,6 @@ ephy_toolbar_class_init (EphyToolbarClass *klass)
g_type_class_add_private (object_class, sizeof(EphyToolbarPrivate));
}
-GType
-ephy_toolbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyToolbarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_toolbar_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyToolbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_toolbar_init
- };
- const GInterfaceInfo link_info =
- {
- NULL,
- NULL,
- NULL
- };
-
- type = g_type_register_static (EGG_TYPE_EDITABLE_TOOLBAR,
- "EphyToolbar",
- &our_info, 0);
- g_type_add_interface_static (type,
- EPHY_TYPE_LINK,
- &link_info);
- }
-
- return type;
-}
-
EphyToolbar *
ephy_toolbar_new (EphyWindow *window)
{
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index e626aed51..68d667cd9 100644
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -46,34 +46,7 @@ struct _EphyToolbarsModelPrivate
static void ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass);
static void ephy_toolbars_model_init (EphyToolbarsModel *model);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_toolbars_model_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info = {
- sizeof (EphyToolbarsModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_toolbars_model_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyToolbarsModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_toolbars_model_init
- };
-
- type = g_type_register_static (EGG_TYPE_TOOLBARS_MODEL,
- "EphyToolbarsModel",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyToolbarsModel, ephy_toolbars_model, EGG_TYPE_TOOLBARS_MODEL)
static gboolean
save_changes_idle (EphyToolbarsModel *model)
@@ -282,7 +255,7 @@ ephy_toolbars_model_dispose (GObject *object)
save_changes_idle (model);
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_toolbars_model_parent_class)->dispose (object);
}
static void
@@ -303,7 +276,7 @@ ephy_toolbars_model_finalize (GObject *object)
g_free (priv->xml_file);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_toolbars_model_parent_class)->finalize (object);
}
static void
@@ -311,8 +284,6 @@ ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->dispose = ephy_toolbars_model_dispose;
object_class->finalize = ephy_toolbars_model_finalize;
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index e4b7dd04d..a1ce8bf23 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -155,43 +155,13 @@ static void passwords_changed_cb (EphyPasswordManager *manager,
PdmDialog *dialog);
-static GObjectClass *parent_class = NULL;
-
-GType
-pdm_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (PdmDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) pdm_dialog_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (PdmDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pdm_dialog_init
- };
-
- type = g_type_register_static (EPHY_TYPE_DIALOG,
- "PdmDialog",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (PdmDialog, pdm_dialog, EPHY_TYPE_DIALOG)
static void
pdm_dialog_class_init (PdmDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = pdm_dialog_finalize;
g_type_class_add_private (object_class, sizeof(PdmDialogPrivate));
@@ -1553,7 +1523,7 @@ pdm_dialog_finalize (GObject *object)
g_free (dialog->priv->passwords);
g_free (dialog->priv->cookies);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (pdm_dialog_parent_class)->finalize (object);
}
void
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index 20659acaa..f501946c3 100644
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -54,8 +54,6 @@ enum
PROP_WINDOW
};
-static GObjectClass *parent_class = NULL;
-
#define EPHY_PPVIEW_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarPrivate))
struct PPViewToolbarPrivate
@@ -121,41 +119,13 @@ static const char ui_info[] =
"</toolbar>"
"</ui>\n";
-GType
-ppview_toolbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (PPViewToolbarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ppview_toolbar_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (PPViewToolbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ppview_toolbar_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "PPViewToolbar",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (PPViewToolbar, ppview_toolbar, G_TYPE_OBJECT)
static void
ppview_toolbar_class_init (PPViewToolbarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ppview_toolbar_finalize;
object_class->set_property = ppview_toolbar_set_property;
@@ -286,7 +256,7 @@ ppview_toolbar_finalize (GObject *object)
t->priv->action_group);
g_object_unref (t->priv->action_group);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ppview_toolbar_parent_class)->finalize (object);
}
PPViewToolbar *
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 8cc84507e..4a21c4815 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -293,35 +293,7 @@ struct PrefsDialogPrivate
GHashTable *iso_3166_table;
};
-static GObjectClass *parent_class = NULL;
-
-GType
-prefs_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (PrefsDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) prefs_dialog_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (PrefsDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) prefs_dialog_init
- };
-
- type = g_type_register_static (EPHY_TYPE_DIALOG,
- "PrefsDialog",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (PrefsDialog, prefs_dialog, EPHY_TYPE_DIALOG)
static void
prefs_dialog_finalize (GObject *object)
@@ -352,7 +324,7 @@ prefs_dialog_finalize (GObject *object)
g_hash_table_destroy (priv->iso_639_table);
g_hash_table_destroy (priv->iso_3166_table);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (prefs_dialog_parent_class)->finalize (object);
}
static void
@@ -360,8 +332,6 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = prefs_dialog_finalize;
g_type_class_add_private (object_class, sizeof(PrefsDialogPrivate));