[Glade-users] gtk_main_quit functionality

In my _button_clicked callback, I open a file and write to it all the input from the entry fields. However,  
I first check if the file exists and if not, I want to quit and exit the program (with no warning), so I call 
gtk_main_quit(). However, I notice that even though it does close my window, it still executes the rest of 
the callback. I don't want that. If my file doesn't exist, I need to exit (gracefully) right away, so I use 
return right after gtk_main_quit(). Is it the right way to exit? 
I am writing in C, here is the code excerpt:
void on_button1_clicked (GtkButton *button, gpointer user_data) {
  FILE *fp;
  fp = fopen("filename", "r");
  if (fp == NULL) {
     return;  /* if I don't have this return, it would continue on and print "I am here" 
  printf("I am here\n");
  /*** more code here **/
So, is calling _main_quit and return the right way to end the program?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100826/3eca9113/attachment.html 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]