diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-11-19 02:37:56 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-11-19 02:37:56 +0800 |
commit | bf134e6d44015a8cda42fb238db842a578848ae6 (patch) | |
tree | 403a871fcbcec5d247c840535b3105755f315dc5 /src | |
parent | 53c82c3d0c65ea734cc21e1e0ed5b4ccbde033a5 (diff) | |
download | gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar.gz gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar.bz2 gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar.lz gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar.xz gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.tar.zst gsoc2013-epiphany-bf134e6d44015a8cda42fb238db842a578848ae6.zip |
Delay reloads when we get many change notifications in a short time. Fixes
2005-11-18 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-tab.c:
Delay reloads when we get many change notifications in a short time.
Fixes bug #319993.
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-tab.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 4d7faeff4..e6cf46806 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -106,7 +106,8 @@ struct _EphyTabPrivate /* File watch */ GnomeVFSMonitorHandle *monitor; - guint reload_scheduled_id; + guint reload_scheduled_id; + guint reload_delay_ticks; }; static void ephy_tab_class_init (EphyTabClass *klass); @@ -356,17 +357,6 @@ ephy_tab_grab_focus (GtkWidget *widget) gtk_widget_grab_focus (GTK_WIDGET (ephy_tab_get_embed (tab))); } -static EphyWindow * -ephy_tab_get_window (EphyTab *tab) -{ - GtkWidget *toplevel; - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tab)); - g_return_val_if_fail (toplevel != NULL, NULL); - - return EPHY_WINDOW (toplevel); -} - static void ephy_tab_class_init (EphyTabClass *class) { @@ -1265,6 +1255,8 @@ ephy_tab_file_monitor_cancel (EphyTab *tab) g_source_remove (priv->reload_scheduled_id); priv->reload_scheduled_id = 0; } + + priv->reload_delay_ticks = 0; } static gboolean @@ -1273,7 +1265,24 @@ ephy_file_monitor_reload_cb (EphyTab *tab) EphyTabPrivate *priv = tab->priv; EphyEmbed *embed; - LOG ("Reloading file '%s'\n", priv->address); + if (priv->reload_delay_ticks > 0) + { + priv->reload_delay_ticks--; + + /* Run again */ + return TRUE; + } + + if (priv->is_loading) + { + /* Wait a bit to reload if we're still loading! */ + priv->reload_delay_ticks = RELOAD_DELAY_MAX_TICKS / 2; + + /* Run again */ + return TRUE; + } + + LOG ("Reloading file '%s'", priv->address); priv->reload_scheduled_id = 0; @@ -1807,12 +1816,8 @@ static gboolean open_link_in_new_tab (EphyTab *tab, const char *link_address) { - EphyWindow *window; gboolean new_tab; - window = ephy_tab_get_window (tab); - g_return_val_if_fail (window != NULL, FALSE); - new_tab = address_has_web_scheme (link_address); if (new_tab) @@ -1996,6 +2001,7 @@ ephy_tab_init (EphyTab *tab) priv->title = NULL; priv->loading_title = NULL; priv->address_expire = EPHY_TAB_ADDRESS_EXPIRE_NOW; + priv->reload_delay_ticks = 0; embed = ephy_embed_factory_new_object (EPHY_TYPE_EMBED); g_assert (embed != NULL); |