aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-11-18 01:11:40 +0800
committerXan Lopez <xan@src.gnome.org>2007-11-18 01:11:40 +0800
commitadfea7bd0eb8a34d64d98cc215a0c97bf9465633 (patch)
treea4916c4fb420e63eff300c23091de42bf4cf1535 /embed
parent44b538bb4dfcdd9d8989b8777c699f08dd034061 (diff)
downloadgsoc2013-epiphany-adfea7bd0eb8a34d64d98cc215a0c97bf9465633.tar.gz
gsoc2013-epiphany-adfea7bd0eb8a34d64d98cc215a0c97bf9465633.tar.zst
gsoc2013-epiphany-adfea7bd0eb8a34d64d98cc215a0c97bf9465633.zip
Put visibility property into EphyBaseEmbed, we need it for popups.
svn path=/trunk/; revision=7712
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-base-embed.c33
-rw-r--r--embed/ephy-base-embed.h2
-rw-r--r--embed/ephy-embed.c16
-rw-r--r--embed/ephy-embed.h2
-rw-r--r--embed/mozilla/mozilla-embed.cpp16
5 files changed, 68 insertions, 1 deletions
diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c
index 650843a6c..9230cd066 100644
--- a/embed/ephy-base-embed.c
+++ b/embed/ephy-base-embed.c
@@ -61,6 +61,7 @@ struct _EphyBaseEmbedPrivate {
guint is_blank : 1;
guint is_loading : 1;
guint is_setting_zoom : 1;
+ guint visibility : 1;
gint8 load_percent;
char *address;
@@ -104,6 +105,7 @@ enum {
PROP_SECURITY,
PROP_STATUS_MESSAGE,
PROP_TITLE,
+ PROP_VISIBLE,
PROP_TYPED_ADDRESS,
PROP_ZOOM
};
@@ -271,6 +273,12 @@ impl_get_link_message (EphyEmbed *embed)
return EPHY_BASE_EMBED (embed)->priv->link_message;
}
+static gboolean
+impl_get_visibility (EphyEmbed *embed)
+{
+ return EPHY_BASE_EMBED (embed)->priv->visibility;
+}
+
static void
popups_manager_free_info (PopupInfo *popup)
{
@@ -470,6 +478,7 @@ ephy_base_embed_set_property (GObject *object,
case PROP_NAVIGATION:
case PROP_SECURITY:
case PROP_STATUS_MESSAGE:
+ case PROP_VISIBLE:
case PROP_ZOOM:
/* read only */
break;
@@ -571,6 +580,9 @@ ephy_base_embed_get_property (GObject *object,
case PROP_TYPED_ADDRESS:
g_value_set_string (value, priv->typed_address);
break;
+ case PROP_VISIBLE:
+ g_value_set_boolean (value, priv->visibility);
+ break;
case PROP_ZOOM:
g_value_set_float (value, priv->zoom);
break;
@@ -711,6 +723,14 @@ ephy_base_embed_class_init (EphyBaseEmbedClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (gobject_class,
+ PROP_VISIBLE,
+ g_param_spec_boolean ("visibility",
+ "Visibility",
+ "The embed's visibility",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
g_type_class_add_private (gobject_class, sizeof (EphyBaseEmbedPrivate));
}
@@ -950,6 +970,7 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->get_navigation_flags = impl_get_navigation_flags;
iface->get_link_message = impl_get_link_message;
iface->get_status_message = impl_get_status_message;
+ iface->get_visibility = impl_get_visibility;
}
void
@@ -1550,3 +1571,15 @@ ephy_base_embed_restore_zoom_level (EphyBaseEmbed *membed,
}
}
+void
+ephy_base_embed_set_visibility (EphyBaseEmbed *embed,
+ gboolean visibility)
+{
+ EphyBaseEmbedPrivate *priv = embed->priv;
+
+ if (priv->visibility != visibility) {
+ priv->visibility = visibility;
+
+ g_object_notify (G_OBJECT (embed), "visibility");
+ }
+}
diff --git a/embed/ephy-base-embed.h b/embed/ephy-base-embed.h
index 979044633..9120916dd 100644
--- a/embed/ephy-base-embed.h
+++ b/embed/ephy-base-embed.h
@@ -76,6 +76,8 @@ void ephy_base_embed_update_from_net_state (EphyBaseEmbed *embed,
EphyEmbedNetState state);
void ephy_base_embed_set_load_percent (EphyBaseEmbed *embed, int percent);
void ephy_base_embed_popups_manager_reset (EphyBaseEmbed *embed);
+void ephy_base_embed_set_visibility (EphyBaseEmbed *embed,
+ gboolean visibility);
G_END_DECLS
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index af8329b4b..042e323e0 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -1130,3 +1130,19 @@ ephy_embed_get_loading_title (EphyEmbed *embed)
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
return iface->get_loading_title (embed);
}
+
+/**
+ * ephy_embed_get_visibility:
+ * @embed: an #EphyEmbed
+ *
+ * Returns whether the @embed's toplevel is visible or not. Used
+ * mostly for popup visibility management.
+ *
+ * Return value; %TRUE if @embed's "visibility" property is set
+ **/
+gboolean
+ephy_embed_get_visibility (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_visibility (embed);
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index d60c73327..cb6f9e38f 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -233,6 +233,7 @@ struct _EphyEmbedIface
const char * (* get_icon_address) (EphyEmbed *embed);
gboolean (* get_is_blank) (EphyEmbed *embed);
const char * (* get_loading_title) (EphyEmbed *embed);
+ gboolean * (* get_visibility) (EphyEmbed *embed);
};
GType ephy_embed_net_state_get_type (void);
@@ -358,6 +359,7 @@ gboolean ephy_embed_get_is_blank (EphyEmbed *embed);
const char * ephy_embed_get_loading_title (EphyEmbed *embed);
+gboolean ephy_embed_get_visibility (EphyEmbed *embed);
/* Encoding */
char *ephy_embed_get_encoding (EphyEmbed *embed);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index cca08a749..a554cb16a 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright © 2000-2004 Marco Pesenti Gritti
* Copyright © 2003, 2004 Christian Persch
@@ -16,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $Id$
*/
#include "mozilla-config.h"
@@ -82,6 +82,9 @@ static void mozilla_embed_title_change_cb (GtkMozEmbed *embed,
MozillaEmbed *membed);
static void mozilla_embed_link_message_cb (GtkMozEmbed *embed,
MozillaEmbed *membed);
+static void mozilla_embed_visibility_cb (GtkMozEmbed *embed,
+ gboolean visibility,
+ MozillaEmbed *membed);
static gboolean mozilla_embed_open_uri_cb (GtkMozEmbed *embed,
const char *uri,
MozillaEmbed *membed);
@@ -280,6 +283,9 @@ mozilla_embed_init (MozillaEmbed *membed)
g_signal_connect_object (embed, "open_uri",
G_CALLBACK (mozilla_embed_open_uri_cb),
membed,(GConnectFlags) 0);
+ g_signal_connect_object (embed, "visibility",
+ G_CALLBACK (mozilla_embed_visibility_cb),
+ membed, (GConnectFlags) 0);
}
gpointer
@@ -1169,6 +1175,14 @@ mozilla_embed_open_uri_cb (GtkMozEmbed *embed,
return FALSE;
}
+static void
+mozilla_embed_visibility_cb (GtkMozEmbed *embed,
+ gboolean visibility,
+ MozillaEmbed *membed)
+{
+ ephy_base_embed_set_visibility (EPHY_BASE_EMBED (membed), visibility);
+}
+
static EphyEmbedSecurityLevel
mozilla_embed_security_level (PRUint32 state)
{