[gnome-flashback] shell: add level bar to osd window
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] shell: add level bar to osd window
- Date: Sun, 29 Mar 2015 20:45:04 +0000 (UTC)
commit dcf30606bf483a58fceabea308883201c0507c1f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Mar 29 23:00:41 2015 +0300
shell: add level bar to osd window
gnome-flashback/libshell/flashback-osd-window.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gnome-flashback/libshell/flashback-osd-window.c b/gnome-flashback/libshell/flashback-osd-window.c
index d7498ba..e32cce6 100644
--- a/gnome-flashback/libshell/flashback-osd-window.c
+++ b/gnome-flashback/libshell/flashback-osd-window.c
@@ -38,6 +38,8 @@ struct _FlashbackOsdWindow
gint icon_size;
GtkWidget *label;
+
+ GtkWidget *level;
};
G_DEFINE_TYPE (FlashbackOsdWindow, flashback_osd_window, GTK_TYPE_WINDOW)
@@ -240,8 +242,11 @@ flashback_osd_window_init (FlashbackOsdWindow *window)
window->label = gtk_label_new ("");
gtk_widget_set_halign (window->label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (window->label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), window->label, FALSE, FALSE, 0);
+
+ window->level = gtk_level_bar_new_for_interval (0, 100);
+ gtk_widget_set_halign (window->level, GTK_ALIGN_FILL);
+ gtk_box_pack_start (GTK_BOX (box), window->level, FALSE, FALSE, 0);
}
FlashbackOsdWindow *
@@ -312,6 +317,15 @@ void
flashback_osd_window_set_level (FlashbackOsdWindow *window,
gint level)
{
+ if (level == -1)
+ {
+ gtk_widget_hide (window->level);
+ return;
+ }
+
+ level = MAX (0, MIN (level, 100));
+ gtk_level_bar_set_value (GTK_LEVEL_BAR (window->level), level);
+ gtk_widget_show (window->level);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]