-- Leo's gemini proxy

-- Connecting to typed-hole.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

commit bbbbdcca3ba3e2c583ae28c3f0d8ba23d21fe08b

Author: Julien Blanchard <julien@sideburns.eu>

Date: Mon Apr 20 20:32:34 2020 +0200


Use background color if defined


diff --git a/src/main.rs b/src/main.rs

index 3475108..e97c774 100644

--- a/src/main.rs

+++ b/src/main.rs

@@ -39,9 +39,14 @@ fn main() {


// Create the main window.

let gui = Arc::new(Gui::new());

- let content_view = gui.content_view();

- let color = gdk::RGBA::from_str(&settings::background_color()).unwrap();

- content_view.override_background_color(gtk::StateFlags::NORMAL, Some(&color));

+ match settings::background_color() {

+ Some(color) => {

+ let content_view = gui.content_view();

+ let color = gdk::RGBA::from_str(&color).unwrap();

+ content_view.override_background_color(gtk::StateFlags::NORMAL, Some(&color));

+ },

+ None => ()

+ }


// Bind back button

{

diff --git a/src/settings.rs b/src/settings.rs

index 062108d..4b395c0 100644

--- a/src/settings.rs

+++ b/src/settings.rs

@@ -80,13 +80,10 @@ pub fn text_color() -> String {

}

}


-pub fn background_color() -> String {

+pub fn background_color() -> Option<String> {

match read().colors {

- Some(colors) => match colors.background {

- Some(color) => color,

- None => String::from("white")

- }

- None => String::from("white")

+ Some(colors) => colors.background,

+ None => None

}

}




---

Served by Pollux Gemini Server.

-- Response ended

-- Page fetched on Sun May 19 04:25:11 2024