roma0104 / gtkdialog

Automatically exported from code.google.com/p/gtkdialog
GNU General Public License v2.0
0 stars 0 forks source link

Conditional function execution #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Conditional function execution other than checking the state of a toggle 
widget. It's going to involve running a command in a shell and evaluating it.

Zigbert

http://www.murga-linux.com/puppy/viewtopic.php?p=660593#660593

Original issue reported on code.google.com by thunor...@hotmail.com on 1 Nov 2012 at 12:01

GoogleCodeExporter commented 9 years ago
Currently accepted:

<action>if [ true ]; then echo true; fi</action>
<action>if [ false ]; then echo false; fi</action>
<action>if true enable:VARNAME</action>
<action>if false disable:VARNAME</action>

Suggestions for improvements:

<action>if read-true-or-false-from-a-file enable:VARNAME</action>
<action>if read-true-or-false-from-a-shell enable:VARNAME</action>

Both of the above will require wrapping in a unique character especially since 
there could be whitespace, but what shall I use? It's got to be something that 
won't interfere with the parser and definitely can't be a shell command. Maybe:

<action>if file(read-true-or-false-from-a-file) enable:VARNAME</action>
<action>if command(read-true-or-false-from-a-shell) enable:VARNAME</action>

So I'd check for "if file(" and "if command(" but then the closing bracket 
could be part of a shell command, so I'll just have to check for function: 
following it since this is the most sensible and intuitive way to implement it 
[so far].

The widget_signal_executor() will require a rewrite.

Original comment by thunor...@hotmail.com on 22 Nov 2012 at 12:38

GoogleCodeExporter commented 9 years ago
Done in r476.

if file()
if ! file()
if command()
if ! command()

Original comment by thunor...@hotmail.com on 24 Nov 2012 at 3:56