GTK4 add CSS style name to AlertDialog


Is there any way to set a custom CSS style name for an AlertDialog?

Previously we used gtk_widget_add_css_class() on MessageDialog to alter styling depending on severity of the message. But MessageDialog is deprecated with recommendation to use AlertDialog instead.

Is it possible to change API of GtkAlertDialog to make gtk_alert_dialog_choos() amd gtk_alert_dialog_show() functions return GtkWidget* of the window created for the dialog so such changes in styling could be made?

If you’re creating your own custom style then chances are you really want to have your own custom dialog; changing the style of a shared component isn’t advisable.

A message dialog is a pretty simple top level; you can derive from GtkWindow and use a composite template to build the class using a UI definition file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.