mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Move widget trait to widgets
This commit is contained in:
parent
eac168880d
commit
d92fd419d3
4 changed files with 19 additions and 8 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::backend::Backend;
|
||||
use crate::widgets::Widget;
|
||||
use futures_channel::oneshot;
|
||||
use futures_channel::oneshot::{Receiver, Sender};
|
||||
use glib::clone;
|
||||
|
|
@ -16,12 +17,6 @@ pub trait Screen<I, O>: Widget {
|
|||
fn new(input: I, navigation_handle: NavigationHandle<O>) -> Rc<Self> where Self: Sized;
|
||||
}
|
||||
|
||||
/// Something that can be represented as a GTK widget.
|
||||
pub trait Widget {
|
||||
/// Get the widget.
|
||||
fn get_widget(&self) -> gtk::Widget;
|
||||
}
|
||||
|
||||
/// An accessor to navigation functionality for screens.
|
||||
pub struct NavigationHandle<O> {
|
||||
/// The backend, in case the screen needs it.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use super::register::RegisterDialog;
|
||||
use crate::push;
|
||||
use crate::backend::{Backend, LoginData};
|
||||
use crate::navigator::{NavigationHandle, Screen, Widget};
|
||||
use crate::navigator::{NavigationHandle, Screen};
|
||||
use crate::widgets::Widget;
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk_macros::get_widget;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::backend::{Backend, LoginData, UserRegistration};
|
||||
use crate::navigator::{NavigationHandle, Screen, Widget};
|
||||
use crate::navigator::{NavigationHandle, Screen};
|
||||
use crate::widgets::Widget;
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk_macros::get_widget;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
use gtk::prelude::*;
|
||||
|
||||
pub mod editor;
|
||||
pub use editor::*;
|
||||
|
||||
|
|
@ -29,3 +31,15 @@ pub mod upload_section;
|
|||
pub use upload_section::*;
|
||||
|
||||
mod indexed_list_model;
|
||||
|
||||
/// Something that can be represented as a GTK widget.
|
||||
pub trait Widget {
|
||||
/// Get the widget.
|
||||
fn get_widget(&self) -> gtk::Widget;
|
||||
}
|
||||
|
||||
impl<W: IsA<gtk::Widget>> Widget for W {
|
||||
fn get_widget(&self) -> gtk::Widget {
|
||||
self.clone().upcast()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue