Is there any way to use a predefined response (e.g., GTK_RESPONSE_OK
) in a GtkDialog
, without hard-coding the ID? Glade generates XML with "0" there by default, and gives me a numeric entry. While I suppose I could enter -5, that seems to defeat the point of having a constant.
The Glade XML looks like this:
<action-widgets>
<action-widget response="0">cancel-button</action-widget>
<action-widget response="0">connect-button</action-widget>
</action-widgets>
Even the example in the docs:
<action-widgets>
<action-widget response="3">button_ok</action-widget>
<action-widget response="-5">button_cancel</action-widget>
</action-widgets>
(Which is a bit hilarious, given that they're using -5 (GTK_RESPONSE_OK
) for "button_cancel
"…)
Since GTK 3.12 you can use nck-names for the response.
commit baa471ec130c360a5c4ae314769bc7b858814219
Author: Jasper St. Pierre <[email protected]>
Date: Mon Oct 28 11:19:43 2013 -0400
gtkdialog: Allow specifying response IDs by nick in <action-widgets>
This makes it a lot more convenient for developers, as they don't
have to look up the numeric value of response IDs.
so you can now do
<action-widgets>
<action-widget response="ok">button_ok</action-widget>
<action-widget response="cancel">button_cancel</action-widget>
</action-widgets>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With