diff options
author | Xan Lopez <xan@src.gnome.org> | 2007-10-22 03:22:57 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2007-10-22 03:22:57 +0800 |
commit | 20abb0405c42012e470173fc82dba03d7d4fe268 (patch) | |
tree | 1959235017079be5f39479bc09ce8c379e88d5d2 /src | |
parent | fa4959e1e013b0ba0f526397fc835e950abe9888 (diff) | |
download | gsoc2013-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
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-notebook.c | 10 | ||||
-rw-r--r-- | src/ephy-session.c | 2 | ||||
-rw-r--r-- | src/ephy-tab.c | 73 | ||||
-rw-r--r-- | src/ephy-window.c | 22 | ||||
-rw-r--r-- | src/epiphany.defs | 6 |
5 files changed, 36 insertions, 77 deletions
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") |