Hello, I've got a GtkMessageDialog with a text field and two buttons (OK and CANCEL).
I need to set the OK button as the default response when the user presses the "Enter" key.
This is what I've tried:
dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK_CANCEL, text);
The problem is that this doesn't work correctly. If the focus is not the text field, pressing "enter" doesn't do anything. However, when the focus is removed from the text field, pressing "enter" closes the window and sends the GTK_RESPONSE_OK response.
What can I do in order to have the "enter" key close the window even when the text field has the focus?