components: Move LoadingState into utils

This commit is contained in:
Kévin Commaille 2023-11-18 14:05:12 +01:00 committed by Kévin Commaille
parent 5e03a39f41
commit 1c4d275394
5 changed files with 19 additions and 19 deletions

View File

@ -3,21 +3,6 @@ use gtk::{glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate
use super::Spinner;
/// The state of a resource that can be loaded.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, glib::Enum)]
#[enum_type(name = "LoadingState")]
pub enum LoadingState {
/// It hasn't been loaded yet.
#[default]
Initial,
/// It is currently loading.
Loading,
/// It has been fully loaded.
Ready,
/// An error occurred while loading it.
Error,
}
mod imp {
use std::cell::Cell;

View File

@ -37,7 +37,7 @@ pub use self::{
editable_avatar::EditableAvatar,
image_paintable::ImagePaintable,
label_with_widgets::{LabelWithWidgets, DEFAULT_PLACEHOLDER},
loading_row::{LoadingRow, LoadingState},
loading_row::LoadingRow,
location_viewer::LocationViewer,
media_content_viewer::{ContentType, MediaContentViewer},
overlapping_avatars::OverlappingAvatars,

View File

@ -15,7 +15,7 @@ use matrix_sdk::{
use tracing::error;
use super::{Event, Member, Membership, Room};
use crate::{components::LoadingState, spawn, spawn_tokio};
use crate::{spawn, spawn_tokio, utils::LoadingState};
mod imp {
use std::cell::{Cell, RefCell};

View File

@ -3,9 +3,9 @@ use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use super::MembershipSubpageItem;
use crate::{
components::{LoadingRow, LoadingState},
components::LoadingRow,
session::model::MemberList,
utils::BoundObjectWeakRef,
utils::{BoundObjectWeakRef, LoadingState},
};
mod imp {

View File

@ -392,3 +392,18 @@ impl<T> Drop for TokioDrop<T> {
}
}
}
/// The state of a resource that can be loaded.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, glib::Enum)]
#[enum_type(name = "LoadingState")]
pub enum LoadingState {
/// It hasn't been loaded yet.
#[default]
Initial,
/// It is currently loading.
Loading,
/// It has been fully loaded.
Ready,
/// An error occurred while loading it.
Error,
}