add glib settings to layout
This commit is contained in:
parent
5548191eda
commit
f9cbf4ddf4
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Name=PikaOS Desktop Layouts
|
||||
Exec=/usr/bin/pika-gnome-layouts
|
||||
Exec=pika-gnome-layouts
|
||||
Icon=desktop
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
@ -18,7 +18,7 @@ pub fn build_ui(app: &adw::Application) {
|
||||
let content_stack = gtk::Stack::builder()
|
||||
.build();
|
||||
|
||||
content::content(&content_stack);
|
||||
content::content(&content_stack, &glib_settings);
|
||||
|
||||
let window_toolbar = adw::ToolbarView::builder().content(&content_stack).build();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
pub const APP_ID: &str = "com.github.pikaos-linux.pikagnomelayouts";
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub const APP_ICON: &str = "com.github.pikaos-linux.pikagnomelayouts";
|
||||
pub const APP_ICON: &str = "desktop";
|
||||
pub const APP_GITHUB: &str = "https://git.pika-os.com/gnome-packages/pika-gnome-layouts";
|
@ -1,4 +1,4 @@
|
||||
use gtk::prelude::*;
|
||||
use gtk::{gio as gio, glib as glib, prelude::*};
|
||||
|
||||
struct DesktopLayout {
|
||||
name: String,
|
||||
@ -7,6 +7,7 @@ struct DesktopLayout {
|
||||
|
||||
pub fn content(
|
||||
content_stack: >k::Stack,
|
||||
glib_settings: &gio::Settings
|
||||
) {
|
||||
let content_box = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
@ -21,23 +22,23 @@ pub fn content(
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "traditional".to_string(),
|
||||
id: 0
|
||||
id: 1
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "eleven".to_string(),
|
||||
id: 0
|
||||
id: 2
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "pineapple".to_string(),
|
||||
id: 0
|
||||
id: 3
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "gnome2".to_string(),
|
||||
id: 0
|
||||
id: 4
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "unity".to_string(),
|
||||
id: 0
|
||||
id: 5
|
||||
},
|
||||
];
|
||||
|
||||
@ -47,6 +48,8 @@ pub fn content(
|
||||
let layout_grid = gtk::Grid::builder()
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.row_homogeneous(true)
|
||||
.column_homogeneous(true)
|
||||
.build();
|
||||
|
||||
let previews_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Both);
|
||||
@ -60,6 +63,7 @@ pub fn content(
|
||||
let layout_box = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.build();
|
||||
|
||||
let layout_preview = gtk::Image::builder()
|
||||
.resource(format!("/com/github/pikaos-linux/pikagnomelayouts/previews/{}.svg", &layout_name))
|
||||
.vexpand(true)
|
||||
@ -73,6 +77,7 @@ pub fn content(
|
||||
.group(&null_checkbutton)
|
||||
.halign(gtk::Align::Center)
|
||||
.valign(gtk::Align::Start)
|
||||
.active(glib_settings.int("layout-num") == layout_id)
|
||||
.label(t!(format!("{}_label", &layout_name)))
|
||||
.tooltip_text(t!(format!("{}_tooltip_text", &layout_name)))
|
||||
.build();
|
||||
|
Loading…
Reference in New Issue
Block a user