1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Take a look at the license at the top of the repository in the LICENSE file.

pub use crate::{prelude::*, StyleContext, StyleProvider};
use glib::translate::*;

impl StyleContext {
    /// Adds a global style provider to @display, which will be used
    /// in style construction for all `GtkStyleContexts` under @display.
    ///
    /// GTK uses this to make styling information from [`Settings`][crate::Settings]
    /// available.
    ///
    /// Note: If both priorities are the same, A [`StyleProvider`][crate::StyleProvider]
    /// added through [`StyleContextExt::add_provider()`][crate::prelude::StyleContextExt::add_provider()] takes
    /// precedence over another added through this function.
    /// ## `display`
    /// a [`gdk::Display`][crate::gdk::Display]
    /// ## `provider`
    /// a [`StyleProvider`][crate::StyleProvider]
    /// ## `priority`
    /// the priority of the style provider. The lower
    ///   it is, the earlier it will be used in the style construction.
    ///   Typically this will be in the range between
    ///   `GTK_STYLE_PROVIDER_PRIORITY_FALLBACK` and
    ///   `GTK_STYLE_PROVIDER_PRIORITY_USER`
    #[deprecated(note = "Use gtk::style_context_add_provider_for_display instead.")]
    #[doc(alias = "gtk_style_context_add_provider_for_display")]
    pub fn add_provider_for_display(
        display: &impl IsA<gdk::Display>,
        provider: &impl IsA<StyleProvider>,
        priority: u32,
    ) {
        skip_assert_initialized!();
        unsafe {
            ffi::gtk_style_context_add_provider_for_display(
                display.as_ref().to_glib_none().0,
                provider.as_ref().to_glib_none().0,
                priority,
            );
        }
    }

    /// Removes @provider from the global style providers list in @display.
    /// ## `display`
    /// a [`gdk::Display`][crate::gdk::Display]
    /// ## `provider`
    /// a [`StyleProvider`][crate::StyleProvider]
    #[deprecated(note = "Use gtk::style_context_remove_provider_for_display instead.")]
    #[doc(alias = "gtk_style_context_remove_provider_for_display")]
    pub fn remove_provider_for_display(
        display: &impl IsA<gdk::Display>,
        provider: &impl IsA<StyleProvider>,
    ) {
        skip_assert_initialized!();
        unsafe {
            ffi::gtk_style_context_remove_provider_for_display(
                display.as_ref().to_glib_none().0,
                provider.as_ref().to_glib_none().0,
            );
        }
    }
}