Problem with GtkDialog and gtk_widget_destroy()



I have been using Glade to create the xml for the dialog then used libglade
to create the actual dialog.  The dialog is shown and works as expected
EXCEPT   that when I press Cancel (which call
gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL)) the button
grays but the dialog itself doesn't go away.  I do see the "After destroy"
debug I inserted.  Is there something else I am missing?  This is being done
under FC6 with the latest Glade and GTK but I am using running the app under
X using VNC.  Any ideas?

From .h
        GtkWidget *dialog;

From .cpp
  GtkWidget *widget = NULL;

  gtk_init(NULL, NULL);
  
  // Initiate the XML GUI
  xml = glade_xml_new(String::F("%s/passwordEntry.glade",
app->GetSystemPath().c_str()).c_str(), NULL, NULL); 
  
  // Set the callbacks
  widget = glade_xml_get_widget(xml, "button_1"); 
  g_signal_connect(G_OBJECT(widget), "clicked",
G_CALLBACK(number_button_clicked), this);

        ...

  widget = glade_xml_get_widget(xml, "cancel"); 
  g_signal_connect(G_OBJECT(widget), "clicked",
G_CALLBACK(cancel_button_clicked), this);
  
  entryField = GTK_ENTRY(glade_xml_get_widget(xml, "entered_digits"));
  dialog = glade_xml_get_widget(xml, "dialog1");
  
  gtk_entry_set_visibility(entryField, !isPassword);
  gtk_window_set_title(GTK_WINDOW(dialog), title.c_str());
  
  /* connect signal handlers */
  glade_xml_signal_autoconnect(xml);  
  
  app->GetLogger().WriteF("about to show numericentry");
  
  //gtk_widget_show_all(dialog);
  // Start GTK
  gint response = gtk_dialog_run(GTK_DIALOG(dialog));
  okPressed = response == GTK_RESPONSE_OK;
  app->GetLogger().WriteF(String::F("after run %d", response).c_str());
  
  gtk_widget_destroy (dialog);
  app->GetLogger().WriteF("after destroy");
  dialog = NULL;





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