Sha256: 16f4c4892b2d79a7db6eb2ce24e457886096052a7867cd878a53d7c0db63fa29

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

# 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
      return 'volume-muted' if @app.mixer.muted?
      if (66..100).cover?(@app.mixer.percent)
        'volume-high'
      elsif (33..65).cover?(@app.mixer.percent)
        'volume-medium'
      else
        'volume-low'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volay-2.0.0 lib/volay/utils.rb
volay-1.2.0 lib/volay/utils.rb