aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--embed/downloader-view.c34
-rw-r--r--embed/ephy-download.c34
-rw-r--r--embed/ephy-embed-dialog.c34
-rw-r--r--embed/ephy-embed-persist.c34
-rw-r--r--embed/ephy-embed-shell.c38
-rw-r--r--embed/ephy-encodings.c34
-rw-r--r--embed/ephy-favicon-cache.c36
-rw-r--r--embed/ephy-history.c36
-rw-r--r--embed/mozilla/mozilla-download.cpp34
-rw-r--r--embed/mozilla/mozilla-embed-event.cpp47
-rw-r--r--embed/mozilla/mozilla-embed-find.cpp57
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp39
-rw-r--r--embed/mozilla/mozilla-x509-cert.cpp56
13 files changed, 50 insertions, 463 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index b0292fe0b..e85073cbb 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -143,43 +143,13 @@ static void
show_notification_window (DownloaderView *dv);
#endif
-static GObjectClass *parent_class = NULL;
-
-GType
-downloader_view_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (DownloaderViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) downloader_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (DownloaderView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) downloader_view_init
- };
-
- type = g_type_register_static (EPHY_TYPE_DIALOG,
- "DownloaderView",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (DownloaderView, downloader_view, EPHY_TYPE_DIALOG)
static void
downloader_view_class_init (DownloaderViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = downloader_view_finalize;
g_type_class_add_private (object_class, sizeof(DownloaderViewPrivate));
@@ -329,7 +299,7 @@ downloader_view_finalize (GObject *object)
g_hash_table_destroy (dv->priv->downloads_hash);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (downloader_view_parent_class)->finalize (object);
#ifdef HAVE_LIBNOTIFY
if (notify_is_initted ())
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index fac8ce7ae..e903d4c58 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -45,45 +45,15 @@ struct _EphyDownloadPrivate
gint64 remaining_time;
};
-static GObjectClass *parent_class = NULL;
+static guint ephy_download_signals[LAST_SIGNAL];
-static guint ephy_download_signals[LAST_SIGNAL] = { 0 };
-
-GType
-ephy_download_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyDownloadClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_download_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EphyDownload),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_download_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyDownload",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyDownload, ephy_download, G_TYPE_OBJECT)
static void
ephy_download_class_init (EphyDownloadClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
ephy_download_signals[CHANGED] =
g_signal_new ("changed",
EPHY_TYPE_DOWNLOAD,
diff --git a/embed/ephy-embed-dialog.c b/embed/ephy-embed-dialog.c
index c059afedc..19f0e15c1 100644
--- a/embed/ephy-embed-dialog.c
+++ b/embed/ephy-embed-dialog.c
@@ -52,43 +52,13 @@ struct _EphyEmbedDialogPrivate
EphyEmbed *embed;
};
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_embed_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEmbedDialogClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_embed_dialog_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyEmbedDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_embed_dialog_init
- };
-
- type = g_type_register_static (EPHY_TYPE_DIALOG,
- "EphyEmbedDialog",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEmbedDialog, ephy_embed_dialog, EPHY_TYPE_DIALOG)
static void
ephy_embed_dialog_class_init (EphyEmbedDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_embed_dialog_finalize;
object_class->set_property = ephy_embed_dialog_set_property;
object_class->get_property = ephy_embed_dialog_get_property;
@@ -129,7 +99,7 @@ ephy_embed_dialog_finalize (GObject *object)
unset_embed (dialog);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_embed_dialog_parent_class)->finalize (object);
}
static void
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c
index 062cd0207..950ad7abb 100644
--- a/embed/ephy-embed-persist.c
+++ b/embed/ephy-embed-persist.c
@@ -60,35 +60,7 @@ struct _EphyEmbedPersistPrivate
static void ephy_embed_persist_class_init (EphyEmbedPersistClass *klass);
static void ephy_embed_persist_init (EphyEmbedPersist *ges);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_embed_persist_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEmbedPersistClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_embed_persist_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EphyEmbedPersist),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_embed_persist_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyEmbedPersist",
- &our_info, G_TYPE_FLAG_ABSTRACT);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEmbedPersist, ephy_embed_persist, G_TYPE_OBJECT)
/**
* ephy_embed_persist_set_dest:
@@ -522,7 +494,7 @@ ephy_embed_persist_finalize (GObject *object)
LOG ("EphyEmbedPersist finalised %p", object);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_embed_persist_parent_class)->finalize (object);
}
static void
@@ -530,8 +502,6 @@ ephy_embed_persist_class_init (EphyEmbedPersistClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_embed_persist_finalize;
object_class->set_property = ephy_embed_persist_set_property;
object_class->get_property = ephy_embed_persist_get_property;
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 17334526c..067f7ae1b 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -68,42 +68,14 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
static void ephy_embed_shell_class_init (EphyEmbedShellClass *klass);
static void ephy_embed_shell_init (EphyEmbedShell *shell);
EphyEmbedShell *embed_shell = NULL;
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_embed_shell_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEmbedShellClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_embed_shell_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EphyEmbedShell),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_embed_shell_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyEmbedShell",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEmbedShell, ephy_embed_shell, G_TYPE_OBJECT)
static void
ephy_embed_shell_dispose (GObject *object)
@@ -148,7 +120,7 @@ ephy_embed_shell_dispose (GObject *object)
priv->print_settings = NULL;
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_embed_shell_parent_class)->dispose (object);
}
static void
@@ -175,7 +147,7 @@ ephy_embed_shell_finalize (GObject *object)
shell->priv->adblock_manager = NULL;
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_embed_shell_parent_class)->finalize (object);
}
/**
@@ -324,8 +296,6 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->dispose = ephy_embed_shell_dispose;
object_class->finalize = ephy_embed_shell_finalize;
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index 7172dad64..b6aa7e680 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -187,35 +187,7 @@ enum
static void ephy_encodings_class_init (EphyEncodingsClass *klass);
static void ephy_encodings_init (EphyEncodings *ma);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_encodings_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyEncodingsClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_encodings_class_init,
- NULL,
- NULL,
- sizeof (EphyEncodings),
- 0,
- (GInstanceInitFunc) ephy_encodings_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyEncodings",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyEncodings, ephy_encodings, G_TYPE_OBJECT)
static void
ephy_encodings_finalize (GObject *object)
@@ -235,7 +207,7 @@ ephy_encodings_finalize (GObject *object)
LOG ("EphyEncodings finalised");
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_encodings_parent_class)->finalize (object);
}
static void
@@ -243,8 +215,6 @@ ephy_encodings_class_init (EphyEncodingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_encodings_finalize;
g_type_class_add_private (object_class, sizeof (EphyEncodingsPrivate));
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
index 35e3f0809..cd6ba4862 100644
--- a/embed/ephy-favicon-cache.c
+++ b/embed/ephy-favicon-cache.c
@@ -116,45 +116,15 @@ enum
NEEDS_MASK = 0x3f
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_favicon_cache_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyFaviconCacheClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_favicon_cache_class_init,
- NULL,
- NULL,
- sizeof (EphyFaviconCache),
- 0,
- (GInstanceInitFunc) ephy_favicon_cache_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyFaviconCache",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyFaviconCache, ephy_favicon_cache, G_TYPE_OBJECT)
static void
ephy_favicon_cache_class_init (EphyFaviconCacheClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_favicon_cache_finalize;
signals[CHANGED] =
@@ -473,7 +443,7 @@ ephy_favicon_cache_finalize (GObject *object)
LOG ("Requests: cached %" G_GUINT64_FORMAT " / total %" G_GUINT64_FORMAT " = %.3f",
priv->cached, priv->requests, ((double) priv->cached) / ((double) priv->requests));
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_favicon_cache_parent_class)->finalize (object);
}
static void
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 127d97656..9a0327d94 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -88,42 +88,14 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
static void ephy_history_class_init (EphyHistoryClass *klass);
static void ephy_history_init (EphyHistory *history);
static void ephy_history_finalize (GObject *object);
static gboolean impl_add_page (EphyHistory *, const char *, gboolean, gboolean);
-static GObjectClass *parent_class = NULL;
-
-GType
-ephy_history_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphyHistoryClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_history_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyHistory),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_history_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphyHistory",
- &our_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (EphyHistory, ephy_history, G_TYPE_OBJECT)
static void
ephy_history_set_property (GObject *object,
@@ -162,8 +134,6 @@ ephy_history_class_init (EphyHistoryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = ephy_history_finalize;
object_class->get_property = ephy_history_get_property;
object_class->set_property = ephy_history_set_property;
@@ -627,7 +597,7 @@ ephy_history_finalize (GObject *object)
LOG ("Global history finalized");
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (ephy_history_parent_class)->finalize (object);
}
EphyHistory *
diff --git a/embed/mozilla/mozilla-download.cpp b/embed/mozilla/mozilla-download.cpp
index 0b420547c..3d261ec2f 100644
--- a/embed/mozilla/mozilla-download.cpp
+++ b/embed/mozilla/mozilla-download.cpp
@@ -51,35 +51,7 @@ struct _MozillaDownloadPrivate
#define MOZILLA_DOWNLOAD_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_DOWNLOAD, MozillaDownloadPrivate))
-static GObjectClass *parent_class = NULL;
-
-GType
-mozilla_download_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (MozillaDownloadClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) mozilla_download_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MozillaDownload),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_download_init
- };
-
- type = g_type_register_static (EPHY_TYPE_DOWNLOAD,
- "MozillaDownload",
- &our_info, (GTypeFlags)0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (MozillaDownload, mozilla_download, EPHY_TYPE_DOWNLOAD)
static char *
impl_get_target (EphyDownload *download)
@@ -221,7 +193,7 @@ mozilla_download_finalize (GObject *object)
LOG ("MozillaDownload %p finalised", object);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (mozilla_download_parent_class)->finalize (object);
}
static void
@@ -266,8 +238,6 @@ mozilla_download_class_init (MozillaDownloadClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
EphyDownloadClass *download_class = EPHY_DOWNLOAD_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->finalize = mozilla_download_finalize;
object_class->set_property = mozilla_download_set_property;
object_class->get_property = mozilla_download_get_property;
diff --git a/embed/mozilla/mozilla-embed-event.cpp b/embed/mozilla/mozilla-embed-event.cpp
index 9b5b06d85..faaff0436 100644
--- a/embed/mozilla/mozilla-embed-event.cpp
+++ b/embed/mozilla/mozilla-embed-event.cpp
@@ -43,46 +43,9 @@ static void mozilla_embed_event_class_init (MozillaEmbedEventClass *klass);
static void mozilla_embed_event_init (MozillaEmbedEvent *event);
static void ephy_embed_event_iface_init (EphyEmbedEventIface *iface);
-static GObjectClass *parent_class = NULL;
-
-GType
-mozilla_embed_event_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (MozillaEmbedEventClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) mozilla_embed_event_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MozillaEmbedEvent),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_embed_event_init
- };
-
- const GInterfaceInfo embed_event_info =
- {
- (GInterfaceInitFunc) ephy_embed_event_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "MozillaEmbedEvent",
- &our_info, (GTypeFlags) 0);
-
- g_type_add_interface_static (type,
- EPHY_TYPE_EMBED_EVENT,
- &embed_event_info);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_CODE (MozillaEmbedEvent, mozilla_embed_event, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_EVENT,
+ ephy_embed_event_iface_init))
MozillaEmbedEvent *
mozilla_embed_event_new (gpointer dom_event)
@@ -193,7 +156,7 @@ mozilla_embed_event_finalize (GObject *object)
LOG ("MozillaEmbedEvent %p finalised", object);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (mozilla_embed_event_parent_class)->finalize (object);
}
static void
@@ -213,8 +176,6 @@ mozilla_embed_event_class_init (MozillaEmbedEventClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->finalize = mozilla_embed_event_finalize;
g_type_class_add_private (object_class, sizeof (MozillaEmbedEventPrivate));
diff --git a/embed/mozilla/mozilla-embed-find.cpp b/embed/mozilla/mozilla-embed-find.cpp
index 576d8ec11..99abee0b3 100644
--- a/embed/mozilla/mozilla-embed-find.cpp
+++ b/embed/mozilla/mozilla-embed-find.cpp
@@ -30,6 +30,10 @@
#include "mozilla-embed-find.h"
+static void mozilla_embed_find_class_init (MozillaEmbedFindClass *klass);
+static void mozilla_embed_find_init (MozillaEmbedFind *self);
+static void ephy_find_iface_init (EphyEmbedFindIface *iface);
+
#define MOZILLA_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_FIND, MozillaEmbedFindPrivate))
struct _MozillaEmbedFindPrivate
@@ -37,8 +41,6 @@ struct _MozillaEmbedFindPrivate
EphyFind *find;
};
-static GObjectClass *parent_class = NULL;
-
static void
impl_set_embed (EphyEmbedFind *efind,
EphyEmbed *embed)
@@ -49,6 +51,10 @@ impl_set_embed (EphyEmbedFind *efind,
priv->find->SetEmbed (embed);
}
+G_DEFINE_TYPE_WITH_CODE (MozillaEmbedFind, mozilla_embed_find, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_FIND,
+ ephy_find_iface_init))
+
static void
impl_set_properties (EphyEmbedFind *efind,
const char *find_string,
@@ -129,8 +135,9 @@ mozilla_embed_find_constructor (GType type, guint n_construct_properties,
/* we depend on single because of mozilla initialization */
ephy_embed_shell_get_embed_single (embed_shell);
- return parent_class->constructor (type, n_construct_properties,
- construct_params);
+ return G_OBJECT_CLASS (mozilla_embed_find_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
}
static void
@@ -140,7 +147,7 @@ mozilla_embed_find_finalize (GObject *object)
delete find->priv->find;
- parent_class->finalize (object);
+ G_OBJECT_CLASS (mozilla_embed_find_parent_class)->finalize (object);
g_object_unref (embed_shell);
}
@@ -150,49 +157,9 @@ mozilla_embed_find_class_init (MozillaEmbedFindClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->constructor = mozilla_embed_find_constructor;
object_class->finalize = mozilla_embed_find_finalize;
g_type_class_add_private (object_class, sizeof (MozillaEmbedFindPrivate));
}
-GType
-mozilla_embed_find_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (MozillaEmbedFindClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) mozilla_embed_find_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (MozillaEmbedFind),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_embed_find_init
- };
-
- const GInterfaceInfo find_info =
- {
- (GInterfaceInitFunc) ephy_find_iface_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "MozillaEmbedFind",
- &our_info,
- (GTypeFlags)0);
- g_type_add_interface_static (type,
- EPHY_TYPE_EMBED_FIND,
- &find_info);
- }
-
- return type;
-}
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 16909b49c..7149873e3 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -71,35 +71,7 @@ struct MozillaEmbedPersistPrivate
nsCOMPtr<nsIWebBrowserPersist> mPersist;
};
-static GObjectClass *parent_class = NULL;
-
-GType
-mozilla_embed_persist_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (MozillaEmbedPersistClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) mozilla_embed_persist_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MozillaEmbedPersist),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_embed_persist_init
- };
-
- type = g_type_register_static (EPHY_TYPE_EMBED_PERSIST,
- "MozillaEmbedPersist",
- &our_info, (GTypeFlags) 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (MozillaEmbedPersist, mozilla_embed_persist, EPHY_TYPE_EMBED_PERSIST)
static void
mozilla_embed_persist_init (MozillaEmbedPersist *persist)
@@ -116,7 +88,7 @@ mozilla_embed_persist_finalize (GObject *object)
persist->priv->mPersist = nsnull;
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (mozilla_embed_persist_parent_class)->finalize (object);
}
void
@@ -393,8 +365,9 @@ mozilla_embed_persist_constructor (GType type, guint n_construct_properties,
/* this will ensure that mozilla is started up */
ephy_embed_shell_get_embed_single (embed_shell);
- return parent_class->constructor (type, n_construct_properties,
- construct_params);
+ return G_OBJECT_CLASS (mozilla_embed_persist_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
}
static void
@@ -403,8 +376,6 @@ mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
EphyEmbedPersistClass *persist_class = EPHY_EMBED_PERSIST_CLASS (klass);
- parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
object_class->finalize = mozilla_embed_persist_finalize;
object_class->constructor = mozilla_embed_persist_constructor;
diff --git a/embed/mozilla/mozilla-x509-cert.cpp b/embed/mozilla/mozilla-x509-cert.cpp
index 8774425cd..97885701e 100644
--- a/embed/mozilla/mozilla-x509-cert.cpp
+++ b/embed/mozilla/mozilla-x509-cert.cpp
@@ -47,46 +47,9 @@ enum
PROP_MOZILLA_CERT
};
-static GObjectClass *parent_class = NULL;
-
-GType
-mozilla_x509_cert_get_type (void)
-{
- static GType mozilla_x509_cert_type = 0;
-
- if (mozilla_x509_cert_type == 0)
- {
- const GTypeInfo our_info =
- {
- sizeof (MozillaX509CertClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) mozilla_x509_cert_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (MozillaX509Cert),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_x509_cert_init
- };
-
- const GInterfaceInfo x509_cert_info =
- {
- (GInterfaceInitFunc) ephy_x509_cert_init, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
-
- mozilla_x509_cert_type = g_type_register_static (G_TYPE_OBJECT,
- "MozillaX509Cert",
- &our_info,
- (GTypeFlags)0);
- g_type_add_interface_static (mozilla_x509_cert_type,
- EPHY_TYPE_X509_CERT,
- &x509_cert_info);
- }
-
- return mozilla_x509_cert_type;
-}
+G_DEFINE_TYPE_WITH_CODE (MozillaX509Cert, mozilla_x509_cert, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_X509_CERT,
+ ephy_x509_cert_init))
static void
mozilla_x509_cert_set_mozilla_cert (MozillaX509Cert *cert,
@@ -219,7 +182,7 @@ mozilla_x509_cert_finalize (GObject *object)
g_free (cert->priv->title);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (mozilla_x509_cert_parent_class)->finalize (object);
}
static void
@@ -233,8 +196,6 @@ mozilla_x509_cert_class_init (MozillaX509CertClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = (GObjectClass*)g_type_class_peek_parent (klass);
-
object_class->finalize = mozilla_x509_cert_finalize;
object_class->set_property = impl_set_property;
object_class->get_property = impl_get_property;
@@ -252,10 +213,7 @@ mozilla_x509_cert_class_init (MozillaX509CertClass *klass)
MozillaX509Cert *
mozilla_x509_cert_new (nsIX509Cert *moz_cert)
{
- MozillaX509Cert *cert;
-
- cert = (MozillaX509Cert*)g_object_new (MOZILLA_TYPE_X509_CERT,
- "mozilla-cert", moz_cert,
- (char *) NULL);
- return cert;
+ return g_object_new (MOZILLA_TYPE_X509_CERT,
+ "mozilla-cert", moz_cert,
+ NULL);
}