[epiphany/wip/modern_gobject] EphyEmbedContainer: Use G_DEFINE_INTERFACE
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/modern_gobject] EphyEmbedContainer: Use G_DEFINE_INTERFACE
- Date: Tue, 15 Sep 2015 00:39:41 +0000 (UTC)
commit 61b1071ed4211c5617c291295d2c941c3f5f234c
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Sep 14 19:33:10 2015 -0500
EphyEmbedContainer: Use G_DEFINE_INTERFACE
embed/ephy-embed-container.c | 61 ++++++++++++-----------------------------
embed/ephy-embed-container.h | 8 +++---
src/ephy-window.c | 2 +-
3 files changed, 23 insertions(+), 48 deletions(-)
---
diff --git a/embed/ephy-embed-container.c b/embed/ephy-embed-container.c
index 90bee89..58c709d 100644
--- a/embed/ephy-embed-container.c
+++ b/embed/ephy-embed-container.c
@@ -23,45 +23,20 @@
#include "ephy-embed-container.h"
#include "ephy-embed-type-builtins.h"
-static void
-ephy_embed_container_base_init (gpointer g_class)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- initialized = TRUE;
-
- g_object_interface_install_property (g_class,
- g_param_spec_boolean ("is-popup", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
- G_PARAM_CONSTRUCT_ONLY));
- g_object_interface_install_property (g_class,
- g_param_spec_object ("active-child", NULL, NULL,
- GTK_TYPE_WIDGET /* Can't use an interface type
here */,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
- }
-}
+G_DEFINE_INTERFACE (EphyEmbedContainer, ephy_embed_container, G_TYPE_OBJECT);
-GType
-ephy_embed_container_get_type (void)
+static void
+ephy_embed_container_default_init (EphyEmbedContainerInterface *iface)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo our_info =
- {
- sizeof (EphyEmbedContainerIface),
- ephy_embed_container_base_init,
- NULL,
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE,
- "EphyEmbedContainer",
- &our_info, (GTypeFlags)0);
- }
-
- return type;
+ g_object_interface_install_property (iface,
+ g_param_spec_boolean ("is-popup", NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("active-child", NULL, NULL,
+ GTK_TYPE_WIDGET /* Can't use an interface type
here */,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
@@ -82,7 +57,7 @@ ephy_embed_container_add_child (EphyEmbedContainer *container,
gint position,
gboolean set_active)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), -1);
g_return_val_if_fail (EPHY_IS_EMBED (child), -1);
@@ -102,7 +77,7 @@ void
ephy_embed_container_set_active_child (EphyEmbedContainer *container,
EphyEmbed *child)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_if_fail (EPHY_IS_EMBED_CONTAINER (container));
g_return_if_fail (EPHY_IS_EMBED (child));
@@ -123,7 +98,7 @@ void
ephy_embed_container_remove_child (EphyEmbedContainer *container,
EphyEmbed *child)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_if_fail (EPHY_IS_EMBED_CONTAINER (container));
g_return_if_fail (EPHY_IS_EMBED (child));
@@ -144,7 +119,7 @@ ephy_embed_container_remove_child (EphyEmbedContainer *container,
EphyEmbed *
ephy_embed_container_get_active_child (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), NULL);
@@ -164,7 +139,7 @@ ephy_embed_container_get_active_child (EphyEmbedContainer *container)
GList *
ephy_embed_container_get_children (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), NULL);
@@ -183,7 +158,7 @@ ephy_embed_container_get_children (EphyEmbedContainer *container)
gboolean
ephy_embed_container_get_is_popup (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface;
+ EphyEmbedContainerInterface *iface;
g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), FALSE);
diff --git a/embed/ephy-embed-container.h b/embed/ephy-embed-container.h
index c2f7aa9..f9595ac 100644
--- a/embed/ephy-embed-container.h
+++ b/embed/ephy-embed-container.h
@@ -34,15 +34,15 @@ G_BEGIN_DECLS
#define EPHY_TYPE_EMBED_CONTAINER (ephy_embed_container_get_type ())
#define EPHY_EMBED_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_CONTAINER,
EphyEmbedContainer))
-#define EPHY_EMBED_CONTAINER_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_CONTAINER,
EphyEmbedContainerIface))
+#define EPHY_EMBED_CONTAINER_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_CONTAINER,
EphyEmbedContainerInterface))
#define EPHY_IS_EMBED_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_CONTAINER))
#define EPHY_IS_EMBED_CONTAINER_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_CONTAINER))
-#define EPHY_EMBED_CONTAINER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst),
EPHY_TYPE_EMBED_CONTAINER, EphyEmbedContainerIface))
+#define EPHY_EMBED_CONTAINER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst),
EPHY_TYPE_EMBED_CONTAINER, EphyEmbedContainerInterface))
typedef struct _EphyEmbedContainer EphyEmbedContainer;
-typedef struct _EphyEmbedContainerIface EphyEmbedContainerIface;
+typedef struct _EphyEmbedContainerInterface EphyEmbedContainerInterface;
-struct _EphyEmbedContainerIface
+struct _EphyEmbedContainerInterface
{
GTypeInterface parent_iface;
diff --git a/src/ephy-window.c b/src/ephy-window.c
index de9ba9f..155a4f7 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -531,7 +531,7 @@ impl_get_is_popup (EphyEmbedContainer *container)
}
static void
-ephy_window_embed_container_iface_init (EphyEmbedContainerIface *iface)
+ephy_window_embed_container_iface_init (EphyEmbedContainerInterface *iface)
{
iface->add_child = impl_add_child;
iface->set_active_child = impl_set_active_child;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]