aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/footer.rs18
-rw-r--r--src/components/header.rs24
2 files changed, 18 insertions, 24 deletions
diff --git a/src/components/footer.rs b/src/components/footer.rs
index 2576163..1c6581d 100644
--- a/src/components/footer.rs
+++ b/src/components/footer.rs
@@ -1,14 +1,12 @@
use gtk::prelude::*;
-use relm4::prelude::*;
use relm4::actions::ActionablePlus;
+use relm4::prelude::*;
-use crate::tr;
use crate::constants;
+use crate::tr;
-use crate::{
- ZoomInAction, ZoomOutAction, actions::Action
-};
-use crate::icon_names::shipped::{ ZOOM_IN_REGULAR, ZOOM_OUT_REGULAR };
+use crate::icon_names::shipped::{ZOOM_IN_REGULAR, ZOOM_OUT_REGULAR};
+use crate::{ZoomInAction, ZoomOutAction, actions::Action};
// Model and Input Messages
@@ -22,7 +20,7 @@ pub struct FooterInit {
#[derive(Debug, Clone)]
pub enum FooterAction {
- SetZoom(f64)
+ SetZoom(f64),
}
#[relm4::component(pub)]
@@ -81,9 +79,7 @@ impl SimpleComponent for Footer {
root: Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
- let model = Footer {
- zoom: init.zoom
- };
+ let model = Footer { zoom: init.zoom };
let widgets = view_output!();
ComponentParts { model, widgets }
@@ -91,7 +87,7 @@ impl SimpleComponent for Footer {
fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
match message {
- FooterAction::SetZoom(zoom) => self.zoom = zoom
+ FooterAction::SetZoom(zoom) => self.zoom = zoom,
}
}
}
diff --git a/src/components/header.rs b/src/components/header.rs
index 7a39490..6c1055b 100644
--- a/src/components/header.rs
+++ b/src/components/header.rs
@@ -1,19 +1,17 @@
use gtk::{gio, prelude::*};
-use relm4::prelude::*;
use relm4::actions::{ActionablePlus, RelmAction};
+use relm4::prelude::*;
use wmap_renderer::StageType;
-use crate::tr;
use crate::preferences::models::{CustomStage, Template};
use crate::stages::{ALL_STAGE_TYPES, LocalizedStageType};
+use crate::tr;
-use crate::{
- ChangeOrientationAction, ExportImageAction, actions::Action
-};
use crate::icon_names::shipped::{
- IMAGE_REGULAR, MENU_LARGE, SPLIT_HORIZONTAL_REGULAR, SPLIT_VERTICAL_REGULAR
+ IMAGE_REGULAR, MENU_LARGE, SPLIT_HORIZONTAL_REGULAR, SPLIT_VERTICAL_REGULAR,
};
+use crate::{ChangeOrientationAction, ExportImageAction, actions::Action};
// Model and Input Messages
@@ -24,7 +22,7 @@ pub struct Header {
horizontal_layout_enabled: bool,
templates_menu: gio::Menu,
main_menu: gio::Menu,
- layout_action: RelmAction<ChangeOrientationAction>
+ layout_action: RelmAction<ChangeOrientationAction>,
}
pub struct HeaderInit {
@@ -43,7 +41,7 @@ pub enum HeaderAction {
SetCustomStages(Vec<CustomStage>),
// Internal
- StageTypeSelected(usize)
+ StageTypeSelected(usize),
}
#[relm4::component(pub)]
@@ -110,7 +108,7 @@ impl SimpleComponent for Header {
horizontal_layout_enabled: init.horizontal_layout_enabled,
layout_action: init.layout_action,
templates_menu,
- main_menu
+ main_menu,
};
let widgets = view_output!();
@@ -124,7 +122,7 @@ impl SimpleComponent for Header {
HeaderAction::SetHorizontalLayoutEnabled(is_enabled) => {
self.horizontal_layout_enabled = is_enabled;
self.layout_action.set_enabled(is_enabled);
- },
+ }
HeaderAction::SetLayoutOrientation(orientation) => self.orientation = orientation,
HeaderAction::SetTemplates(templates) => {
self.templates_menu.remove_all();
@@ -134,17 +132,17 @@ impl SimpleComponent for Header {
Some(&format!("window.new-from-template::{}", template.id)),
);
}
- },
+ }
HeaderAction::SetCustomStages(stages) => {
self.rebuild_custom_stages(&stages);
- },
+ }
HeaderAction::StageTypeSelected(index) => {
if index < self.available_stage_types.len()
&& let Some(stage_type) = self.available_stage_types.get(index)
{
let _ = sender.output(Action::StageTypeSelected(stage_type.clone()));
}
- },
+ }
}
}
}