Closed dbartolini closed 1 year ago
Hello, I'm looking to handle this issue. Could you maybe direct me to some relevant files?
One could substitute the previous lines with the following:
Gtk.Widget btn;
btn = md.add_button("Close _without Saving", ResponseType.NO);
btn.get_style_context().add_class(Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
md.add_button("_Cancel", ResponseType.CANCEL);
btn = md.add_button("_Save", ResponseType.YES);
btn.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION);
There is a number of similar occurrences in level_editor.vala
.
There could be more somewhere in the tools
folder; try to grep for MessageDialog
, Button
etc.
I notice that the "_Cancel" button does not have the destructive action added to it. I'm new to GTK, could you provide how I'll know which buttons I should or should not add the destructive action to and how to add this to MessageDialogs and which of these I should do?
how I'll know which buttons I should or should not add the destructive action to
You use the destructive style class on an action that is supposed to destroy the user's work. Especially when that destructive action cannot be reversed. If you close a file without saving there's not much I can do beside showing you a big red button as a warning sign.
how to add this to MessageDialogs
You can either do it like I've shown above, or by other means which are up to you.
which of these I should do?
That is also up to you to discover.
See: https://docs.gtk.org/gtk3/const.STYLE_CLASS_SUGGESTED_ACTION.html