Re: closing a GtkFileChooserDialog



The Saltydog wrote:

I have an annoying problem...

Open a GtkFileChooserDialog, select the file, click "Open"... then
execute a time-demanding subroutine. The dialog doesn't close until
the subroutine exists.

This is a snap of the code:
******************************************************
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
      {
      char *filename;

      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
      my_subroutine(filename)
      g_free (filename);
              gtk_widget_destroy (dialog);
      }
      
      gtk_widget_destroy (dialog);
***********************************************************

the dialog stays open until my_subroutine returns and as the sub is a
very long time-demanding sub, it is annoying to see the dialog stuck
opened..
 

If you only call the function to destroy the dialog after your long
subroutine, it will only be destroyed after the subroutine, naturally.
You must call gtk_widget_destroy before calling the subroutine. Besides,
it might be necessary to use a while (gtk_events_pending())
gtk_main_iteration(); loop after the destruction for the widget to be
removed from the screen, but I'm not completely sure. But try it.

-- 
Don't look now, but the man in the moon is laughing at you.

Eduardo M KALINOWSKI
ekalin bol com br
http://move.to/hpkb




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