Sha256: e156fbbf6e26d94c08a328d20d900a39c9205392f3101e09b96c50c4b276c675

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

# Volay module
module Volay
  # Utils class
  class Utils
    attr_reader :app

    ##
    # Initialize utils class
    #
    # @param [Gtk::Builder] app Application
    #
    def initialize(app)
      @app = app
    end

    ##
    # Change status icon stock
    #
    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

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
volay-1.0.0 lib/volay/utils.rb
volay-0.7.0 lib/volay/utils.rb
volay-0.6.0 lib/volay/utils.rb
volay-0.5.0 lib/volay/utils.rb
volay-0.4.0 lib/volay/utils.rb
volay-0.3.0 lib/volay/utils.rb
volay-0.2.0 lib/volay/utils.rb