Re: Problem with GtkDialog and gtk_widget_destroy()



Kevin Lambert wrote:
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?

I don't see that you've defined the signal handlers you reference below. Do you have them defined, and if so, what do you do in them? Have you taken a look at the GtkDialog section of the Gtk+ reference?

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;


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
Guy Rouillier



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