fn new_impl()

in native/desktop-linux/src/linux/xdg_desktop_settings.rs [202:240]


    fn new_impl(namespace: &str, key: &str, value: &OwnedValue) -> anyhow::Result<Option<Self>> {
        Ok(match namespace {
            APPEARANCE_NAMESPACE => match key {
                COLOR_SCHEME_KEY => Some(Self::ColorScheme(value.clone().try_into()?)),
                ACCENT_COLOR_SCHEME_KEY => Some(Self::AccentColor(read_color(value)?)),
                _ => None,
            },
            GNOME_DESKTOP_INTERFACE_NAMESPACE => match key {
                "cursor-blink" => Some(Self::CursorBlink(read_bool(value)?)),
                "cursor-blink-time" => Some(Self::CursorBlinkTimeMs(read_i32(value)?)),
                "cursor-blink-timeout" => Some(Self::CursorBlinkTimeoutMs(read_i32(value)? * 1000)),
                "cursor-theme" => Some(Self::CursorTheme(read_string(value)?)),
                "cursor-size" => Some(Self::CursorSize(read_i32(value)?)),
                "overlay-scrolling" => Some(Self::OverlayScrolling(read_bool(value)?)),
                "font-antialiasing" => Some(Self::FontAntialiasing(FontAntialiasing::parse(&read_string(value)?)?)),
                "font-hinting" => Some(Self::FontHinting(FontHinting::parse(&read_string(value)?)?)),
                "font-rgba-order" => Some(Self::FontRgbaOrder(FontRgbaOrder::parse(&read_string(value)?)?)),
                "gtk-enable-primary-paste" => Some(Self::MiddleClickPaste(read_bool(value)?)),
                _ => None,
            },
            GNOME_DESKTOP_PERIPHERALS_MOUSE_NAMESPACE => match key {
                "double-click" => Some(Self::DoubleClickIntervalMs(read_i32(value)?)),
                _ => None,
            },
            GNOME_DESKTOP_WM_PREFERENCES_NAMESPACE => match key {
                "audible-bell" => Some(Self::AudibleBell(read_bool(value)?)),
                "button-layout" => Some(Self::TitlebarLayout(read_string(value)?)),
                "action-double-click-titlebar" => {
                    Some(Self::ActionDoubleClickTitlebar(DesktopTitlebarAction::parse(&read_string(value)?)?))
                }
                "action-right-click-titlebar" => Some(Self::ActionRightClickTitlebar(DesktopTitlebarAction::parse(&read_string(value)?)?)),
                "action-middle-click-titlebar" => {
                    Some(Self::ActionMiddleClickTitlebar(DesktopTitlebarAction::parse(&read_string(value)?)?))
                }
                _ => None,
            },
            _ => None,
        })
    }