Gtk execution question

2002-11-12 Thread lorenzo . zampese
How do I make a sort of wait which test a variable value,
for continuing normal gtk execution ?

For example :

-

void HANDLER_file_select_button_ok( GtkWidget  *w,
GtkFileSelection *fs )
{
  my_test_variable= 0;
}




/* create a file selection dialog */
wfs= gtk_file_selection_new(Open existing file);

/* connect handler HANDLER_select_file_button_ok to the
   OK button of the file selection dialog*/
g_signal_connect( G_OBJECT( GTK_FILE_SELECTION(wfs)-ok_button ),
  clicked,
  G_CALLBACK( HANDLER_file_select_button_ok), wfs );

/* show the file selection dialog */
gtk_widget_show(wfs);

/***/
/* HERE I would like to stop gtk execution while the OK button */
/* of the file selection dialog is not pressed,*/
/* but GTK execution go on and makes the   */
/* following 'window widget'  :(   */
/***/

/* follow code which make and show another widget */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);

---

I am looking for a sort of :

...
my_test_variable= 1;
wait( my_test_variable );
...

which should wait while 'my_test_variable' change value,
(e.g. in the handler function I will change 'my_test_variable' into 0
when the ok button is pressed).
When 'my_test_variable' changes value GTK should go on and making 'window'

How can obtain this kind of behavior ?

Thank you :)





___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread Sven Neumann
Hi,

[EMAIL PROTECTED] writes:

 (e.g. in the handler function I will change 'my_test_variable' into 0
 when the ok button is pressed).
 When 'my_test_variable' changes value GTK should go on and making 'window'
 
 How can obtain this kind of behavior ?

what about connecting to the clicked signal of the OK button?


Salut, Sven
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread lorenzo . zampese

Maybe I was not clear in my previous message :
I connect the clicked event as shown in the code, but
my problem is I don't want to show the file selection dialog
and window togheter.

I wish to show the window only when the ok button is pressed !
To do this a need to stop the GTK execution !

How ?

But GTK shows the file selection dialog and the window without
waiting OK button is pressed :(




   
  
  Sven Neumann 
  
  [EMAIL PROTECTED]  To:   Lorenzo Zampese/Electrolux 
Professional 
  Sent by: Sven S.P.A./Italy/Electrolux 
Group@Electrolux 
  Neumann  cc:   [EMAIL PROTECTED]
  
  [EMAIL PROTECTED]Subject:  Re: Gtk execution question
  
  rgence.de   
  
   
  
   
  
  12/11/2002 16:54 
  
   
  
   
  




Hi,

[EMAIL PROTECTED] writes:

 (e.g. in the handler function I will change 'my_test_variable' into 0
 when the ok button is pressed).
 When 'my_test_variable' changes value GTK should go on and making
'window'

 How can obtain this kind of behavior ?

what about connecting to the clicked signal of the OK button?


 Salut, Sven




___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread Jamie Guinan
On Tue, 12 Nov 2002 [EMAIL PROTECTED] wrote:

 How do I make a sort of wait which test a variable value,
 for continuing normal gtk execution ?
 
 For example :
 
 -
 
 void HANDLER_file_select_button_ok( GtkWidget  *w,
 GtkFileSelection *fs )
 {
   my_test_variable= 0;
 }
 
 
 
 
 /* create a file selection dialog */
 wfs= gtk_file_selection_new(Open existing file);
 
 /* connect handler HANDLER_select_file_button_ok to the
OK button of the file selection dialog*/
 g_signal_connect( G_OBJECT( GTK_FILE_SELECTION(wfs)-ok_button ),
   clicked,
   G_CALLBACK( HANDLER_file_select_button_ok), wfs );
 
 /* show the file selection dialog */
 gtk_widget_show(wfs);
 
 /***/
 /* HERE I would like to stop gtk execution while the OK button */
 /* of the file selection dialog is not pressed,*/
 /* but GTK execution go on and makes the   */
 /* following 'window widget'  :(   */
 /***/
 
 /* follow code which make and show another widget */
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_widget_show(window);

How about putting that gtk_widget_show(window); into your callback?

Also, I assume you're calling into gtk_main() even though you didn't 
show it.  You never really want to stop GTK execution, since it
has to be running in gtk_main() (or a custom loop) even for your
dialog to work.

-Jamie

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread Sven Neumann
Hi,

[EMAIL PROTECTED] writes:

 Maybe I was not clear in my previous message :
 I connect the clicked event as shown in the code, but
 my problem is I don't want to show the file selection dialog
 and window togheter.
 
 I wish to show the window only when the ok button is pressed !
 To do this a need to stop the GTK execution !

you should never stop the gtk+ execution or block the main loop. If
necessary you can use nested main loops but I don't think you need
to do that here.

 But GTK shows the file selection dialog and the window without
 waiting OK button is pressed :(

if you call gtk_widget_show() from the clicked signal handler (it's
not an event!), how can it be shown earlier?


Salut, Sven

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread lorenzo . zampese

My idea was the same, but I supposed there was a different way as in
Tcl/Tk scripting language (tk_wait) :)

Ok. Thank you


   
  
  Jamie Guinan 
  
  guinan@bluebuttoTo:   Lorenzo Zampese/Electrolux 
Professional 
  n.comS.P.A./Italy/Electrolux 
Group@Electrolux 
  Sent by: cc:   [EMAIL PROTECTED]  
  
  gtk-list-admin@gnSubject:  Re: Gtk execution question
  
  ome.org  
  
   
  
   
  
  12/11/2002 17:41 
  
  Please respond to
  
  guinan   
  
   
  
   
  




On Tue, 12 Nov 2002 [EMAIL PROTECTED] wrote:

 How do I make a sort of wait which test a variable value,
 for continuing normal gtk execution ?

 For example :

 -

 void HANDLER_file_select_button_ok( GtkWidget  *w,
 GtkFileSelection *fs )
 {
   my_test_variable= 0;
 }

 
 

 /* create a file selection dialog */
 wfs= gtk_file_selection_new(Open existing file);

 /* connect handler HANDLER_select_file_button_ok to the
OK button of the file selection dialog*/
 g_signal_connect( G_OBJECT( GTK_FILE_SELECTION(wfs)-ok_button ),
   clicked,
   G_CALLBACK( HANDLER_file_select_button_ok), wfs );

 /* show the file selection dialog */
 gtk_widget_show(wfs);

 /***/
 /* HERE I would like to stop gtk execution while the OK button */
 /* of the file selection dialog is not pressed,*/
 /* but GTK execution go on and makes the   */
 /* following 'window widget'  :(   */
 /***/

 /* follow code which make and show another widget */
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_widget_show(window);

How about putting that gtk_widget_show(window); into your callback?

Also, I assume you're calling into gtk_main() even though you didn't
show it.  You never really want to stop GTK execution, since it
has to be running in gtk_main() (or a custom loop) even for your
dialog to work.

-Jamie

___
gtk-list mailing list
[EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-list




___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Gtk execution question

2002-11-12 Thread lorenzo . zampese

Ok: now is clear !
Thank you :)


   
  
  Sven Neumann 
  
  [EMAIL PROTECTED]  To:   Lorenzo Zampese/Electrolux 
Professional 
  Sent by: Sven S.P.A./Italy/Electrolux 
Group@Electrolux 
  Neumann  cc:   [EMAIL PROTECTED]
  
  [EMAIL PROTECTED]Subject:  Re: Gtk execution question
  
  rgence.de   
  
   
  
   
  
  12/11/2002 17:42 
  
   
  
   
  




Hi,

[EMAIL PROTECTED] writes:

 Maybe I was not clear in my previous message :
 I connect the clicked event as shown in the code, but
 my problem is I don't want to show the file selection dialog
 and window togheter.

 I wish to show the window only when the ok button is pressed !
 To do this a need to stop the GTK execution !

you should never stop the gtk+ execution or block the main loop. If
necessary you can use nested main loops but I don't think you need
to do that here.

 But GTK shows the file selection dialog and the window without
 waiting OK button is pressed :(

if you call gtk_widget_show() from the clicked signal handler (it's
not an event!), how can it be shown earlier?


Salut, Sven





___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list