Author: lslezak Date: Tue Mar 11 13:23:18 2008 New Revision: 45343 URL: http://svn.opensuse.org/viewcvs/yast?rev=45343&view=rev Log: - updated ProgressDownload callback - pass the current and the average download rate (#168935) - 2.16.17 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Callbacks.cc trunk/pkg-bindings/src/Callbacks_Register.cc Modified: trunk/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/VERSION?rev=45343&r1=45342&r2=45343&view=diff ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Tue Mar 11 13:23:18 2008 @@ -1 +1 @@ -2.16.16 +2.16.17 Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=45343&r1=45342&r2=45343&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Tue Mar 11 13:23:18 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Mar 11 13:20:55 CET 2008 - lslezak@suse.cz + +- updated ProgressDownload callback - pass the current and the + average download rate (#168935) +- 2.16.17 + +------------------------------------------------------------------- Wed Mar 5 22:13:30 CET 2008 - coolo@suse.de - reduce build requires Modified: trunk/pkg-bindings/src/Callbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks.cc?rev=45343&r1=45342&r2=45343&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks.cc (original) +++ trunk/pkg-bindings/src/Callbacks.cc Tue Mar 11 13:23:18 2008 @@ -781,7 +781,7 @@ } } - virtual bool progress(int value, const zypp::Url &file) + virtual bool progress(int value, const zypp::Url &file, double bps_avg, double bps_current) { CB callback( ycpcb( YCPCallbacks::CB_ProgressDownload ) ); // call the callback function only if the difference since the last call is at least 5% @@ -791,11 +791,12 @@ last_reported = value; // report changed values callback.addInt( value ); - callback.addInt( 100 ); + callback.addInt( (long long) bps_avg ); + callback.addInt( (long long) bps_current ); return callback.evaluateBool( true ); // default == continue } - return zypp::media::DownloadProgressReport::progress(value, file); + return zypp::media::DownloadProgressReport::progress(value, file, bps_avg, bps_current); } virtual Action problem( const zypp::Url &file, zypp::media::DownloadProgressReport::Error error, const std::string &description) Modified: trunk/pkg-bindings/src/Callbacks_Register.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks_Register.cc?rev=45343&r1=45342&r2=45343&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks_Register.cc (original) +++ trunk/pkg-bindings/src/Callbacks_Register.cc Tue Mar 11 13:23:18 2008 @@ -588,6 +588,12 @@ YCPValue PkgFunctions::CallbackStartDownload( const YCPString& args ) { return SET_YCP_CB( CB_StartDownload, args ); } +/** + * @builtin CallbackProgressDownload + * @short Register callback function + * @param string func Name of the callback handler function. Required callback prototype is <code>boolean(integer percent, integer average_bps, integer current_bps)</code>. The callback function is evaluated when at least 5% has been downloaded. If the callback function returns false the download is aborted. + * @return void + */ YCPValue PkgFunctions::CallbackProgressDownload( const YCPString& args ) { return SET_YCP_CB( CB_ProgressDownload, args ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org