aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c35
-rw-r--r--embed/ephy-embed.h10
-rw-r--r--embed/mozilla/mozilla-embed.cpp37
3 files changed, 78 insertions, 4 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 2b3c99383..03b1500c7 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -446,7 +446,6 @@ ephy_embed_base_init (gpointer g_class)
ZOOM_MAXIMAL,
1.0,
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
g_object_interface_install_property (g_class,
g_param_spec_int ("load-progress",
"Load progress",
@@ -455,6 +454,14 @@ ephy_embed_base_init (gpointer g_class)
100,
0,
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_interface_install_property (g_class,
+ g_param_spec_boolean ("load-status",
+ "Load status",
+ "The embed's load status",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+
initialized = TRUE;
}
@@ -1093,3 +1100,29 @@ ephy_embed_set_load_percent (EphyEmbed *embed, int percent)
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
return iface->set_load_percent (embed, percent);
}
+
+/**
+ * ephy_embed_get_load_status:
+ * @embed: an #EphyEmbed
+ *
+ * Returns whether the web page in @embed has finished loading. A web page is
+ * only finished loading after all images, styles, and other dependencies have
+ * been downloaded and rendered.
+ *
+ * Return value: %TRUE if the page is still loading, %FALSE if complete
+ **/
+gboolean
+ephy_embed_get_load_status (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->get_load_status (embed);
+}
+
+void
+ephy_embed_set_load_status (EphyEmbed *embed, gboolean status)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ return iface->set_load_status (embed, status);
+}
+
+
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index da8e8557e..394e778f6 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -231,6 +231,8 @@ struct _EphyEmbedIface
EphyEmbedDocumentType (* get_document_type) (EphyEmbed *embed);
int (* get_load_percent) (EphyEmbed *embed);
void (* set_load_percent) (EphyEmbed *embed, int percent);
+ gboolean (* get_load_status) (EphyEmbed *embed);
+ void (* set_load_status) (EphyEmbed *embed, gboolean percent);
};
GType ephy_embed_net_state_get_type (void);
@@ -324,13 +326,15 @@ void ephy_embed_scroll_pixels (EphyEmbed *embed,
int dx,
int dy);
/* Document type */
-
EphyEmbedDocumentType ephy_embed_get_document_type (EphyEmbed *embed);
/* Progress */
-
int ephy_embed_get_load_percent (EphyEmbed *embed);
-void ephy_embed_set_load_percent (EphyEmbed *embed, int percent);
+void ephy_embed_set_load_percent (EphyEmbed *embed, int percent); /* FIXME: remove me */
+
+/* Load status */
+gboolean ephy_embed_get_load_status (EphyEmbed *embed);
+void ephy_embed_set_load_status (EphyEmbed *embed, gboolean status); /* FIXME: remove me */
/* Encoding */
char *ephy_embed_get_encoding (EphyEmbed *embed);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index f6b32ddf6..3693f4e95 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -105,7 +105,11 @@ struct MozillaEmbedPrivate
/* guint security_level : 3; ? */
EphyEmbedDocumentType document_type;
float zoom;
+
+ /* Flags */
+ guint is_loading : 1;
guint is_setting_zoom : 1;
+
gint8 load_percent;
};
@@ -116,6 +120,7 @@ enum
PROP_0,
PROP_DOCUMENT_TYPE,
PROP_LOAD_PROGRESS,
+ PROP_LOAD_STATUS,
PROP_SECURITY,
PROP_ZOOM
};
@@ -233,6 +238,9 @@ mozilla_embed_get_property (GObject *object,
case PROP_LOAD_PROGRESS:
g_value_set_int (value, priv->load_percent);
break;
+ case PROP_LOAD_STATUS:
+ g_value_set_boolean (value, priv->is_loading);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -250,6 +258,7 @@ mozilla_embed_set_property (GObject *object,
{
case PROP_DOCUMENT_TYPE:
case PROP_LOAD_PROGRESS:
+ case PROP_LOAD_STATUS:
case PROP_SECURITY:
case PROP_ZOOM:
/* read only */
@@ -283,6 +292,7 @@ mozilla_embed_class_init (MozillaEmbedClass *klass)
g_object_class_override_property (object_class, PROP_SECURITY, "security-level");
g_object_class_override_property (object_class, PROP_ZOOM, "zoom");
g_object_class_override_property (object_class, PROP_LOAD_PROGRESS, "load-progress");
+ g_object_class_override_property (object_class, PROP_LOAD_STATUS, "load-status");
g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate));
}
@@ -326,6 +336,7 @@ mozilla_embed_init (MozillaEmbed *embed)
embed->priv->zoom = 1.0;
embed->priv->is_setting_zoom = FALSE;
embed->priv->load_percent = 0;
+ embed->priv->is_loading = FALSE;
}
gpointer
@@ -925,6 +936,30 @@ impl_set_load_percent (EphyEmbed *embed, int percent)
}
}
+static gboolean
+impl_get_load_status (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
+
+ return mpriv->is_loading;
+}
+
+static void
+impl_set_load_status (EphyEmbed *embed, gboolean status)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED (embed)->priv;
+ guint is_loading;
+
+ is_loading = status != FALSE;
+
+ if (is_loading != mpriv->is_loading)
+ {
+ mpriv->is_loading = is_loading;
+
+ g_object_notify (G_OBJECT (embed), "load-status");
+ }
+}
+
static void
mozilla_embed_location_changed_cb (GtkMozEmbed *embed,
MozillaEmbed *membed)
@@ -1384,6 +1419,8 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->get_document_type = impl_get_document_type;
iface->get_load_percent = impl_get_load_percent;
iface->set_load_percent = impl_set_load_percent;
+ iface->get_load_status = impl_get_load_status;
+ iface->set_load_status = impl_set_load_status;
}
static void