diff options
author | Xan Lopez <xan@src.gnome.org> | 2007-10-22 02:09:23 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2007-10-22 02:09:23 +0800 |
commit | 568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e (patch) | |
tree | 7841ea91598f3ed5b786dded227380096bb5ebce /embed | |
parent | 1a1e303ced1a791dc691aeebb460a98ca3a1800d (diff) | |
download | gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar.gz gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar.bz2 gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar.lz gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar.xz gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.tar.zst gsoc2013-epiphany-568af9a8d3dfa62be38bce6204d0d13bf4fa9e1e.zip |
Move load-progress from EphyTab to EphyEmbed
svn path=/trunk/; revision=7544
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed.c | 38 | ||||
-rw-r--r-- | embed/ephy-embed.h | 8 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 31 |
3 files changed, 76 insertions, 1 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 97e46d6a3..2b3c99383 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -447,6 +447,15 @@ ephy_embed_base_init (gpointer g_class) 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", + "The embed's load progress in percent", + 0, + 100, + 0, + G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + initialized = TRUE; } @@ -1055,3 +1064,32 @@ ephy_embed_get_document_type (EphyEmbed *embed) EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); return iface->get_document_type (embed); } + +/** + * ephy_embed_get_load_percent: + * @embed: an #EphyEmbed + * + * Returns the page load percentage (displayed in the progressbar). + * + * Return value: a percentage from 0 to 100. + **/ +int +ephy_embed_get_load_percent (EphyEmbed *embed) +{ + EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); + return iface->get_load_percent (embed); +} + +/** + * ephy_embed_set_load_percent: + * @embed: an #EphyEmbed + * @percent: a percentage, from 0 to 100. + * + * Sets the load percentage. + **/ +void +ephy_embed_set_load_percent (EphyEmbed *embed, int percent) +{ + EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed); + return iface->set_load_percent (embed, percent); +} diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 599174c51..da8e8557e 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -229,7 +229,8 @@ struct _EphyEmbedIface gboolean (* has_modified_forms) (EphyEmbed *embed); void (* close) (EphyEmbed *embed); EphyEmbedDocumentType (* get_document_type) (EphyEmbed *embed); - + int (* get_load_percent) (EphyEmbed *embed); + void (* set_load_percent) (EphyEmbed *embed, int percent); }; GType ephy_embed_net_state_get_type (void); @@ -326,6 +327,11 @@ void ephy_embed_scroll_pixels (EphyEmbed *embed, 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); + /* Encoding */ char *ephy_embed_get_encoding (EphyEmbed *embed); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 538641804..57ce9467d 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -106,6 +106,7 @@ struct MozillaEmbedPrivate EphyEmbedDocumentType document_type; float zoom; guint is_setting_zoom : 1; + gint8 load_percent; }; #define WINDOWWATCHER_CONTRACTID "@mozilla.org/embedcomp/window-watcher;1" @@ -114,6 +115,7 @@ enum { PROP_0, PROP_DOCUMENT_TYPE, + PROP_LOAD_PROGRESS, PROP_SECURITY, PROP_ZOOM }; @@ -228,6 +230,9 @@ mozilla_embed_get_property (GObject *object, case PROP_ZOOM: g_value_set_float (value, priv->zoom); break; + case PROP_LOAD_PROGRESS: + g_value_set_int (value, priv->load_percent); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -244,6 +249,7 @@ mozilla_embed_set_property (GObject *object, switch (prop_id) { case PROP_DOCUMENT_TYPE: + case PROP_LOAD_PROGRESS: case PROP_SECURITY: case PROP_ZOOM: /* read only */ @@ -276,6 +282,7 @@ mozilla_embed_class_init (MozillaEmbedClass *klass) g_object_class_override_property (object_class, PROP_DOCUMENT_TYPE, "document-type"); 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_ZOOM, "load-progress"); g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate)); } @@ -318,6 +325,7 @@ mozilla_embed_init (MozillaEmbed *embed) embed->priv->security_level = EPHY_EMBED_STATE_IS_UNKNOWN; embed->priv->zoom = 1.0; embed->priv->is_setting_zoom = FALSE; + embed->priv->load_percent = 0; } gpointer @@ -896,6 +904,27 @@ impl_get_document_type (EphyEmbed *embed) return mpriv->document_type; } +static int +impl_get_load_percent (EphyEmbed *embed) +{ + MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; + + return mpriv->load_percent; +} + +static void +impl_set_load_percent (EphyEmbed *embed, int percent) +{ + MozillaEmbedPrivate *mpriv = MOZILLA_EMBED (embed)->priv; + + if (percent != mpriv->load_percent) + { + mpriv->load_percent = percent; + + g_object_notify (G_OBJECT (embed), "load-progress"); + } +} + static void mozilla_embed_location_changed_cb (GtkMozEmbed *embed, MozillaEmbed *membed) @@ -1353,6 +1382,8 @@ ephy_embed_iface_init (EphyEmbedIface *iface) iface->print_preview_navigate = impl_print_preview_navigate; iface->has_modified_forms = impl_has_modified_forms; iface->get_document_type = impl_get_document_type; + iface->get_load_percent = impl_get_load_percent; + iface->set_load_percent = impl_set_load_percent; } static void |