From dc4b377b136a7d83fe59cc6348423da06e1c2f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Wed, 21 Aug 2019 19:29:22 +0200 Subject: [PATCH] Add preliminary set_busy fuinction to activity bar --- include/gds-render/widgets/activity-bar.h | 8 ++++++++ widgets/activity-bar.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/include/gds-render/widgets/activity-bar.h b/include/gds-render/widgets/activity-bar.h index 37ef801..1f35797 100644 --- a/include/gds-render/widgets/activity-bar.h +++ b/include/gds-render/widgets/activity-bar.h @@ -53,6 +53,14 @@ ActivityBar *activity_bar_new(); */ void activity_bar_set_ready(ActivityBar *bar); +/** + * @brief Enable spinner and set \p text. If text is NULL, 'Working...' is displayed + * @param bar Activity bar object + * @param text Text to display, may be NULL + + */ +void activity_bar_set_busy(ActivityBar *bar, const char *text); + G_END_DECLS #endif /* __LAYER_ELEMENT_H__ */ diff --git a/widgets/activity-bar.c b/widgets/activity-bar.c index 94e2474..dccd9d0 100644 --- a/widgets/activity-bar.c +++ b/widgets/activity-bar.c @@ -105,5 +105,11 @@ void activity_bar_set_ready(ActivityBar *bar) gtk_spinner_stop(GTK_SPINNER(bar->spinner)); } +void activity_bar_set_busy(ActivityBar *bar, const char *text) +{ + gtk_label_set_text(GTK_LABEL(bar->label), (text ? text : "Working...")); + gtk_spinner_start(GTK_SPINNER(bar->spinner)); +} + /** @} */