From 60cb87ad5d08bb30f064b3c0852558dbdca15f93 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Tue, 17 Jun 2003 19:09:05 +0000 Subject: 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 ................ --- embed/find-dialog.c | 2 ++ embed/mozilla/ProgressListener.cpp | 49 ++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 29 deletions(-) (limited to 'embed') 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 #include #include @@ -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 (); } -- cgit v1.2.3