aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-11-17 03:14:38 +0800
committerXan Lopez <xan@src.gnome.org>2007-11-17 03:14:38 +0800
commit7eadb5acd98f20acabb002f7975804dc5c5c8200 (patch)
treed080b22d3b60f324b71f61eab9106cab1beb8138
parentbb91baf251c755a40fc3a167741797680fba5efb (diff)
downloadgsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar.gz
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar.bz2
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar.lz
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar.xz
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.tar.zst
gsoc2013-epiphany-7eadb5acd98f20acabb002f7975804dc5c5c8200.zip
Add type checkings in the EmbedContainer interface, not in the implementations.
svn path=/trunk/; revision=7706
-rw-r--r--embed/ephy-embed-container.c47
-rw-r--r--src/ephy-window.c25
2 files changed, 42 insertions, 30 deletions
diff --git a/embed/ephy-embed-container.c b/embed/ephy-embed-container.c
index 083730185..704e61b51 100644
--- a/embed/ephy-embed-container.c
+++ b/embed/ephy-embed-container.c
@@ -87,7 +87,12 @@ ephy_embed_container_add_child (EphyEmbedContainer *container,
gint position,
gboolean jump_to)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), -1);
+ g_return_val_if_fail (EPHY_IS_EMBED (child), -1);
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
return iface->add_child (container, child, position, jump_to);
}
@@ -102,7 +107,13 @@ void
ephy_embed_container_set_active_child (EphyEmbedContainer *container,
EphyEmbed *child)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_if_fail (EPHY_IS_EMBED_CONTAINER (container));
+ g_return_if_fail (EPHY_IS_EMBED (child));
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+
iface->set_active_child (container, child);
}
@@ -117,7 +128,13 @@ void
ephy_embed_container_remove_child (EphyEmbedContainer *container,
EphyEmbed *child)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_if_fail (EPHY_IS_EMBED_CONTAINER (container));
+ g_return_if_fail (EPHY_IS_EMBED (child));
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+
iface->remove_child (container, child);
}
@@ -132,7 +149,11 @@ ephy_embed_container_remove_child (EphyEmbedContainer *container,
EphyEmbed *
ephy_embed_container_get_active_child (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), NULL);
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
return iface->get_active_child (container);
}
@@ -147,7 +168,11 @@ ephy_embed_container_get_active_child (EphyEmbedContainer *container)
GList *
ephy_embed_container_get_children (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), NULL);
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
return iface->get_children (container);
}
@@ -162,7 +187,11 @@ ephy_embed_container_get_children (EphyEmbedContainer *container)
gboolean
ephy_embed_container_get_is_popup (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), FALSE);
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
return iface->get_is_popup (container);
}
@@ -178,7 +207,11 @@ ephy_embed_container_get_is_popup (EphyEmbedContainer *container)
EphyEmbedChrome
ephy_embed_container_get_chrome (EphyEmbedContainer *container)
{
- EphyEmbedContainerIface *iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
+ EphyEmbedContainerIface *iface;
+
+ g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), 0);
+
+ iface = EPHY_EMBED_CONTAINER_GET_IFACE (container);
return iface->get_chrome (container);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 07a16d32a..953539d17 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -485,12 +485,7 @@ ephy_window_add_child (EphyEmbedContainer *container,
gint position,
gboolean jump_to)
{
- EphyWindow *window;
-
- g_return_val_if_fail (EPHY_IS_WINDOW (container), -1);
- g_return_val_if_fail (EPHY_IS_EMBED (child), -1);
-
- window = EPHY_WINDOW (container);
+ EphyWindow *window = EPHY_WINDOW (container);
g_return_val_if_fail (!window->priv->is_popup ||
gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1);
@@ -506,9 +501,6 @@ ephy_window_set_active_child (EphyEmbedContainer *container,
int page;
EphyWindow *window;
- g_return_if_fail (EPHY_IS_WINDOW (container));
- g_return_if_fail (EPHY_IS_EMBED (child));
-
window = EPHY_WINDOW (container);
page = gtk_notebook_page_num
@@ -571,9 +563,6 @@ ephy_window_remove_child (EphyEmbedContainer *container,
gboolean modified;
int position;
- g_return_if_fail (EPHY_IS_WINDOW (container));
- g_return_if_fail (EPHY_IS_EMBED (child));
-
window = EPHY_WINDOW (container);
priv = window->priv;
@@ -593,19 +582,13 @@ ephy_window_remove_child (EphyEmbedContainer *container,
static EphyEmbed *
ephy_window_get_active_child (EphyEmbedContainer *container)
{
- g_return_val_if_fail (EPHY_IS_WINDOW (container), NULL);
-
return EPHY_WINDOW (container)->priv->active_embed;
}
static GList *
ephy_window_get_children (EphyEmbedContainer *container)
{
- EphyWindow *window;
-
- g_return_val_if_fail (EPHY_IS_WINDOW (container), NULL);
-
- window = EPHY_WINDOW (container);
+ EphyWindow *window = EPHY_WINDOW (container);
return gtk_container_get_children (GTK_CONTAINER (window->priv->notebook));
}
@@ -613,16 +596,12 @@ ephy_window_get_children (EphyEmbedContainer *container)
static gboolean
ephy_window_get_is_popup (EphyEmbedContainer *container)
{
- g_return_val_if_fail (EPHY_IS_WINDOW (container), FALSE);
-
return EPHY_WINDOW (container)->priv->is_popup;
}
static EphyEmbedChrome
ephy_window_get_chrome (EphyEmbedContainer *container)
{
- g_return_val_if_fail (EPHY_IS_WINDOW (container), FALSE);
-
return EPHY_WINDOW (container)->priv->chrome;
}