Sha256: 26611c0fe4c124be715f12d09b24a97e2dd852b9ff398ab2f7f70d21cd60e7fb

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

# Volay module
module Volay
  # Widgets components
  module Widget
    # Events class
    class VolumeControl < Events
      ##
      # When system tray window is showed
      #
      def on_system_tray_window_show
        @app.get_object('volume_adjustement')
          .value = @app.mixer.percent
        @app.utils.update_status_icon
      end

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

1 entries across 1 versions & 1 rubygems

Version Path
volay-1.0.0 lib/volay/widget/volume_control.rb