Browse Source

loading: Fix visibility

pipelines/786320
Kévin Commaille 1 year ago
parent
commit
5f176df711
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 8
      src/components/loading/bin.rs
  2. 11
      src/components/loading/button.rs

8
src/components/loading/bin.rs

@ -13,15 +13,15 @@ mod imp {
#[properties(wrapper_type = super::LoadingBin)]
pub struct LoadingBin {
#[template_child]
pub stack: TemplateChild<gtk::Stack>,
stack: TemplateChild<gtk::Stack>,
#[template_child]
pub child_bin: TemplateChild<adw::Bin>,
child_bin: TemplateChild<adw::Bin>,
/// The child widget.
#[property(get = Self::child, set = Self::set_child, explicit_notify, nullable)]
pub child: PhantomData<Option<gtk::Widget>>,
child: PhantomData<Option<gtk::Widget>>,
/// Whether this is showing the spinner.
#[property(get = Self::is_loading, set = Self::set_is_loading, explicit_notify)]
pub is_loading: PhantomData<bool>,
is_loading: PhantomData<bool>,
}
#[glib::object_subclass]

11
src/components/loading/button.rs

@ -11,22 +11,22 @@ mod imp {
#[derive(Debug, Default, glib::Properties)]
#[properties(wrapper_type = super::LoadingButton)]
pub struct LoadingButton {
pub loading_bin: LoadingBin,
loading_bin: LoadingBin,
/// The label of the content of the button.
///
/// If an icon was set, it is removed.
#[property(get = Self::content_label, set = Self::set_content_label, explicit_notify)]
pub content_label: PhantomData<Option<glib::GString>>,
content_label: PhantomData<Option<glib::GString>>,
/// The name of the icon of the content of the button.
///
/// If a label was set, it is removed.
#[property(get = Self::content_icon_name, set = Self::set_content_icon_name, explicit_notify)]
pub content_icon_name: PhantomData<Option<glib::GString>>,
content_icon_name: PhantomData<Option<glib::GString>>,
/// Whether to display the loading spinner.
///
/// If this is `false`, the text or icon will be displayed.
#[property(get = Self::is_loading, set = Self::set_is_loading, explicit_notify)]
pub is_loading: PhantomData<bool>,
is_loading: PhantomData<bool>,
}
#[glib::object_subclass]
@ -155,7 +155,8 @@ mod imp {
glib::wrapper! {
/// Button showing either a spinner or a label.
///
/// Use the `content-label` and `content-icon-name` properties instead of `label` and `icon-name` respectively, otherwise the spinner will not appear.
/// Use the `content-label` and `content-icon-name` properties instead of `label` and
/// `icon-name` respectively, otherwise the spinner will not appear.
pub struct LoadingButton(ObjectSubclass<imp::LoadingButton>)
@extends gtk::Widget, gtk::Button, @implements gtk::Accessible, gtk::Actionable;
}

Loading…
Cancel
Save