Mailinglist Archive: yast-devel (105 mails)

< Previous Next >
Re: [yast-devel] Enforcing okButton and cancelButton
  • From: Stefan Hundhammer <sh@xxxxxxx>
  • Date: Thu, 4 Sep 2008 13:27:48 +0200
  • Message-id: <200809041327.48987.sh@xxxxxxx>
On Donnerstag, 4. September 2008, Ladislav Slezak wrote:
My question is why is the failed check considered as a fatal error? Isn't
it rather a minor problem? Would be an y2warning message enough instead of
aborting the module?

It doesn't abort the module; it makes UI::OpenDialog() fail. You could easily
catch that in YCP code (but it's not done anywhere in production code):

http://svn.opensuse.org/svn/yast/trunk/ycp-ui-bindings/examples/ButtonBox2.ycp

void showDialog( term buttonBox )
{
boolean success = (boolean)
UI::OpenDialog(
`VBox(
`HVCenter( `Label( "Hello, World!" ) ),
buttonBox
)
);

// Most YCP developers never use the return value of UI::OpenDialog().
// Many of them probably don't even know that it has a return value.
//
// Used properly, that return value can be used to recover from error
// situations that would otherwise abort the program - like in this
//case.

if ( success )
{
UI::UserInput();
UI::CloseDialog();
}
}


Past experience shows that y2warning() calls are generally ignored, so they
are pretty useless.


CU
--
Stefan Hundhammer <sh@xxxxxxx> Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >