0

How does one create a round and suggested/destructive button in Gtk?

I have already tried using get_style_context() but it seems that I can only use it once. Is there a "CSS way" to achieve this?

pub fn make_rounded_button(label: &str) -> gtk::Button {
    let btn = gtk::Button::new_with_label(label);
    btn.get_style_context().add_class("circular");
    btn.get_style_context().add_class("suggested-action"); // ineffective
    btn
}
noconst
  • 639
  • 4
  • 15

1 Answers1

0

I think this is just a limitation of the Adwaita theme. I have opened an issue here: https://gitlab.gnome.org/GNOME/gtk/issues/2173

EDIT: it's been fixed, you can expect it to work in the next release!

lb90
  • 828
  • 4
  • 8