Sha256: 8ce9ef5cfa6f8421d695ca5b2707f5acd503ae9995ff14e071d6f47c9e2866bf

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

# Volay module
module Volay
  # Widgets components
  module Widget
    # Events class
    class VolumeControl < Events
      ##
      # When slider have its adjustement value changed
      #
      def on_volume_adjustement_value_changed(widget)
        Thread.new do
          @app.mixer.value = widget.value
          @app.utils.update_status_icon
        end
      end

      ##
      # When mute toggle image is clicked
      #
      def on_toggle_mute_toggled(widget)
        Thread.new do
          @app.mixer.toggle unless (widget.active? && @app.mixer.muted?) ||
                                   (!widget.active? && !@app.mixer.muted?)
          @app.utils.update_status_icon
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volay-2.2.0 lib/volay/widget/volume_control.rb
volay-2.1.0 lib/volay/widget/volume_control.rb