1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-04 20:21:02 +02:00

feat(ipc): commands for opening/closing popups

Also includes some refactoring around related GTK helper code
This commit is contained in:
Jake Stanger 2023-07-16 18:57:00 +01:00
parent c582bc3390
commit b7ee794bfc
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
30 changed files with 747 additions and 345 deletions

View file

@ -1,6 +1,6 @@
use crate::config::CommonConfig;
use crate::gtk_helpers::add_class;
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::gtk_helpers::IronbarGtkExt;
use crate::modules::{Module, ModuleInfo, ModuleParts, ModuleUpdateEvent, WidgetContext};
use crate::send_async;
use color_eyre::Result;
use gtk::prelude::*;
@ -186,7 +186,7 @@ impl Module<gtk::Box> for SysInfoModule {
self,
context: WidgetContext<Self::SendMessage, Self::ReceiveMessage>,
info: &ModuleInfo,
) -> Result<ModuleWidget<gtk::Box>> {
) -> Result<ModuleParts<gtk::Box>> {
let re = Regex::new(r"\{([^}]+)}")?;
let container = gtk::Box::new(info.bar_position.get_orientation(), 10);
@ -196,7 +196,7 @@ impl Module<gtk::Box> for SysInfoModule {
for format in &self.format {
let label = Label::builder().label(format).use_markup(true).build();
add_class(&label, "item");
label.add_class("item");
label.set_angle(info.bar_position.get_angle());
container.add(&label);
@ -220,7 +220,7 @@ impl Module<gtk::Box> for SysInfoModule {
});
}
Ok(ModuleWidget {
Ok(ModuleParts {
widget: container,
popup: None,
})