mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 14:51:04 +02:00
refactor: better error handling for client initialization
This commit is contained in:
parent
1b35354272
commit
9245188af7
10 changed files with 97 additions and 49 deletions
|
@ -10,7 +10,7 @@ use gtk::{Application, Button, EventBox, IconTheme, Orientation, Revealer, Widge
|
|||
use tokio::sync::{broadcast, mpsc};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::clients::ProvidesClient;
|
||||
use crate::clients::{ClientResult, ProvidesClient, ProvidesFallibleClient};
|
||||
use crate::config::{BarPosition, CommonConfig, TransitionType};
|
||||
use crate::gtk_helpers::{IronbarGtkExt, WidgetGeometry};
|
||||
use crate::popup::Popup;
|
||||
|
@ -115,6 +115,13 @@ where
|
|||
ProvidesClient::provide(self)
|
||||
}
|
||||
|
||||
pub fn try_client<T: ?Sized>(&self) -> ClientResult<T>
|
||||
where
|
||||
WidgetContext<TSend, TReceive>: ProvidesFallibleClient<T>,
|
||||
{
|
||||
ProvidesFallibleClient::try_provide(self)
|
||||
}
|
||||
|
||||
/// Subscribes to events sent from this widget.
|
||||
pub fn subscribe(&self) -> broadcast::Receiver<TSend> {
|
||||
self.update_tx.subscribe()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue