atspi 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 477e6b15eb78929735b6381e44736750f9486126
4
- data.tar.gz: 1f1a1713e6a298d250ffb7b1b110c681b1b68273
3
+ metadata.gz: f134b1179ffaa409a7a15f004dbcf790e147e941
4
+ data.tar.gz: 000a1c67cd9a54a64d84befaa7d84ae4a7b19feb
5
5
  SHA512:
6
- metadata.gz: dca8e742c4e33109704dc5f75c3db4fe32fbb057b2fe817090c358d8fdf163820de2e0c9f40a4b9ed55dfb0c35e9b1219f3aadeb9de037f7611de1efc5d2e089
7
- data.tar.gz: 71f344c322ae3df19f83adbc52da8b2d0bb41b324eb5f2f06f3d5eb56906de7e323f41af92359406ebcd73d0cd51ebc1d061de11875ba6ad64fa81763c6d29a3
6
+ metadata.gz: 61d40c792858b6ba1ed2b290e47dd415a7c7b1b898edf4fa1453342aa32095dd56fb7756d68915e591feda936c3b045f0a102cde178082d51afc059083d4977d
7
+ data.tar.gz: d8a07bbb02515b5489ba88f759a7408796e5b792e2d009e53394f0fddd50de142add23f755c9460f9aaa0239601f5f3ceb343f26db3f637024a24640bb1eb384
@@ -19,5 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "gir_ffi", "~> 0.10.0"
22
+ spec.add_dependency "ruby-dbus", "~> 0.11.0"
22
23
  spec.add_development_dependency "bundler", "~> 1.8"
23
24
  end
@@ -1,10 +1,19 @@
1
1
  require 'atspi/requires'
2
+ require 'dbus'
2
3
 
3
4
  # ATSPI is the entry point to access accessible objects.
4
5
  module ATSPI
5
6
  class << self
6
7
  extend Forwardable
7
8
 
9
+ # Checks if AT-SPI is activated on the system
10
+ #
11
+ # @return [true,false]
12
+ def available?
13
+ session_bus = DBus::SessionBus.instance
14
+ session_bus.service('org.a11y.Bus').exists?
15
+ end
16
+
8
17
  # Returns all desktops known to AT-SPI.
9
18
  #
10
19
  # @return [Array<Desktop>]
@@ -15,8 +24,12 @@ module ATSPI
15
24
  # @see https://developer.gnome.org/libatspi/stable/libatspi-atspi-registry.html#atspi-get-desktop atspi_get_desktop
16
25
  # @see https://developer.gnome.org/libatspi/stable/libatspi-atspi-registry.html#atspi-get-desktop-count atspi_get_desktop_count
17
26
  def desktops
18
- @desktops ||= Libatspi.get_desktop_count.times.map do |idx|
19
- Desktop.new(Libatspi.get_desktop(idx))
27
+ @desktops ||= if available?
28
+ Libatspi.get_desktop_count.times.map do |idx|
29
+ Desktop.new(Libatspi.get_desktop(idx))
30
+ end
31
+ else
32
+ []
20
33
  end
21
34
  end
22
35
 
@@ -29,7 +42,11 @@ module ATSPI
29
42
  # @example
30
43
  # ATSPI.applications # => [#<ATSPI::Application:0x71d18014 @desktop=0 @name="gnome-terminal-server">, …]
31
44
  def applications(desktop = desktops.first)
32
- desktop.applications
45
+ if desktop
46
+ desktop.applications
47
+ else
48
+ []
49
+ end
33
50
  end
34
51
 
35
52
  #@!method generate_keyboard_event(keyval, keystring, synth_type)
@@ -1,4 +1,4 @@
1
1
  module ATSPI
2
2
  # this library's version
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atspi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Aue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.10.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-dbus
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.11.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.11.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement