Class: Volay::Utils
- Inherits:
-
Object
- Object
- Volay::Utils
- Defined in:
- lib/volay/utils.rb
Overview
Utils class
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#initialize(app) ⇒ Utils
constructor
Initialize utils class.
- #status_icon ⇒ Object
-
#update_status_icon ⇒ Object
Change status icon stock.
Constructor Details
#initialize(app) ⇒ Utils
Initialize utils class
12 13 14 |
# File 'lib/volay/utils.rb', line 12 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
5 6 7 |
# File 'lib/volay/utils.rb', line 5 def app @app end |
Instance Method Details
#status_icon ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/volay/utils.rb', line 28 def status_icon case @app.mixer.percent when 66..100 icon = 'volume-high' when 33..65 icon = 'volume-medium' when 0..32 icon = 'volume-low' end unless @app.mixer.muted? icon.nil? ? 'volume-muted' : icon end |
#update_status_icon ⇒ Object
Change status icon stock
19 20 21 22 23 24 25 26 |
# File 'lib/volay/utils.rb', line 19 def update_status_icon icon = status_icon @app.get_object('status_icon') .set_stock(icon) @app.get_object('toggle_mute').set_active(@app.mixer.muted?) @app.get_object('toggle_mute_image') .set_stock(icon) end |