aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-06-18 03:09:05 +0800
committerXan Lopez <xan@src.gnome.org>2003-06-18 03:09:05 +0800
commit60cb87ad5d08bb30f064b3c0852558dbdca15f93 (patch)
tree38c44adff9065546affb6fa35f2abff875376b25 /embed
parentcd6c96081aef7d9b9a1ee4d65572bc3caf9583dd (diff)
downloadgsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar.gz
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar.bz2
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar.lz
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar.xz
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.tar.zst
gsoc2013-epiphany-60cb87ad5d08bb30f064b3c0852558dbdca15f93.zip
All cleanup and fixes and no play makes Xan a dull boy All cleanup and
All cleanup and fixes and no play makes Xan a dull boy All cleanup and fixes and no play makes Xan a dull boy All cleanup and fixes and no play makes Xan a dull boy All cleanup and fixes and no play makes Xan a dull boy ................
Diffstat (limited to 'embed')
-rwxr-xr-xembed/find-dialog.c2
-rw-r--r--embed/mozilla/ProgressListener.cpp49
2 files changed, 22 insertions, 29 deletions
diff --git a/embed/find-dialog.c b/embed/find-dialog.c
index f1dfbdcb2..6f41a70ee 100755
--- a/embed/find-dialog.c
+++ b/embed/find-dialog.c
@@ -258,6 +258,8 @@ find_get_info (EphyDialog *dialog)
GValue wrap = {0, };
FindDialog *find_dialog = FIND_DIALOG(dialog);
+ if (find_dialog->priv->constructed == FALSE) return;
+
/* get the search string from the entry field */
ephy_dialog_get_value (dialog, WORD_PROP, &word);
search_string = g_strdup(g_value_get_string (&word));
diff --git a/embed/mozilla/ProgressListener.cpp b/embed/mozilla/ProgressListener.cpp
index a8f949dce..abf0aec01 100644
--- a/embed/mozilla/ProgressListener.cpp
+++ b/embed/mozilla/ProgressListener.cpp
@@ -27,7 +27,6 @@
#include "ephy-file-helpers.h"
#include "mozilla-embed-persist.h"
-#include <unistd.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-i18n.h>
@@ -108,11 +107,8 @@ NS_METHOD GProgressListener::PrivateInit (void)
PRInt64 now = PR_Now ();
mLastUpdate = now;
-// mStartTime = (mTimeDownloadStarted != 0 ?
-// mTimeDownloadStarted : now);
mStartTime = now; //Stupid mozilla race condition
-
- mElapsed = now - mStartTime;
+ mElapsed = 0;
if (!mNoDialog)
{
@@ -403,9 +399,9 @@ NS_IMETHODIMP GProgressListener::
{
return NS_OK;
}
+ mLastUpdate = now;
/* compute elapsed time */
- mLastUpdate = now;
mElapsed = now - mStartTime;
/* compute size done */
@@ -427,47 +423,42 @@ NS_IMETHODIMP GProgressListener::
PRInt64 currentRate;
if (mElapsed)
{
- currentRate = ((PRInt64)(aCurTotalProgress)) * 1000000 /
- mElapsed;
+ currentRate = ((PRInt64)(aCurTotalProgress)) * 1000000 / mElapsed;
}
else
{
currentRate = 0;
}
- if (!mIsPaused)
+ if (!mIsPaused && currentRate)
{
- if (currentRate)
+ PRFloat64 currentKRate = ((PRFloat64)currentRate)/1024;
+ if (currentKRate != mPriorKRate)
{
- PRFloat64 currentKRate = ((PRFloat64)currentRate)/1024;
- if (currentKRate != mPriorKRate)
+ if (mRateChanges++ == mRateChangeLimit)
{
- if (mRateChanges++ == mRateChangeLimit)
- {
- mPriorKRate = currentKRate;
- mRateChanges = 0;
- }
- else
- {
- currentKRate = mPriorKRate;
- }
+ mPriorKRate = currentKRate;
+ mRateChanges = 0;
}
else
{
- mRateChanges = 0;
+ currentKRate = mPriorKRate;
}
-
- speed = currentKRate;
}
+ else
+ {
+ mRateChanges = 0;
+ }
+
+ speed = currentKRate;
}
/* compute time remaining */
gint remaining = -1;
if (currentRate && (aMaxTotalProgress > 0))
- {
- remaining =
- (gint)((aMaxTotalProgress - aCurTotalProgress)
- /currentRate +.5);
+ {
+ remaining = (gint)((aMaxTotalProgress - aCurTotalProgress)
+ /currentRate + 0.5);
}
downloader_view_set_download_progress (mDownloaderView,
@@ -608,7 +599,7 @@ nsresult GProgressListener::Abort (void)
notify = (mAction == ACTION_OBJECT_NOTIFY);
mAction = ACTION_NONE;
- if (mIsPaused)
+ if (mIsPaused)
{
Resume ();
}