[go: up one dir, main page]

gtk4/
info_bar.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{InfoBar, ResponseType};
4
5impl InfoBar {
6    #[doc(alias = "gtk_info_bar_new_with_buttons")]
7    #[doc(alias = "new_with_buttons")]
8    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
9    #[allow(deprecated)]
10    pub fn with_buttons(buttons: &[(&str, ResponseType)]) -> Self {
11        assert_initialized_main_thread!();
12        let info_bar = InfoBar::new();
13        info_bar.add_buttons(buttons);
14        info_bar
15    }
16
17    #[doc(alias = "gtk_info_bar_add_buttons")]
18    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
19    #[allow(deprecated)]
20    pub fn add_buttons(&self, buttons: &[(&str, ResponseType)]) {
21        for &(text, id) in buttons {
22            self.add_button(text, id);
23        }
24    }
25}