Hi.
I updated your code a bit, since it was using some long-deprecated stuff (gtk_signal_connect() for example). I hope this code does what you want. If you need some more explanation, just ask.
Code:
#include <gtk/gtk.h>
/* remove text window when button is pressed */
static void
remove_text_window (GtkButton *widget,
GtkWidget *text_window)
{
gtk_widget_destroy (text_window);
}
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *close;
GtkWidget *vbox;
GtkWidget *bbox;
GtkWidget *label;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (window), 350, 200);
gtk_window_set_title (GTK_WINDOW (window), "GtkAlignment");
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
/* only string in Help/show ...*/
label = gtk_label_new ("Text Editor\n"
"Gtk / C\n"
"Version 4.5\n\n"
"CopyRight\n"
"All Rights Reserved\n");
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
bbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
close = gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (bbox), close);
g_signal_connect (close, "clicked",
G_CALLBACK (remove_text_window), window);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
Cheers,
Tadej