[Glade-users] Closing a dialog window
- From: chris-morrison rassalom-technology co uk (Chris Morrison)
- Subject: [Glade-users] Closing a dialog window
- Date: Sun, 30 Jan 2005 14:06:19 +0000
On Sat, 2005-01-29 at 20:52 +0000, Keith Sharp wrote:
On Sat, 2005-01-29 at 12:34 +0000, Chris Morrison wrote:
Hi all,
This is probably more of a GNOME programming question than a Glade one
but here goes.
I am writing a small program in Glade that displays a dialog window on
the screen with a Close button. Clicking the close button closes the
dialog and ends the program.
I have placed the following code in the signal handler for the Close
button's click event.
void on_closebutton_clicked(GtkButton *button, gpointer window_ptr)
{
GtkDialog *window = GTK_DIALOG(window_ptr);
gtk_widget_destroy(GTK_WIDGET(window));
}
However, when I click on the Close button nothing happens and the
following message is displayed in the terminal window.
(my-program:5534): Gtk-CRITICAL **: file gtkwidget.c: line 1911
(gtk_widget_destroy): assertion `GTK_IS_WIDGET (widget)' failed
I am a newbie to Linux programming as you can tell, I have just migrated
from Micro$oft Windoze.
Any pointers (no pun intended) would be appreciated.
Two things:
1) How are you connecting the callback, which you show above, to the
object and the signal? I assume you have a call to g_signal_connect
somewhere in your code. Can you show us some more of your code?
g_signal_connect ((gpointer) closebutton, "clicked", G_CALLBACK
(on_closebutton_clicked), NULL);
This was pasted from the interface.c file.
The signals are all automatically connected by Glade when you create the
UI. I have just modified the empty function that is created in the
callbacks.c file.
2) Consider using gtk_dialog_run () and then just check the return code,
there is an example in the API docs:
http://developer.gnome.org/doc/API/2.0/gtk/GtkDialog.html#gtk-dialog-run
Keith.
_______________________________________________
Glade-users maillist - Glade-users lists ximian com
http://lists.ximian.com/mailman/listinfo/glade-users
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]