Dialog window do not close correctly



	Hi,

	i've made a simple dockApp for WindowMaker some time ago, and it
has a problem related to a gtk dialog box.

	Well, in Window Maker, when a window is opend, a little box apper
in the window's corner. When you close the window, this little box
disapper too.

	The problem is that when I create the dialog window the small box
shows. But when I close it the small box remains there 'til I close the
entire application or restart the Window Manager.

	Any help will be welcome.

	Here, is part of the code:



int fecha(void) {
        //gtk_exit(0);
        gtk_widget_destroy(dialog);
        dialog = NULL;
        //close();
}


int button_press(GtkWidget *widget, GdkEvent *event) {

        GtkWidget *label;
        gchar *message;
        GtkWidget *halt_button;
        GtkWidget *reboot_button;
        GtkWidget *cancel_button;

        //Descomentar para debug
        //g_print("Evento ocorreu");

        if (event->type == GDK_BUTTON_PRESS) {
                GdkEventButton  *bevent = (GdkEventButton *)event;

                switch (bevent->button) {
                        case 1:

                                if (dialog != NULL)
                                        return;
                                message = "Shutdown confirmation";
                                dialog = gtk_dialog_new();
                                label = gtk_label_new (message);

                                halt_button =
gtk_button_new_with_label("Halt");
                                reboot_button =
gtk_button_new_with_label("Reboot");
                                cancel_button =
gtk_button_new_with_label("Cancel");

                                gtk_signal_connect(GTK_OBJECT(dialog),
"destroy", GTK_SIGNAL_FUNC(fecha), NULL);

                                gtk_signal_connect_object (GTK_OBJECT
(cancel_button), "clicked", GTK_SIGNAL_FUNC (fecha), (gpointer) dialog);

                                gtk_signal_connect_object (GTK_OBJECT
(halt_button), "clicked", GTK_SIGNAL_FUNC (desliga), (gpointer) dialog);

                                gtk_signal_connect_object (GTK_OBJECT
(reboot_button), "clicked", GTK_SIGNAL_FUNC (reinicia), (gpointer)
dialog);

                                gtk_container_add (GTK_CONTAINER
(GTK_DIALOG(dialog)->action_area), halt_button);
                                gtk_container_add (GTK_CONTAINER
(GTK_DIALOG(dialog)->action_area), reboot_button);
                                gtk_container_add (GTK_CONTAINER
(GTK_DIALOG(dialog)->action_area), cancel_button);

                                gtk_container_add (GTK_CONTAINER
(GTK_DIALOG(dialog)->vbox), label);

                                gtk_widget_show_all (dialog);
                }
        }





[]s Rafael.




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