aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-05-26 02:59:59 +0800
committerXan Lopez <xan@src.gnome.org>2003-05-26 02:59:59 +0800
commitc159006b08ac492649715c9a3ce55f258e199f97 (patch)
tree52534f26f1c33f4c4c646466d4b1519a9c0a4d36
parentf554cdac20348aa1ead34e2a83a9742d06556832 (diff)
downloadgsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar.gz
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar.bz2
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar.lz
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar.xz
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.tar.zst
gsoc2013-epiphany-c159006b08ac492649715c9a3ce55f258e199f97.zip
Fix crash on pause.
Fix crash on pause.
-rw-r--r--ChangeLog10
-rw-r--r--embed/downloader-view.c25
-rw-r--r--embed/mozilla/ProgressListener.cpp2
3 files changed, 34 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 05f8559c8..7f648851e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-25 Xan Lopez <xan@masilla.org>
+
+ * embed/downloader-view.c: (controls_info_foreach),
+ (downloader_view_update_controls),
+ (downloader_view_set_download_info),
+ (downloader_view_add_download):
+ * embed/mozilla/ProgressListener.cpp:
+
+ Fix crash on download pause (#113447)
+
2003-05-25 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/ephy-state.c: (ephy_state_save):
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 3a65efc70..004b707c9 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H
@@ -88,6 +90,7 @@ typedef struct
gchar *source;
gchar *dest;
DownloadStatus status;
+ gboolean download_started;
GtkTreeRowReference *ref;
} DownloadDetails;
@@ -97,6 +100,7 @@ typedef struct
gboolean is_paused;
gboolean can_abort;
gboolean can_open;
+ gboolean can_pause;
DownloaderViewPrivate *priv;
} ControlsInfo;
@@ -326,6 +330,8 @@ controls_info_foreach (GtkTreeModel *model,
info->is_paused |= (details->status == DOWNLOAD_STATUS_PAUSED);
info->can_abort |= (details->status != DOWNLOAD_STATUS_COMPLETED);
info->can_open |= (details->status == DOWNLOAD_STATUS_COMPLETED);
+ info->can_pause |= ((details->status != DOWNLOAD_STATUS_COMPLETED) &&
+ (details->download_started == TRUE));
}
static void
@@ -340,7 +346,7 @@ downloader_view_update_controls (DownloaderViewPrivate *priv)
info->priv = priv;
/* initial conditions */
- info->is_paused = info->can_abort = info->can_open = FALSE;
+ info->is_paused = info->can_abort = info->can_open = info->can_pause = FALSE;
if (selection)
{
@@ -352,8 +358,7 @@ downloader_view_update_controls (DownloaderViewPrivate *priv)
/* setup buttons */
gtk_widget_set_sensitive (priv->open_button, info->can_open);
- gtk_widget_set_sensitive (priv->pause_button, info->can_abort);
- /* As long as we can abort, we can pause/resume */
+ gtk_widget_set_sensitive (priv->pause_button, info->can_pause);
gtk_widget_set_sensitive (priv->abort_button, info->can_abort);
if (info->is_paused)
@@ -473,9 +478,22 @@ downloader_view_set_download_info (DownloaderViewPrivate *priv,
COL_FILENAME, details->filename,
-1);
+ /* Pause Activation */
+
+ if (details->download_started == FALSE &&
+ details->status != DOWNLOAD_STATUS_COMPLETED &&
+ details->size_total != -1)
+ {
+ details->download_started = TRUE;
+ downloader_view_update_controls (priv);
+ }
+
/* Progress */
if (details->status == DOWNLOAD_STATUS_COMPLETED)
+ {
details->progress = 1;
+ }
+
sprintf (buffer, "%.1f%%",
details->progress > 0 ?
details->progress * 100.0 :
@@ -571,6 +589,7 @@ downloader_view_add_download (DownloaderView *dv,
details->size_total = -1;
details->size_done = -1;
details->progress = -1;
+ details->download_started = FALSE;
dv->priv->show_details = FALSE;
g_hash_table_insert (dv->priv->details_hash,
diff --git a/embed/mozilla/ProgressListener.cpp b/embed/mozilla/ProgressListener.cpp
index b5ed9815c..20ad8e88c 100644
--- a/embed/mozilla/ProgressListener.cpp
+++ b/embed/mozilla/ProgressListener.cpp
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H