mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +00:00
feat!: use more new adw 1.4 widgets
This commit is contained in:
parent
376c7ce01f
commit
f4b317251a
5 changed files with 100 additions and 117 deletions
|
@ -53,26 +53,26 @@ impl SimpleComponent for BuildWindow {
|
||||||
set_modal: true,
|
set_modal: true,
|
||||||
set_default_size: (520, 400),
|
set_default_size: (520, 400),
|
||||||
set_hide_on_close: true,
|
set_hide_on_close: true,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
|
set_bottom_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_spacing: 12,
|
|
||||||
gtk::WindowHandle {
|
|
||||||
set_vexpand: false,
|
|
||||||
set_hexpand: true,
|
|
||||||
adw::HeaderBar {
|
|
||||||
set_show_end_title_buttons: false,
|
set_show_end_title_buttons: false,
|
||||||
set_show_start_title_buttons: false,
|
set_show_start_title_buttons: false,
|
||||||
add_css_class: "flat",
|
|
||||||
#[wrap(Some)]
|
#[wrap(Some)]
|
||||||
set_title_widget: title_label = >k::Label {
|
set_title_widget: title_label = &adw::WindowTitle {
|
||||||
#[track = "model.changed(BuildWindow::title())"]
|
#[track = "model.changed(BuildWindow::title())"]
|
||||||
set_markup: &model.title,
|
set_title: &model.title,
|
||||||
add_css_class: "title",
|
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
#[wrap(Some)]
|
||||||
|
set_content: content = >k::Box {
|
||||||
|
set_orientation: gtk::Orientation::Vertical,
|
||||||
|
set_vexpand: true,
|
||||||
|
set_hexpand: true,
|
||||||
|
set_margin_all: 12,
|
||||||
gtk::Box {
|
gtk::Box {
|
||||||
set_orientation: gtk::Orientation::Horizontal,
|
set_orientation: gtk::Orientation::Horizontal,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
|
@ -128,7 +128,8 @@ impl SimpleComponent for BuildWindow {
|
||||||
set_buffer: Some(&model.textbuf),
|
set_buffer: Some(&model.textbuf),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
gtk::Button {
|
},
|
||||||
|
add_bottom_bar: bottom_bar = >k::Button {
|
||||||
add_css_class: "pill",
|
add_css_class: "pill",
|
||||||
set_halign: gtk::Align::Center,
|
set_halign: gtk::Align::Center,
|
||||||
set_label: "Close",
|
set_label: "Close",
|
||||||
|
|
|
@ -7,10 +7,7 @@ use crate::{
|
||||||
withclones,
|
withclones,
|
||||||
};
|
};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use relm4::{
|
use relm4::{factory::AsyncFactoryVecDeque, prelude::*};
|
||||||
factory::{AsyncFactoryVecDeque, FactoryVecDeque},
|
|
||||||
prelude::*,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[tracker::track]
|
#[tracker::track]
|
||||||
pub struct FbtConfigEditor {
|
pub struct FbtConfigEditor {
|
||||||
|
@ -50,23 +47,16 @@ impl SimpleComponent for FbtConfigEditor {
|
||||||
set_transient_for: Some(&init.root_win),
|
set_transient_for: Some(&init.root_win),
|
||||||
set_default_height: 500,
|
set_default_height: 500,
|
||||||
set_default_width: 600,
|
set_default_width: 600,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_vexpand: true,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
add_top_bar: headerbar = &adw::HeaderBar {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
|
||||||
gtk::WindowHandle {
|
|
||||||
set_vexpand: false,
|
|
||||||
set_hexpand: true,
|
|
||||||
#[name(headerbar)]
|
|
||||||
adw::HeaderBar {
|
|
||||||
set_vexpand: false,
|
set_vexpand: false,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
add_css_class: "flat",
|
add_css_class: "flat",
|
||||||
pack_start: &add_btn,
|
pack_start: &add_btn,
|
||||||
pack_end: &save_btn,
|
pack_end: &save_btn,
|
||||||
},
|
},
|
||||||
},
|
set_content: Some(&model.tracker_role_groups.widget().clone().upcast::<gtk::Widget>()),
|
||||||
append: model.tracker_role_groups.widget(),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,24 +97,18 @@ impl SimpleComponent for LibsurviveSetupWindow {
|
||||||
set_modal: true,
|
set_modal: true,
|
||||||
set_default_size: (520, 400),
|
set_default_size: (520, 400),
|
||||||
set_hide_on_close: true,
|
set_hide_on_close: true,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
set_bottom_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_vexpand: true,
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_spacing: 12,
|
|
||||||
set_margin_all: 12,
|
|
||||||
gtk::WindowHandle {
|
|
||||||
adw::HeaderBar {
|
|
||||||
add_css_class: "flat",
|
add_css_class: "flat",
|
||||||
#[wrap(Some)]
|
#[wrap(Some)]
|
||||||
set_title_widget: title_label = >k::Label {
|
set_title_widget: title_label = &adw::WindowTitle {
|
||||||
set_label: "Setup Lighthouses",
|
set_title: "Setup Lighthouses",
|
||||||
add_css_class: "title",
|
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
#[name(carousel)]
|
#[wrap(Some)]
|
||||||
adw::Carousel {
|
set_content: carousel = &adw::Carousel {
|
||||||
set_allow_long_swipes: false,
|
set_allow_long_swipes: false,
|
||||||
set_allow_scroll_wheel: false,
|
set_allow_scroll_wheel: false,
|
||||||
set_allow_mouse_drag: false,
|
set_allow_mouse_drag: false,
|
||||||
|
@ -344,7 +338,9 @@ impl SimpleComponent for LibsurviveSetupWindow {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
adw::CarouselIndicatorDots {
|
add_bottom_bar: dots = &adw::CarouselIndicatorDots {
|
||||||
|
set_margin_top: 12,
|
||||||
|
set_margin_bottom: 12,
|
||||||
set_carousel: Some(&carousel),
|
set_carousel: Some(&carousel),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ pub fn path_row<F: Fn(Option<String>) + 'static + Clone>(
|
||||||
.title(title)
|
.title(title)
|
||||||
.subtitle_lines(0)
|
.subtitle_lines(0)
|
||||||
.activatable(true)
|
.activatable(true)
|
||||||
.icon_name(GString::from("folder-open-symbolic"))
|
|
||||||
.build();
|
.build();
|
||||||
|
row.add_prefix(>k::Image::from_icon_name("folder-open-symbolic"));
|
||||||
|
|
||||||
if let Some(d) = description {
|
if let Some(d) = description {
|
||||||
row.set_subtitle(d);
|
row.set_subtitle(d);
|
||||||
|
|
|
@ -55,16 +55,12 @@ impl SimpleComponent for ProfileEditor {
|
||||||
set_title: Some(model.profile.borrow().name.as_str()),
|
set_title: Some(model.profile.borrow().name.as_str()),
|
||||||
set_default_height: 500,
|
set_default_height: 500,
|
||||||
set_default_width: 600,
|
set_default_width: 600,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
gtk::WindowHandle {
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_hexpand: true,
|
|
||||||
set_vexpand: false,
|
set_vexpand: false,
|
||||||
adw::HeaderBar {
|
|
||||||
set_vexpand: false,
|
|
||||||
add_css_class: "flat",
|
|
||||||
pack_end: save_btn = >k::Button {
|
pack_end: save_btn = >k::Button {
|
||||||
set_label: "Save",
|
set_label: "Save",
|
||||||
add_css_class: "suggested-action",
|
add_css_class: "suggested-action",
|
||||||
|
@ -73,8 +69,8 @@ impl SimpleComponent for ProfileEditor {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
#[wrap(Some)]
|
||||||
adw::PreferencesPage {
|
set_content: pref_page = &adw::PreferencesPage {
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
add: maingrp = &adw::PreferencesGroup {
|
add: maingrp = &adw::PreferencesGroup {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue