libnotify 0.5.7 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,7 @@ http://github.com/splattael/libnotify/raw/master/libnotify.png
18
18
  notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
19
19
  notify.urgency = :critical # :low, :normal, :critical
20
20
  notify.append = false # default true - append onto existing notification
21
+ notify.transient = true # default false - keep the notifications around after display
21
22
  notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
22
23
  end
23
24
  n.show!
@@ -55,6 +56,7 @@ You'll need libnotify. On Debian just type:
55
56
 
56
57
  * Peter Suschlik (http://github.com/splattael)
57
58
  * Dennis Collective (http://github.com/denniscollective)
59
+ * Daniel Mack (http://github.com/zonque)
58
60
 
59
61
  == License
60
62
 
@@ -15,6 +15,7 @@ module Libnotify
15
15
  # notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
16
16
  # notify.urgency = :critical # :low, :normal, :critical
17
17
  # notify.append = false # default true - append onto existing notification
18
+ # notify.transient = true # default false - keep the notifications around after display
18
19
  # notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
19
20
  # end
20
21
  # n.show!
@@ -6,7 +6,7 @@ module Libnotify
6
6
  include FFI
7
7
 
8
8
  attr_reader :timeout, :icon_path
9
- attr_accessor :summary, :body, :urgency, :append
9
+ attr_accessor :summary, :body, :urgency, :append, :transient
10
10
 
11
11
  class << self
12
12
  # List of globs to icons
@@ -49,6 +49,7 @@ module Libnotify
49
49
  self.urgency = :normal
50
50
  self.timeout = nil
51
51
  self.append = true
52
+ self.transient = false
52
53
  end
53
54
  private :set_defaults
54
55
 
@@ -64,9 +65,12 @@ module Libnotify
64
65
  notify_notification_set_hint_string(notify, "x-canonical-append", "")
65
66
  notify_notification_set_hint_string(notify, "append", "")
66
67
  end
68
+ if transient
69
+ notify_notification_set_hint_uint32(notify, "transient", 1)
70
+ end
67
71
  notify_notification_show(notify, nil)
68
72
  ensure
69
- notify_notification_clear_hints(notify) if append
73
+ notify_notification_clear_hints(notify) if (append || transient)
70
74
  end
71
75
 
72
76
  # @todo Simplify timeout=
@@ -8,9 +8,9 @@ module Libnotify
8
8
  # Workaround for "half-linked" libnotify.so. Does not work on rubinius (no ffi_lib_flags there)!
9
9
  # See: https://bugzilla.redhat.com/show_bug.cgi?id=626852
10
10
  ffi_lib_flags :lazy, :local, :global if respond_to?(:ffi_lib_flags)
11
- ffi_lib %w[libgtk-x11-2.0.so.0 libgtk-x11-2.0.so libgtk-3.so.0 libgtk-3.so],
12
- %w[libgtkmm-2.4.so.1 libgtkmm-2.4.so libgtkmm-3.0.so.1 libgtkmm-3.0.so],
13
- %w[libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so libnotify]
11
+ ffi_lib %w[libgtk-x11-2.0 libgtk-x11-2.0.so.0 libgtk-x11-2.0.so libgtk-3 libgtk-3.so.0 libgtk-3.so],
12
+ %w[libgtkmm-2.4 libgtkmm-2.4.so.1 libgtkmm-2.4.so libgtkmm-3.0 libgtkmm-3.0.so.1 libgtkmm-3.0.so],
13
+ %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
14
14
  attach_functions!
15
15
  rescue LoadError => e
16
16
  warn e.message
@@ -25,6 +25,7 @@ module Libnotify
25
25
  attach_function :notify_notification_set_urgency, [:pointer, :int], :void
26
26
  attach_function :notify_notification_set_timeout, [:pointer, :long], :void
27
27
  attach_function :notify_notification_set_hint_string, [:pointer, :string, :string], :void
28
+ attach_function :notify_notification_set_hint_uint32, [:pointer, :string, :int], :void
28
29
  attach_function :notify_notification_clear_hints, [:pointer], :void
29
30
  attach_function :notify_notification_show, [:pointer, :pointer], :bool
30
31
  end
@@ -1,5 +1,5 @@
1
1
 
2
- SUPPORTED_RUBIES = %w[ree 1.9.2 jruby rbx]
2
+ SUPPORTED_RUBIES = %w[ree 1.9.2 1.9.3 jruby rbx]
3
3
  PLATFORMS = %w[ree rbx]
4
4
  GEMSPEC = Bundler::GemHelper.new(Dir.pwd).gemspec
5
5
 
@@ -1,3 +1,3 @@
1
1
  module Libnotify
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.require_paths = ["lib"]
26
26
 
27
27
  if needs_ffi
28
- s.add_runtime_dependency 'ffi', '= 1.0.9'
28
+ s.add_runtime_dependency 'ffi', '~> 1.0.0'
29
29
  end
30
30
 
31
31
  s.add_development_dependency 'minitest'
@@ -34,6 +34,7 @@ class TestLibnotifyAPI < MiniTest::Unit::TestCase
34
34
  assert_nil libnotify.timeout
35
35
  assert_nil libnotify.icon_path
36
36
  assert libnotify.append
37
+ assert !libnotify.transient
37
38
  end
38
39
 
39
40
  def test_with_options_and_block
@@ -41,12 +42,14 @@ class TestLibnotifyAPI < MiniTest::Unit::TestCase
41
42
  n.body = "overwritten"
42
43
  n.icon_path = "/path/to/icon"
43
44
  n.append = false
45
+ n.transient = true
44
46
  end
45
47
 
46
48
  assert_equal "hello", libnotify.summary
47
49
  assert_equal "overwritten", libnotify.body
48
50
  assert_equal "/path/to/icon", libnotify.icon_path
49
51
  assert !libnotify.append
52
+ assert libnotify.transient
50
53
  end
51
54
 
52
55
  def test_timeout_setter
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libnotify
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 7
10
- version: 0.5.7
9
+ - 9
10
+ version: 0.5.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Suschlik
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-13 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-10-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: ffi
@@ -24,14 +23,14 @@ dependencies:
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
- - - "="
26
+ - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 5
28
+ hash: 23
30
29
  segments:
31
30
  - 1
32
31
  - 0
33
- - 9
34
- version: 1.0.9
32
+ - 0
33
+ version: 1.0.0
35
34
  type: :runtime
36
35
  version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
@@ -91,7 +90,6 @@ files:
91
90
  - test/helper.rb
92
91
  - test/libnotify_io.rb
93
92
  - test/test_libnotify.rb
94
- has_rdoc: true
95
93
  homepage: http://rubygems.org/gems/libnotify
96
94
  licenses: []
97
95
 
@@ -121,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
119
  requirements: []
122
120
 
123
121
  rubyforge_project:
124
- rubygems_version: 1.6.2
122
+ rubygems_version: 1.8.10
125
123
  signing_key:
126
124
  specification_version: 3
127
125
  summary: Ruby bindings for libnotify using FFI