1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

feat: Add orientation and direction support for sys info

This commit is contained in:
Claire Neveu 2024-04-05 13:28:47 -04:00
parent 70b2c592b2
commit 44be58594b
10 changed files with 66 additions and 36 deletions

View file

@ -2,7 +2,7 @@ use super::{CustomWidget, CustomWidgetContext};
use crate::build;
use crate::config::ModuleOrientation;
use crate::modules::custom::WidgetConfig;
use gtk::{prelude::*, Orientation};
use gtk::prelude::*;
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
@ -20,9 +20,7 @@ impl CustomWidget for BoxWidget {
let container = build!(self, Self::Widget);
if let Some(orientation) = self.orientation {
container.set_orientation(
Orientation::from(orientation),
);
container.set_orientation(orientation.into());
}
if let Some(widgets) = self.widgets {

View file

@ -39,9 +39,7 @@ impl CustomWidget for ButtonWidget {
let label = Label::new(None);
label.set_use_markup(true);
label.set_angle(
self.orientation.to_angle(),
);
label.set_angle(self.orientation.to_angle());
button.add(&label);

View file

@ -23,9 +23,7 @@ impl CustomWidget for LabelWidget {
fn into_widget(self, _context: CustomWidgetContext) -> Self::Widget {
let label = build!(self, Self::Widget);
label.set_angle(
self.orientation.to_angle(),
);
label.set_angle(self.orientation.to_angle());
label.set_use_markup(true);

View file

@ -18,7 +18,7 @@ use crate::modules::{
};
use crate::script::Script;
use crate::{module_impl, send_async, spawn};
use color_eyre::{Report, Result};
use color_eyre::Result;
use gtk::prelude::*;
use gtk::{Button, IconTheme, Orientation};
use serde::Deserialize;

View file

@ -1,5 +1,4 @@
use gtk::prelude::*;
use gtk::Orientation;
use gtk::ProgressBar;
use serde::Deserialize;
use tokio::sync::mpsc;
@ -36,9 +35,7 @@ impl CustomWidget for ProgressWidget {
fn into_widget(self, context: CustomWidgetContext) -> Self::Widget {
let progress = build!(self, Self::Widget);
progress.set_orientation(
Orientation::from(self.orientation),
);
progress.set_orientation(self.orientation.into());
if let Some(length) = self.length {
set_length(&progress, length, context.bar_orientation);

View file

@ -1,5 +1,4 @@
use glib::Propagation;
use gtk::Orientation;
use std::cell::Cell;
use std::ops::Neg;
@ -48,9 +47,7 @@ impl CustomWidget for SliderWidget {
fn into_widget(self, context: CustomWidgetContext) -> Self::Widget {
let scale = build!(self, Self::Widget);
scale.set_orientation(
Orientation::from(self.orientation),
);
scale.set_orientation(self.orientation.into());
if let Some(length) = self.length {
set_length(&scale, length, context.bar_orientation);