pulseaudio 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
+ gem "autogc"
6
7
  gem "wref"
7
8
  gem "gir_ffi"
8
9
  gem "gtk3assist"
@@ -1,40 +1,43 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- datet (0.0.20)
4
+ autogc (0.0.3)
5
+ datet (0.0.21)
5
6
  diff-lcs (1.1.3)
6
- ffi (1.0.11)
7
- gettext (2.3.1)
7
+ ffi (1.2.1)
8
+ gettext (2.3.7)
9
+ levenshtein
8
10
  locale
9
- gir_ffi (0.4.1)
10
- ffi (~> 1.0.8)
11
+ gir_ffi (0.5.0)
12
+ ffi (~> 1.2.0)
11
13
  indentation (~> 0.0.6)
12
- gir_ffi-gtk (0.4.0)
13
- gir_ffi (~> 0.4.0)
14
+ gir_ffi-gtk (0.5.0)
15
+ gir_ffi (~> 0.5.0)
14
16
  git (1.2.5)
15
- gtk3assist (0.0.5)
17
+ gtk3assist (0.0.9)
16
18
  gir_ffi-gtk
17
19
  xml-simple
18
- http2 (0.0.11)
19
- indentation (0.0.6)
20
+ http2 (0.0.13)
21
+ indentation (0.0.7)
20
22
  jeweler (1.8.4)
21
23
  bundler (~> 1.0)
22
24
  git (>= 1.2.5)
23
25
  rake
24
26
  rdoc
25
- json (1.7.5)
26
- knjrbfw (0.0.99)
27
+ json (1.7.7)
28
+ knjrbfw (0.0.101)
27
29
  datet
28
30
  http2
29
31
  php4r
30
32
  tsafe
31
33
  wref
34
+ levenshtein (0.2.2)
32
35
  locale (2.0.8)
33
36
  php4r (0.0.3)
34
37
  datet
35
38
  http2
36
- rake (0.9.2.2)
37
- rdoc (3.12)
39
+ rake (10.0.3)
40
+ rdoc (3.12.1)
38
41
  json (~> 1.4)
39
42
  rspec (2.8.0)
40
43
  rspec-core (~> 2.8.0)
@@ -45,13 +48,14 @@ GEM
45
48
  diff-lcs (~> 1.1.2)
46
49
  rspec-mocks (2.8.0)
47
50
  tsafe (0.0.11)
48
- wref (0.0.5)
49
- xml-simple (1.1.1)
51
+ wref (0.0.6)
52
+ xml-simple (1.1.2)
50
53
 
51
54
  PLATFORMS
52
55
  ruby
53
56
 
54
57
  DEPENDENCIES
58
+ autogc
55
59
  bundler (>= 1.0.0)
56
60
  gettext
57
61
  gir_ffi
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby1.9
2
2
 
3
3
  require "rubygems"
4
- require "pulseaudio"
4
+ require "#{File.dirname(__FILE__)}/../lib/pulseaudio.rb"
5
5
 
6
6
  sinks = PulseAudio::Sink.list
7
7
 
@@ -18,4 +18,6 @@ elsif ARGV[0] == "mute"
18
18
  sinks.each do |sink|
19
19
  sink.mute_toggle if sink.active?
20
20
  end
21
+ else
22
+ puts "Dont know what to do with argument: '#{ARGV[0]}'."
21
23
  end
@@ -146,14 +146,30 @@ class PulseAudio::Gui::Choose_active_sink_gtk3
146
146
  @sicon.set_from_file(icon_filepath)
147
147
  end
148
148
 
149
+ #Runs the given block and doesnt toggle the mute-functionality while it runs.
150
+ def no_mute_toggle
151
+ @no_toggle_event_count = 0 if @no_toggle_event_count == nil
152
+ @no_toggle_event_count += 1
153
+
154
+ begin
155
+ yield
156
+ ensure
157
+ @no_toggle_event_count -= 1
158
+ end
159
+ end
160
+
149
161
  def update_sink_info
150
- if @sink.muted?
151
- @ui["cbSinkMute"].active = true
152
- else
153
- @ui["cbSinkMute"].active = false
162
+ self.no_mute_toggle do
163
+ if @sink.muted?
164
+ puts "Mute is active - set."
165
+ @ui["cbSinkMute"].active = true
166
+ else
167
+ puts "Mute is not active - unset."
168
+ @ui["cbSinkMute"].active = false
169
+ end
170
+
171
+ @ui["adjustmentSinkVolume"].value = @sink.vol_perc.to_f
154
172
  end
155
-
156
- @ui["adjustmentSinkVolume"].value = @sink.vol_perc.to_f
157
173
  end
158
174
 
159
175
  def update_source_info
@@ -190,7 +206,10 @@ class PulseAudio::Gui::Choose_active_sink_gtk3
190
206
  end
191
207
 
192
208
  def on_cbSinkMute_toggled
193
- @sink.mute = @ui["cbSinkMute"].active
209
+ if !@no_toggle_event
210
+ puts "Mute toggle."
211
+ @sink.mute = @ui["cbSinkMute"].active
212
+ end
194
213
  end
195
214
 
196
215
  def on_cbSourceMute_toggled
@@ -72,7 +72,7 @@ class PulseAudio::Sink
72
72
 
73
73
  #This automatically reloads a sink when a 'change'-event appears.
74
74
  PulseAudio::Events.instance.connect(:event => :change, :element => "sink") do |args|
75
- if @@sinks.key?(args[:args][:element_id]) and sink = @@sinks.get(args[:args][:element_id])
75
+ if @@sinks.key?(args[:args][:element_id]) and sink = @@sinks.get!(args[:args][:element_id])
76
76
  sink.reload
77
77
  end
78
78
  end
@@ -76,7 +76,7 @@ class PulseAudio::Source
76
76
 
77
77
  #This automatically reloads a source when a 'change'-event appears.
78
78
  PulseAudio::Events.instance.connect(:event => :change, :element => "source") do |args|
79
- if @@sources.key?(args[:args][:element_id]) and source = @@sources.get(args[:args][:element_id])
79
+ if @@sources.key?(args[:args][:element_id]) and source = @@sources.get!(args[:args][:element_id])
80
80
  source.reload
81
81
  end
82
82
  end
@@ -4,15 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{pulseaudio}
8
- s.version = "0.0.8"
7
+ s.name = "pulseaudio"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-10-19}
13
- s.default_executable = %q{pulseaudio_volume.rb}
14
- s.description = %q{Ruby-library for controlling PulseAudio via 'pactl'.}
15
- s.email = %q{k@spernj.org}
12
+ s.date = "2013-02-24"
13
+ s.description = "Ruby-library for controlling PulseAudio via 'pactl'."
14
+ s.email = "k@spernj.org"
16
15
  s.executables = ["pulseaudio_volume.rb"]
17
16
  s.extra_rdoc_files = [
18
17
  "LICENSE.txt",
@@ -50,16 +49,17 @@ Gem::Specification.new do |s|
50
49
  "test_scripts/choose_active_sink_gtk3.rb",
51
50
  "test_scripts/set_active.rb"
52
51
  ]
53
- s.homepage = %q{http://github.com/kaspernj/pulseaudio}
52
+ s.homepage = "http://github.com/kaspernj/pulseaudio"
54
53
  s.licenses = ["MIT"]
55
54
  s.require_paths = ["lib"]
56
- s.rubygems_version = %q{1.6.2}
57
- s.summary = %q{Ruby-library for controlling PulseAudio.}
55
+ s.rubygems_version = "1.8.25"
56
+ s.summary = "Ruby-library for controlling PulseAudio."
58
57
 
59
58
  if s.respond_to? :specification_version then
60
59
  s.specification_version = 3
61
60
 
62
61
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
+ s.add_runtime_dependency(%q<autogc>, [">= 0"])
63
63
  s.add_runtime_dependency(%q<wref>, [">= 0"])
64
64
  s.add_runtime_dependency(%q<gir_ffi>, [">= 0"])
65
65
  s.add_runtime_dependency(%q<gtk3assist>, [">= 0"])
@@ -70,6 +70,7 @@ Gem::Specification.new do |s|
70
70
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
71
71
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
72
72
  else
73
+ s.add_dependency(%q<autogc>, [">= 0"])
73
74
  s.add_dependency(%q<wref>, [">= 0"])
74
75
  s.add_dependency(%q<gir_ffi>, [">= 0"])
75
76
  s.add_dependency(%q<gtk3assist>, [">= 0"])
@@ -81,6 +82,7 @@ Gem::Specification.new do |s|
81
82
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
82
83
  end
83
84
  else
85
+ s.add_dependency(%q<autogc>, [">= 0"])
84
86
  s.add_dependency(%q<wref>, [">= 0"])
85
87
  s.add_dependency(%q<gir_ffi>, [">= 0"])
86
88
  s.add_dependency(%q<gtk3assist>, [">= 0"])
@@ -29,6 +29,14 @@ describe "Pulseaudio" do
29
29
  end
30
30
 
31
31
  PulseAudio::Sink::Input.auto_redirect_new_inputs_to_default_sink
32
- PulseAudio::Events.instance.join
32
+
33
+ require "timeout"
34
+ begin
35
+ Timeout.timeout(0.1) do
36
+ PulseAudio::Events.instance.join
37
+ end
38
+ rescue Timeout::Error
39
+ #expected.
40
+ end
33
41
  end
34
42
  end
@@ -1,23 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "#{File.realpath(File.dirname(__FILE__))}/../lib/pulseaudio.rb"
4
-
5
- require "rubygems"
6
- require "gir_ffi"
7
- require "gir_ffi-gtk3"
8
- require "gettext"
9
-
10
3
  #Try to load development-version of 'knjrbfw'.
11
4
  begin
12
5
  require "#{File.realpath(File.dirname(__FILE__))}/../../knjrbfw/lib/knjrbfw.rb"
6
+ puts "Loaded custom knjrbfw."
13
7
  rescue LoadError
14
8
  require "knjrbfw"
15
9
  end
16
10
 
17
- Knj.gem_require(:Gtk3assist, "gtk3assist")
11
+ Knj.gem_require([:wref, :gtk3assist, :autogc])
12
+
13
+ require "#{File.realpath(File.dirname(__FILE__))}/../lib/pulseaudio.rb"
14
+
15
+ require "rubygems"
16
+ require "gir_ffi"
17
+ require "gir_ffi-gtk3"
18
+ require "gettext"
19
+
20
+ #Solves memory corruption problem in Ruby 1.9.3.
21
+ Autogc.enable_for_known_buggy_env
18
22
 
19
- Gtk3assist::Threadding.enable_threadding
23
+ #Solves threadding issues with Gir-GTK and MRI Ruby.
24
+ Gtk3assist::Threadding.enable_threadding_if_necessary
20
25
 
26
+ #Shortcut for GetText.
21
27
  def _(str)
22
28
  return GetText._(str)
23
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulseaudio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 +02:00
13
- default_executable: pulseaudio_volume.rb
12
+ date: 2013-02-24 00:00:00.000000000 Z
14
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: autogc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
15
30
  - !ruby/object:Gem::Dependency
16
31
  name: wref
17
- requirement: &22848460 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
18
33
  none: false
19
34
  requirements:
20
35
  - - ! '>='
@@ -22,10 +37,15 @@ dependencies:
22
37
  version: '0'
23
38
  type: :runtime
24
39
  prerelease: false
25
- version_requirements: *22848460
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
26
46
  - !ruby/object:Gem::Dependency
27
47
  name: gir_ffi
28
- requirement: &22847680 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
29
49
  none: false
30
50
  requirements:
31
51
  - - ! '>='
@@ -33,10 +53,15 @@ dependencies:
33
53
  version: '0'
34
54
  type: :runtime
35
55
  prerelease: false
36
- version_requirements: *22847680
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
37
62
  - !ruby/object:Gem::Dependency
38
63
  name: gtk3assist
39
- requirement: &22845380 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
40
65
  none: false
41
66
  requirements:
42
67
  - - ! '>='
@@ -44,10 +69,15 @@ dependencies:
44
69
  version: '0'
45
70
  type: :runtime
46
71
  prerelease: false
47
- version_requirements: *22845380
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
48
78
  - !ruby/object:Gem::Dependency
49
79
  name: gettext
50
- requirement: &22844520 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
51
81
  none: false
52
82
  requirements:
53
83
  - - ! '>='
@@ -55,10 +85,15 @@ dependencies:
55
85
  version: '0'
56
86
  type: :runtime
57
87
  prerelease: false
58
- version_requirements: *22844520
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
59
94
  - !ruby/object:Gem::Dependency
60
95
  name: knjrbfw
61
- requirement: &22843640 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
62
97
  none: false
63
98
  requirements:
64
99
  - - ! '>='
@@ -66,10 +101,15 @@ dependencies:
66
101
  version: '0'
67
102
  type: :runtime
68
103
  prerelease: false
69
- version_requirements: *22843640
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
70
110
  - !ruby/object:Gem::Dependency
71
111
  name: rspec
72
- requirement: &22842620 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
73
113
  none: false
74
114
  requirements:
75
115
  - - ~>
@@ -77,10 +117,15 @@ dependencies:
77
117
  version: 2.8.0
78
118
  type: :development
79
119
  prerelease: false
80
- version_requirements: *22842620
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 2.8.0
81
126
  - !ruby/object:Gem::Dependency
82
127
  name: rdoc
83
- requirement: &22841480 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
84
129
  none: false
85
130
  requirements:
86
131
  - - ~>
@@ -88,10 +133,15 @@ dependencies:
88
133
  version: '3.12'
89
134
  type: :development
90
135
  prerelease: false
91
- version_requirements: *22841480
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '3.12'
92
142
  - !ruby/object:Gem::Dependency
93
143
  name: bundler
94
- requirement: &22840600 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
95
145
  none: false
96
146
  requirements:
97
147
  - - ! '>='
@@ -99,10 +149,15 @@ dependencies:
99
149
  version: 1.0.0
100
150
  type: :development
101
151
  prerelease: false
102
- version_requirements: *22840600
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: 1.0.0
103
158
  - !ruby/object:Gem::Dependency
104
159
  name: jeweler
105
- requirement: &22839720 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
106
161
  none: false
107
162
  requirements:
108
163
  - - ~>
@@ -110,7 +165,12 @@ dependencies:
110
165
  version: 1.8.3
111
166
  type: :development
112
167
  prerelease: false
113
- version_requirements: *22839720
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 1.8.3
114
174
  description: Ruby-library for controlling PulseAudio via 'pactl'.
115
175
  email: k@spernj.org
116
176
  executables:
@@ -150,7 +210,6 @@ files:
150
210
  - test_scripts/choose_active_sink.rb
151
211
  - test_scripts/choose_active_sink_gtk3.rb
152
212
  - test_scripts/set_active.rb
153
- has_rdoc: true
154
213
  homepage: http://github.com/kaspernj/pulseaudio
155
214
  licenses:
156
215
  - MIT
@@ -166,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
225
  version: '0'
167
226
  segments:
168
227
  - 0
169
- hash: 4386632661636528784
228
+ hash: -1739286250182430142
170
229
  required_rubygems_version: !ruby/object:Gem::Requirement
171
230
  none: false
172
231
  requirements:
@@ -175,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
234
  version: '0'
176
235
  requirements: []
177
236
  rubyforge_project:
178
- rubygems_version: 1.6.2
237
+ rubygems_version: 1.8.25
179
238
  signing_key:
180
239
  specification_version: 3
181
240
  summary: Ruby-library for controlling PulseAudio.