aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2008-02-18 07:23:36 +0800
committerXan Lopez <xan@src.gnome.org>2008-02-18 07:23:36 +0800
commitf0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a (patch)
treecd6ef67c3cb63ac81206f2a22175c3b8dd64e565 /embed/mozilla
parent2f3e9b5994ebec0a15f6c3ba691732b38a4fbe22 (diff)
downloadgsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar.gz
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar.bz2
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar.lz
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar.xz
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.tar.zst
gsoc2013-epiphany-f0f2a211a474b2b5fccdaa5a15a5e3fb27866f3a.zip
Use G_DEFINE_TYPE* where possible in embed/* (#517090)
svn path=/trunk/; revision=7964
Diffstat (limited to 'embed/mozilla')
-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
5 files changed, 30 insertions, 203 deletions
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);
}