pub struct ComposerState {
room: WeakRef<Room>,
buffer: Buffer,
related_to: RefCell<Option<RelationInfo>>,
has_relation: PhantomData<bool>,
widgets: RefCell<Vec<(Widget, TextChildAnchor)>>,
view: WeakRef<View>,
saved_draft: RefCell<Option<ComposerDraft>>,
draft_timeout: RefCell<Option<SourceId>>,
draft_lock: Mutex<()>,
}
Fields§
§room: WeakRef<Room>
The room associated with this state.
buffer: Buffer
The buffer of this state.
The relation of this state.
has_relation: PhantomData<bool>
Whether this state has a relation.
widgets: RefCell<Vec<(Widget, TextChildAnchor)>>
The widgets of this state.
These are the widgets inserted in the composer.
view: WeakRef<View>
The current view attached to this state.
saved_draft: RefCell<Option<ComposerDraft>>
The draft that was saved in the store.
draft_timeout: RefCell<Option<SourceId>>
The signal handler for the current draft saving timeout.
draft_lock: Mutex<()>
The lock to prevent multiple draft saving operations at the same time.
Implementations§
Source§impl ComposerState
impl ComposerState
Sourcefn register_type()
fn register_type()
Registers the type only once.
Source§impl ComposerState
impl ComposerState
Sourcepub(super) fn attach_to_view(&self, view: Option<&View>)
pub(super) fn attach_to_view(&self, view: Option<&View>)
Attach this state to the given view.
The relation to send with the current message.
Set the relation to send with the current message.
Sourcefn has_relation(&self) -> bool
fn has_relation(&self) -> bool
Whether this state has a relation.
Sourcepub(super) fn update_widgets(&self)
pub(super) fn update_widgets(&self)
Update the list of widgets present in the composer.
Sourcefn draft(&self) -> Option<ComposerDraft>
fn draft(&self) -> Option<ComposerDraft>
Get the draft for the current state.
Returns None
if the draft would be empty.
Sourcepub(super) fn trigger_draft_saving(&self)
pub(super) fn trigger_draft_saving(&self)
Trigger the timeout for saving the current draft.
Sourceasync fn save_draft(&self)
async fn save_draft(&self)
Save the current draft.
Sourcepub(super) fn add_widget(&self, widget: impl IsA<Widget>, iter: &mut TextIter)
pub(super) fn add_widget(&self, widget: impl IsA<Widget>, iter: &mut TextIter)
Add the given widget at the position of the given iter to this state.
Sourcepub(super) fn widget_at_anchor(
&self,
anchor: &TextChildAnchor,
) -> Option<Widget>
pub(super) fn widget_at_anchor( &self, anchor: &TextChildAnchor, ) -> Option<Widget>
Get the widget at the given anchor, if any.
Sourcepub(super) async fn restore_draft(&self)
pub(super) async fn restore_draft(&self)
Restore the state from the persisted draft.
Sourceasync fn restore_from_draft(&self, draft: ComposerDraft)
async fn restore_from_draft(&self, draft: ComposerDraft)
Restore the state from the given draft.
Restore the relation from the given draft content.
Sourcepub(super) fn set_edit_source(&self, event_id: OwnedEventId, message: &Message)
pub(super) fn set_edit_source(&self, event_id: OwnedEventId, message: &Message)
Update the buffer for the given edit source.
Trait Implementations§
Source§impl Debug for ComposerState
impl Debug for ComposerState
Source§impl Default for ComposerState
impl Default for ComposerState
Source§fn default() -> ComposerState
fn default() -> ComposerState
Source§impl DerivedObjectProperties for ComposerState
impl DerivedObjectProperties for ComposerState
Source§fn derived_properties() -> &'static [ParamSpec]
fn derived_properties() -> &'static [ParamSpec]
Source§fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
ObjectImpl
but auto-generated by the Properties
macro
to allow handling more complex use-cases.Source§fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
ObjectImpl
but auto-generated by the Properties
macro
to allow handling more complex use-cases.Source§impl ObjectImpl for ComposerState
impl ObjectImpl for ComposerState
Source§fn constructed(&self)
fn constructed(&self)
Source§fn properties() -> &'static [ParamSpec]
fn properties() -> &'static [ParamSpec]
Source§fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
Source§fn notify(&self, pspec: &ParamSpec)
fn notify(&self, pspec: &ParamSpec)
self.notify("property")
.fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])
Source§impl ObjectSubclass for ComposerState
impl ObjectSubclass for ComposerState
Source§type ParentType = Object
type ParentType = Object
Source§type Interfaces = ()
type Interfaces = ()
Source§type Class = ClassStruct<ComposerState>
type Class = ClassStruct<ComposerState>
Source§type Instance = InstanceStruct<ComposerState>
type Instance = InstanceStruct<ComposerState>
Source§type Type = ComposerState
type Type = ComposerState
wrapper!
Source§const ALLOW_NAME_CONFLICT: bool = false
const ALLOW_NAME_CONFLICT: bool = false
Source§fn type_init(_type_: &mut InitializingType<Self>)
fn type_init(_type_: &mut InitializingType<Self>)
Source§fn class_init(_klass: &mut Self::Class)
fn class_init(_klass: &mut Self::Class)
Source§fn with_class(_klass: &Self::Class) -> Self
fn with_class(_klass: &Self::Class) -> Self
Source§fn instance_init(_obj: &InitializingObject<Self>)
fn instance_init(_obj: &InitializingObject<Self>)
Auto Trait Implementations§
impl !Freeze for ComposerState
impl !RefUnwindSafe for ComposerState
impl !Send for ComposerState
impl !Sync for ComposerState
impl Unpin for ComposerState
impl !UnwindSafe for ComposerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
Source§fn parent_constructed(&self)
fn parent_constructed(&self)
glib::Object::constructed()
.Source§fn parent_notify(&self, pspec: &ParamSpec)
fn parent_notify(&self, pspec: &ParamSpec)
glib::Object::notify()
.Source§fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
glib::Object::dispatch_properties_changed()
.Source§fn signal_chain_from_overridden(
&self,
token: &SignalClassHandlerToken,
values: &[Value],
) -> Option<Value>
fn signal_chain_from_overridden( &self, token: &SignalClassHandlerToken, values: &[Value], ) -> Option<Value>
Source§impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
Source§fn instance(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn instance(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Source§fn from_instance(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_instance(obj: &<T as ObjectSubclass>::Type) -> &T
Source§fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Source§fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
Source§fn ref_counted(&self) -> ObjectImplRef<T>
fn ref_counted(&self) -> ObjectImplRef<T>
self
.