From 0cef1b1b8cbec6b154868d879ac10643fdee4e88 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Wed, 28 Aug 2024 18:32:26 +0300 Subject: [PATCH] add color button --- resources/accent-color-icons/brown.svg | 9 ++++++ resources/accent-color-icons/gray.svg | 9 ------ resources/accent-color-icons/teal.svg | 19 ------------- resources/resources.gresource.xml | 3 +- src/content/mod.rs | 38 +++++++++++++++++++++++++- 5 files changed, 47 insertions(+), 31 deletions(-) create mode 100644 resources/accent-color-icons/brown.svg delete mode 100644 resources/accent-color-icons/gray.svg delete mode 100644 resources/accent-color-icons/teal.svg diff --git a/resources/accent-color-icons/brown.svg b/resources/accent-color-icons/brown.svg new file mode 100644 index 0000000..dbf7f87 --- /dev/null +++ b/resources/accent-color-icons/brown.svg @@ -0,0 +1,9 @@ + + brown-svg + + + + + + \ No newline at end of file diff --git a/resources/accent-color-icons/gray.svg b/resources/accent-color-icons/gray.svg deleted file mode 100644 index 97ee244..0000000 --- a/resources/accent-color-icons/gray.svg +++ /dev/null @@ -1,9 +0,0 @@ - - gray-svg - - - - - - \ No newline at end of file diff --git a/resources/accent-color-icons/teal.svg b/resources/accent-color-icons/teal.svg deleted file mode 100644 index 01f0765..0000000 --- a/resources/accent-color-icons/teal.svg +++ /dev/null @@ -1,19 +0,0 @@ - - gray-svg - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/resources.gresource.xml b/resources/resources.gresource.xml index ea73474..1a50d57 100644 --- a/resources/resources.gresource.xml +++ b/resources/resources.gresource.xml @@ -2,13 +2,12 @@ accent-color-icons/blue.svg - accent-color-icons/gray.svg accent-color-icons/green.svg accent-color-icons/orange.svg accent-color-icons/pink.svg accent-color-icons/purple.svg accent-color-icons/red.svg - accent-color-icons/teal.svg + accent-color-icons/brown.svg accent-color-icons/yellow.svg previews/gnome.svg previews/gnome2.svg diff --git a/src/content/mod.rs b/src/content/mod.rs index d51d860..fb7d7bf 100644 --- a/src/content/mod.rs +++ b/src/content/mod.rs @@ -42,6 +42,17 @@ pub fn content( }, ]; + let accent_colors = [ + "blue", + "green", + "yellow", + "orange", + "red", + "pink", + "purple", + "brown" + ]; + let null_checkbutton = gtk::CheckButton::builder() .build(); @@ -52,6 +63,15 @@ pub fn content( .column_homogeneous(true) .build(); + let accent_colors_box = gtk::Box::builder() + .orientation(gtk::Orientation::Horizontal) + .homogeneous(true) + .halign(gtk::Align::Center) + .hexpand(true) + .margin_top(5) + .margin_bottom(5) + .build(); + let previews_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both); let mut last_widget: (Option, i32) = (None, 0); @@ -70,7 +90,6 @@ pub fn content( .hexpand(true) .margin_start(5) .margin_end(5) - .margin_top(5) .build(); let layout_checkbutton = gtk::CheckButton::builder() @@ -101,7 +120,24 @@ pub fn content( last_widget.1 += 1; } + for color in accent_colors { + let color_image = gtk::Image::builder() + .resource(format!("/com/github/pikaos-linux/pikagnomelayouts/accent-color-icons/{}.svg", &color)) + .width_request(30) + .height_request(30) + .build(); + + let color_button = gtk::Button::builder() + .child(&color_image) + .tooltip_text(t!(format!("{}_tooltip_text", &color))) + .build(); + color_button.add_css_class("flat"); + + accent_colors_box.append(&color_button); + } + content_box.append(&layout_grid); + content_box.append(&accent_colors_box); content_stack.add_named( &content_box,