[yast-commit] r45446 - in /trunk/pkg-bindings: VERSION package/yast2-pkg-bindings.changes src/Callbacks.YCP.h src/Callbacks.cc src/Callbacks_Register.cc
Author: lslezak Date: Fri Mar 14 09:30:52 2008 New Revision: 45446 URL: http://svn.opensuse.org/viewcvs/yast?rev=45446&view=rev Log: - support for ejecting specified CD/DVD device, handle multiple devices (fate#120298) - 2.6.19 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Callbacks.YCP.h 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=45446&r1=45445&r2=45446&view=diff ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Fri Mar 14 09:30:52 2008 @@ -1 +1 @@ -2.16.18 +2.16.19 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=45446&r1=45445&r2=45446&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Fri Mar 14 09:30:52 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Mar 14 09:27:40 CET 2008 - lslezak@suse.cz + +- support for ejecting specified CD/DVD device, handle multiple + devices (fate#120298) +- 2.6.19 + +------------------------------------------------------------------- Wed Mar 12 20:25:38 CET 2008 - jkupec@suse.cz - updated MediaChange callback (fate #120298) Modified: trunk/pkg-bindings/src/Callbacks.YCP.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks.YCP.h?rev=45446&r1=45445&r2=45446&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks.YCP.h (original) +++ trunk/pkg-bindings/src/Callbacks.YCP.h Fri Mar 14 09:30:52 2008 @@ -216,6 +216,7 @@ CB & addBool( bool arg ) { if (_func != NULL) _func->appendParameter( YCPBoolean( arg ) ); return *this; } CB & addMap( YCPMap arg ) { if (_func != NULL) _func->appendParameter( arg ); return *this; } + CB & addList( YCPList arg ) { if (_func != NULL) _func->appendParameter( arg ); return *this; } bool isStr() const { return _result->isString(); } bool isInt() const { return _result->isInteger(); } Modified: trunk/pkg-bindings/src/Callbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks.cc?rev=45446&r1=45445&r2=45446&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks.cc (original) +++ trunk/pkg-bindings/src/Callbacks.cc Fri Mar 14 09:30:52 2008 @@ -37,6 +37,7 @@ #include "zypp/KeyRing.h" #include "zypp/PublicKey.h" #include "zypp/Digest.h" +#include "zypp/base/String.h" // FIXME: do this nicer, source create use this to avoid user feedback // on probing of source type @@ -1006,7 +1007,7 @@ zypp::media::MediaChangeReport::Error error, const std::string &description, const std::vectorstd::string & devices, - unsigned int dev_current) + unsigned int &dev_current) { if ( _silent_probing == MEDIA_CHANGE_DISABLE ) return zypp::media::MediaChangeReport::ABORT; @@ -1070,6 +1071,17 @@ #warning Double sided media are not supported in MediaChangeCallback callback.addBool( false ); + // add device names + YCPList device_names; + for_(iter, devices.begin(), devices.end()) + { + device_names->add(YCPString(*iter)); + } + callback.addList(device_names); + + // add current device index + callback.addInt(dev_current); + std::string ret = callback.evaluateStr(); // "" = retry @@ -1084,6 +1096,15 @@ // "E" = eject media if (ret == "E") return zypp::media::MediaChangeReport::EJECT; + // "E" + numbure = eject the required device + if (ret.size() > 1 && ret[0] == 'E') + { + // change the device + dev_current = zypp::str::strtonum<unsigned int>(ret.c_str() + 1); + y2milestone("Ejecting device %d", dev_current); + return zypp::media::MediaChangeReport::EJECT; + } + // "S" = skip (ignore) this media if (ret == "S") return zypp::media::MediaChangeReport::IGNORE; Modified: trunk/pkg-bindings/src/Callbacks_Register.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Callbacks_Register.cc?rev=45446&r1=45445&r2=45446&view=diff ============================================================================== --- trunk/pkg-bindings/src/Callbacks_Register.cc (original) +++ trunk/pkg-bindings/src/Callbacks_Register.cc Fri Mar 14 09:30:52 2008 @@ -167,6 +167,12 @@ return SET_YCP_CB( CB_TrustedKeyRemoved, args ); } +/** + * @builtin CallbackMediaChange + * @short Register callback function + * @param string args Name of the callback handler function. Required callback prototype is <code>string( string error, string url, string product, integer current, string current_label, integer wanted, string wanted_label, boolean double_sided, list<string> devices, integer current_device )</code>. The callback function should ask user to change the medium or to change the URL of the repository. Result of the callback must be "" (retry), "I" (ignore), "C" (cancel), "S" (skip), "E" (eject), "E+number" (eject device at number) or a new URL of the repository. + * @return void + */ YCPValue PkgFunctions::CallbackMediaChange( const YCPString& args ) { // FIXME: Allow omission of 'src' argument in 'src, name'. Since we can // handle one callback function at most, passing a src argument -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org