GTK - Ask Y/N question & Get Return Value

GTK - Ask Y/N question & Get Return Value

Post by Hugh McCurd » Sun, 14 Feb 1999 04:00:00



The problem is that while testing to see if it's OK to save the user's
data,
the program discovers a minor problem.

In the "curses" version of the program, it is simple to ask the user if
he wants
to ignore the minor problem and save the data anyway.  This is done
without
disrupting the flow of the program...

if ( Confirm ( "Hey buddy, are you sure? (Y/N)" ))
{
  ... do other processing and testing and perhaps more confirming...
  ...
  Write the data to disk;

Quote:}

else
  return;

I can see only one ugly way to do this in GTK.  That is to create call a
new
program that will ask the question and return a value.  It is trivial to
block
execution of the main program while the child program is waiting for a
reply.

I have looked at the GIMP source code to see how it does this sort of
thing.
But I don't see how its solution will work for me.

(So, it looks like I'm writing a program just to do Confirmation Windows
until
such time as I can learn of a better idea).
--
Hugh McCurdy

 
 
 

GTK - Ask Y/N question & Get Return Value

Post by Emil Bri » Tue, 16 Feb 1999 04:00:00


: The problem is that while testing to see if it's OK to save the user's
: data,
: the program discovers a minor problem.

: In the "curses" version of the program, it is simple to ask the user if
: he wants
: to ignore the minor problem and save the data anyway.  This is done
: without
: disrupting the flow of the program...

: if ( Confirm ( "Hey buddy, are you sure? (Y/N)" ))
: {
:   ... do other processing and testing and perhaps more confirming...
:   ...
:   Write the data to disk;
: }
: else
:   return;

Simple hint: The gtk_main() function (um, at least I think that's
what it's called) is "reentrant". You can create a modal requester
asking for the confirmation, and then call gtk_main() to run it.
As the requester closes, call gtk_main_quit() (again, I'm not sure
that's the actual function name, look it up) to "back out" of the
nested GTK+ loops. For an example of how this is done, grab gentoo
from <ftp://ftp.obsession.se/gentoo/gentoo-0.9.23.tar.gz>. :)

/Emil

 
 
 

1. getting the return value of a command executed on another host

Folks,
I am doing a shell script in which I have to excute a command on another
host. I can do this by remsh.
So what I do is the typical remsh command
as in remsh hostname command
But what i want is the return value of the command that was executed on the
remot host. When I say echo $? it returns the value of the remsh command
which is successful. I tried this using a command which failed on the remote
host. but still I was gettin $? as 0 since the remsh command itself
succeeded. I am using ksh on HP-UX 10.2

Any pointers??

2. ATI All-In-Wonder Pro

3. Getting return value from rexec

4. WARNING in arch/i386/kernel/init_task.c

5. Variables getting the return value in Korn shell?

6. Apollo 700/RX blues (Stand alone X Terminal)

7. Getting AWK to return a value

8. system()/vfork() with thread library

9. Getting the return value in xlC

10. getting command return values in sh scripts

11. Function Calls - Getting Return Value

12. Function Calls - Getting Return Value Part2

13. Getting the return value into a script?