emitting a signal



I am having trouble making an application close when I use my File->Exit menu. I have a File Exit signal handler:

void on_File_Exit_activate(GtkMenuItem* menuitem,GtkWidget* Main_wnd)
{
        gtk_signal_emit_by_name(GTK_OBJECT(Main_wnd),
                                "delete_event");
}

which I thought would 'send' a delete_event to the main Window which has the following signal handlers:

gboolean on_Event_Delete(GtkWidget* widget,GdkEvent* event,gpointer user_data)
{
        if(is_object_created == TRUE) //free memory allocated for the CAD object
                (*object_delete_func_ptr)(network);
        return(FALSE); //do not prevent window from being closed (destroyed)
}

void on_Event_Destroy(GtkWidget* widget,GdkEvent* event,gpointer user_data)
{
        gtk_main_quit();
}

This works correctly for the delete_event which is emitted when I press the X in the corner of the window, but not using the File->Exit menu. Any help would be much appreciated.

Richard.




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