aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-10-22 03:22:57 +0800
committerXan Lopez <xan@src.gnome.org>2007-10-22 03:22:57 +0800
commit20abb0405c42012e470173fc82dba03d7d4fe268 (patch)
tree1959235017079be5f39479bc09ce8c379e88d5d2
parentfa4959e1e013b0ba0f526397fc835e950abe9888 (diff)
downloadgsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar.gz
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar.bz2
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar.lz
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar.xz
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.tar.zst
gsoc2013-epiphany-20abb0405c42012e470173fc82dba03d7d4fe268.zip
Move load-status from EphyTab to EphyEmbed.
svn path=/trunk/; revision=7547
-rw-r--r--embed/ephy-embed.c35
-rw-r--r--embed/ephy-embed.h10
-rw-r--r--embed/mozilla/mozilla-embed.cpp37
-rw-r--r--src/ephy-notebook.c10
-rw-r--r--src/ephy-session.c2
-rw-r--r--src/ephy-tab.c73
-rw-r--r--src/ephy-window.c22
-rw-r--r--src/epiphany.defs6
8 files changed, 114 insertions, 81 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
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index d679dad9d..2e0a5a8c8 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -528,7 +528,7 @@ ephy_notebook_finalize (GObject *object)
}
static void
-sync_load_status (EphyTab *tab, GParamSpec *pspec, GtkWidget *proxy)
+sync_load_status (EphyEmbed *embed, GParamSpec *pspec, GtkWidget *proxy)
{
GtkWidget *spinner, *icon;
@@ -536,7 +536,7 @@ sync_load_status (EphyTab *tab, GParamSpec *pspec, GtkWidget *proxy)
icon = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "icon"));
g_return_if_fail (spinner != NULL && icon != NULL);
- if (ephy_tab_get_load_status (tab))
+ if (ephy_embed_get_load_status (embed))
{
gtk_widget_hide (icon);
gtk_widget_show (spinner);
@@ -682,13 +682,13 @@ build_tab_label (EphyNotebook *nb, EphyTab *tab)
/* Hook the label up to the tab properties */
sync_icon (tab, NULL, GTK_IMAGE (icon));
sync_label (tab, NULL, label);
- sync_load_status (tab, NULL, hbox);
+ sync_load_status (ephy_tab_get_embed (tab), NULL, hbox);
g_signal_connect_object (tab, "notify::icon",
G_CALLBACK (sync_icon), icon, 0);
g_signal_connect_object (tab, "notify::title",
G_CALLBACK (sync_label), label, 0);
- g_signal_connect_object (tab, "notify::load-status",
+ g_signal_connect_object (ephy_tab_get_embed (tab), "notify::load-status",
G_CALLBACK (sync_load_status), hbox, 0);
return hbox;
@@ -839,7 +839,7 @@ ephy_notebook_remove (GtkContainer *container,
g_signal_handlers_disconnect_by_func
(tab_widget, G_CALLBACK (sync_label), tab_label_label);
g_signal_handlers_disconnect_by_func
- (tab_widget, G_CALLBACK (sync_load_status), tab_label);
+ (ephy_tab_get_embed (EPHY_TAB (tab_widget)), G_CALLBACK (sync_load_status), tab_label);
GTK_CONTAINER_CLASS (parent_class)->remove (container, tab_widget);
diff --git a/src/ephy-session.c b/src/ephy-session.c
index a167e73cb..2e0ab766b 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -1078,7 +1078,7 @@ write_tab (xmlTextWriterPtr writer,
(const xmlChar *) title);
if (ret < 0) return ret;
- if (ephy_tab_get_load_status (tab))
+ if (ephy_embed_get_load_status (ephy_tab_get_embed (tab)))
{
ret = xmlTextWriterWriteAttribute (writer,
(const xmlChar *) "loading",
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index c8f718188..73c1e1c2f 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -100,7 +100,6 @@ struct _EphyTabPrivate
/* Flags */
guint is_blank : 1;
- guint is_loading : 1;
EphyTabAddressExpire address_expire;
/* guint address_expire : 2; ? */
@@ -121,7 +120,6 @@ enum
PROP_ADDRESS,
PROP_ICON,
PROP_ICON_ADDRESS,
- PROP_LOAD_STATUS,
PROP_MESSAGE,
PROP_NAVIGATION,
PROP_HIDDEN_POPUP_COUNT,
@@ -148,8 +146,6 @@ static GArray *tabs_id_array = NULL;
static guint n_tabs = 0;
/* internal functions, accessible only from this file */
-static void ephy_tab_set_load_status (EphyTab *tab,
- gboolean status);
static void ephy_tab_set_link_message (EphyTab *tab,
char *message);
static void ephy_tab_update_navigation_flags(EphyTab *tab,
@@ -227,7 +223,6 @@ ephy_tab_set_property (GObject *object,
break;
case PROP_ADDRESS:
case PROP_ICON:
- case PROP_LOAD_STATUS:
case PROP_MESSAGE:
case PROP_NAVIGATION:
case PROP_HIDDEN_POPUP_COUNT:
@@ -257,9 +252,6 @@ ephy_tab_get_property (GObject *object,
case PROP_ICON_ADDRESS:
g_value_set_string (value, priv->icon_address);
break;
- case PROP_LOAD_STATUS:
- g_value_set_boolean (value, priv->is_loading);
- break;
case PROP_MESSAGE:
g_value_set_string (value, ephy_tab_get_status_message (tab));
break;
@@ -396,14 +388,6 @@ ephy_tab_class_init (EphyTabClass *class)
(G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)));
g_object_class_install_property (object_class,
- PROP_LOAD_STATUS,
- g_param_spec_boolean ("load-status",
- "Load status",
- "The tab's load status",
- FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property (object_class,
PROP_MESSAGE,
g_param_spec_string ("message",
"Message",
@@ -889,6 +873,7 @@ ephy_tab_set_address (EphyTab *tab,
{
EphyTabPrivate *priv = tab->priv;
GObject *object = G_OBJECT (tab);
+ gboolean is_loading;
g_free (priv->address);
priv->address = address;
@@ -896,7 +881,9 @@ ephy_tab_set_address (EphyTab *tab,
priv->is_blank = address == NULL ||
strcmp (address, "about:blank") == 0;
- if (priv->is_loading &&
+ is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab));
+
+ if (is_loading &&
priv->address_expire == EPHY_TAB_ADDRESS_EXPIRE_NOW &&
priv->typed_address != NULL)
{
@@ -926,36 +913,6 @@ ephy_tab_new (void)
}
static void
-ephy_tab_set_load_status (EphyTab *tab, gboolean status)
-{
- g_return_if_fail (EPHY_IS_TAB (tab));
-
- status = status != FALSE;
-
- tab->priv->is_loading = status;
-
- g_object_notify (G_OBJECT (tab), "load-status");
-}
-
-/**
- * ephy_tab_get_load_status:
- * @tab: an #EphyTab
- *
- * Returns whether the web page in @tab 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_tab_get_load_status (EphyTab *tab)
-{
- g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE);
-
- return tab->priv->is_loading;
-}
-
-static void
ephy_tab_set_link_message (EphyTab *tab, char *message)
{
char *status_message;
@@ -1237,6 +1194,7 @@ ephy_file_monitor_reload_cb (EphyTab *tab)
{
EphyTabPrivate *priv = tab->priv;
EphyEmbed *embed;
+ gboolean is_loading;
if (priv->reload_delay_ticks > 0)
{
@@ -1246,7 +1204,9 @@ ephy_file_monitor_reload_cb (EphyTab *tab)
return TRUE;
}
- if (priv->is_loading)
+ is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab));
+
+ if (is_loading)
{
/* Wait a bit to reload if we're still loading! */
priv->reload_delay_ticks = RELOAD_DELAY_MAX_TICKS / 2;
@@ -1661,8 +1621,8 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
priv->total_requests = 0;
priv->cur_requests = 0;
- ephy_embed_set_load_percent (ephy_tab_get_embed (tab), 0);
- ephy_tab_set_load_status (tab, TRUE);
+ ephy_embed_set_load_percent (embed, 0);
+ ephy_embed_set_load_status (embed, TRUE);
ephy_tab_update_navigation_flags (tab, embed);
ensure_page_info (tab, embed, uri);
@@ -1678,7 +1638,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
g_object_freeze_notify (object);
ephy_embed_set_load_percent (ephy_tab_get_embed (tab), 100);
- ephy_tab_set_load_status (tab, FALSE);
+ ephy_embed_set_load_status (embed, FALSE);
ephy_tab_update_navigation_flags (tab, embed);
g_free (priv->loading_title);
@@ -1935,7 +1895,6 @@ ephy_tab_init (EphyTab *tab)
tab->priv->cur_requests = 0;
tab->priv->width = -1;
tab->priv->height = -1;
- tab->priv->is_loading = FALSE;
priv->title = NULL;
priv->is_blank = TRUE;
priv->icon_address = NULL;
@@ -2120,16 +2079,19 @@ ephy_tab_get_title_composite (EphyTab *tab)
{
EphyTabPrivate *priv;
const char *title = "";
+ gboolean is_loading;
g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
priv = tab->priv;
+ is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab));
+
if (priv->is_blank)
{
title = _("Blank page");
}
- else if (priv->is_loading &&
+ else if (is_loading &&
priv->loading_title != NULL)
{
title = priv->loading_title;
@@ -2233,12 +2195,15 @@ ephy_tab_set_typed_address (EphyTab *tab,
EphyTabAddressExpire expire)
{
EphyTabPrivate *priv = tab->priv;
+ gboolean is_loading;
g_free (priv->typed_address);
priv->typed_address = g_strdup (address);
+ is_loading = ephy_embed_get_load_status (ephy_tab_get_embed (tab));
+
if (expire == EPHY_TAB_ADDRESS_EXPIRE_CURRENT &&
- !priv->is_loading)
+ !is_loading)
{
priv->address_expire = EPHY_TAB_ADDRESS_EXPIRE_NOW;
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0ee4a68f4..e7c13c8b7 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -97,7 +97,7 @@ static void ephy_window_view_toolbar_cb (GtkAction *action,
EphyWindow *window);
static void ephy_window_view_popup_windows_cb (GtkAction *action,
EphyWindow *window);
-static void sync_tab_load_status (EphyTab *tab,
+static void sync_tab_load_status (EphyEmbed *embed,
GParamSpec *pspec,
EphyWindow *window);
static void sync_tab_security (EphyEmbed *embed,
@@ -706,7 +706,7 @@ ephy_window_fullscreen (EphyWindow *window)
/* sync status */
tab = ephy_window_get_active_tab (window);
- sync_tab_load_status (tab, NULL, window);
+ sync_tab_load_status (ephy_tab_get_embed (tab), NULL, window);
sync_tab_security (ephy_tab_get_embed (tab), NULL, window);
egg_editable_toolbar_set_model
@@ -1672,7 +1672,7 @@ sync_tab_popups_allowed (EphyTab *tab,
}
static void
-sync_tab_load_status (EphyTab *tab,
+sync_tab_load_status (EphyEmbed *embed,
GParamSpec *pspec,
EphyWindow *window)
{
@@ -1683,7 +1683,7 @@ sync_tab_load_status (EphyTab *tab,
if (window->priv->closing) return;
- loading = ephy_tab_get_load_status (tab);
+ loading = ephy_embed_get_load_status (embed);
action = gtk_action_group_get_action (action_group, "ViewStop");
gtk_action_set_sensitive (action, loading);
@@ -2152,9 +2152,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
G_CALLBACK (sync_tab_icon),
window);
g_signal_handlers_disconnect_by_func (old_tab,
- G_CALLBACK (sync_tab_load_status),
- window);
- g_signal_handlers_disconnect_by_func (old_tab,
G_CALLBACK (sync_tab_message),
window);
g_signal_handlers_disconnect_by_func (old_tab,
@@ -2184,6 +2181,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_handlers_disconnect_by_func (embed,
G_CALLBACK (sync_tab_load_progress),
window);
+ g_signal_handlers_disconnect_by_func (embed,
+ G_CALLBACK (sync_tab_load_status),
+ window);
g_signal_handlers_disconnect_by_func
(embed, G_CALLBACK (tab_context_menu_cb), window);
@@ -2202,10 +2202,10 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
sync_tab_document_type (embed, NULL, window);
sync_tab_zoom (embed, NULL, window);
sync_tab_load_progress (embed, NULL, window);
+ sync_tab_load_status (embed, NULL, window);
sync_tab_address (new_tab, NULL, window);
sync_tab_icon (new_tab, NULL, window);
- sync_tab_load_status (new_tab, NULL, window);
sync_tab_message (new_tab, NULL, window);
sync_tab_navigation (new_tab, NULL, window);
sync_tab_popup_windows (new_tab, NULL, window);
@@ -2218,9 +2218,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (new_tab, "notify::icon",
G_CALLBACK (sync_tab_icon),
window, 0);
- g_signal_connect_object (new_tab, "notify::load-status",
- G_CALLBACK (sync_tab_load_status),
- window, 0);
g_signal_connect_object (new_tab, "notify::message",
G_CALLBACK (sync_tab_message),
window, 0);
@@ -2246,6 +2243,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
g_signal_connect_object (embed, "notify::zoom",
G_CALLBACK (sync_tab_zoom),
window, 0);
+ g_signal_connect_object (embed, "notify::load-status",
+ G_CALLBACK (sync_tab_load_status),
+ window, 0);
g_signal_connect_object (embed, "ge-context-menu",
G_CALLBACK (tab_context_menu_cb),
window, G_CONNECT_AFTER);
diff --git a/src/epiphany.defs b/src/epiphany.defs
index ee0c10c5b..394ef4dd0 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -3344,12 +3344,6 @@
)
)
-(define-method get_load_status
- (of-object "EphyTab")
- (c-name "ephy_tab_get_load_status")
- (return-type "gboolean")
-)
-
(define-method get_link_message
(of-object "EphyTab")
(c-name "ephy_tab_get_link_message")