aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-12-21 20:55:57 +0800
committerXan Lopez <xan@src.gnome.org>2003-12-21 20:55:57 +0800
commit5fcc37ab46f722ee0992aad79f5993bf11bf64b0 (patch)
tree96d9d6b9628370dd111a825c2790329e116b031f
parentd3faaba781cd172d20b8f5bdadfefa3bcde1c36d (diff)
downloadgsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar.gz
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar.bz2
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar.lz
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar.xz
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.tar.zst
gsoc2013-epiphany-5fcc37ab46f722ee0992aad79f5993bf11bf64b0.zip
Re-implement Pause/Resume in downloader.
* embed/downloader-view.c: (download_dialog_pause_cb): * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: * embed/mozilla/mozilla-download.cpp: Re-implement Pause/Resume in downloader. * src/window-commands.c: (window_cmd_help_about): Change mail address.
-rw-r--r--embed/downloader-view.c2
-rw-r--r--embed/mozilla/MozDownload.cpp25
-rw-r--r--embed/mozilla/MozDownload.h1
-rw-r--r--embed/mozilla/mozilla-download.cpp2
-rw-r--r--src/window-commands.c2
5 files changed, 25 insertions, 7 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 2ae57ce31..d8f886cf9 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -498,10 +498,12 @@ download_dialog_pause_cb (GtkButton *button, DownloaderView *dv)
if (state == EPHY_DOWNLOAD_DOWNLOADING)
{
ephy_download_pause (download);
+ gtk_button_set_label (GTK_BUTTON (dv->priv->pause_button), _("Resume"));
}
else if (state == EPHY_DOWNLOAD_PAUSED)
{
ephy_download_resume (download);
+ gtk_button_set_label (GTK_BUTTON (dv->priv->pause_button), _("Pause"));
}
}
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 8e7df243c..2b9a9e4b6 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -308,6 +308,9 @@ MozDownload::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
{
+ if (!mRequest)
+ mRequest = aRequest;
+
PRInt64 now = PR_Now ();
if ((now - mLastUpdate < mInterval) &&
@@ -316,7 +319,7 @@ MozDownload::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest
return NS_OK;
mLastUpdate = now;
-
+
if (mUserCanceled)
{
if (aRequest)
@@ -368,21 +371,31 @@ MozDownload::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *aReques
void
MozDownload::Cancel()
{
- mUserCanceled = true;
- /* nsWebBrowserPersist does the right thing: After canceling, next time through
- OnStateChange(), aStatus != NS_OK. This isn't the case with nsExternalHelperAppService.*/
- if (!mWebPersist)
- mStatus = NS_ERROR_ABORT;
+ mUserCanceled = true;
+ /* nsWebBrowserPersist does the right thing: After canceling, next time through
+ * OnStateChange(), aStatus != NS_OK. This isn't the case with nsExternalHelperAppService.*/
+ if (!mWebPersist)
+ mStatus = NS_ERROR_ABORT;
}
void
MozDownload::Pause()
{
+ if (mRequest)
+ {
+ mRequest->Suspend ();
+ mDownloadState = EPHY_DOWNLOAD_PAUSED;
+ }
}
void
MozDownload::Resume()
{
+ if (mRequest)
+ {
+ mRequest->Resume ();
+ mDownloadState = EPHY_DOWNLOAD_DOWNLOADING;
+ }
}
nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI,
diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h
index 930e110b8..7f40bc327 100644
--- a/embed/mozilla/MozDownload.h
+++ b/embed/mozilla/MozDownload.h
@@ -122,6 +122,7 @@ protected:
nsresult mStatus;
nsCOMPtr<nsIWebBrowserPersist> mWebPersist;
+ nsCOMPtr<nsIRequest> mRequest;
EphyDownload *mEphyDownload;
DownloaderView *mDownloaderView;
MozillaEmbedPersist *mEmbedPersist;
diff --git a/embed/mozilla/mozilla-download.cpp b/embed/mozilla/mozilla-download.cpp
index d970264fe..c5908dcfa 100644
--- a/embed/mozilla/mozilla-download.cpp
+++ b/embed/mozilla/mozilla-download.cpp
@@ -165,11 +165,13 @@ impl_cancel (EphyDownload *download)
static void
impl_pause (EphyDownload *download)
{
+ MOZILLA_DOWNLOAD (download)->moz_download->Pause ();
}
static void
impl_resume (EphyDownload *download)
{
+ MOZILLA_DOWNLOAD (download)->moz_download->Resume ();
}
static void
diff --git a/src/window-commands.c b/src/window-commands.c
index a6975d843..a07643de5 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -921,7 +921,7 @@ window_cmd_help_about (GtkAction *action,
static char *authors[] = {
"Marco Pesenti Gritti <marco@gnome.org>",
- "Xan Lopez <xan@masilla.org>",
+ "Xan Lopez <xan@gnome.org>",
"David Bordoley <bordoley@msu.edu>",
"Christian Persch <chpe@gnome.org>",
NULL