add color button

This commit is contained in:
Ward from fusion-voyager-3 2024-08-28 18:32:26 +03:00
parent f9cbf4ddf4
commit 0cef1b1b8c
5 changed files with 47 additions and 31 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -2,13 +2,12 @@
<gresources>
<gresource prefix="/com/github/pikaos-linux/pikagnomelayouts/">
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/blue.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/gray.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/green.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/orange.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/pink.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/purple.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/red.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/teal.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/brown.svg</file>
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/yellow.svg</file>
<file compressed="true" preprocess="xml-stripblanks">previews/gnome.svg</file>
<file compressed="true" preprocess="xml-stripblanks">previews/gnome2.svg</file>

View File

@ -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<gtk::Box>, 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,