libnotify 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +33 -51
- data/README.rdoc +4 -2
- data/VERSION +1 -1
- data/lib/libnotify.rb +11 -2
- data/libnotify.gemspec +2 -2
- data/test/test_libnotify.rb +3 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,51 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- rubyforge:
|
35
|
-
version: 2.0.4
|
36
|
-
- jeweler:
|
37
|
-
version: 1.4.0
|
38
|
-
- rr:
|
39
|
-
version: 0.10.11
|
40
|
-
- term-ansicolor:
|
41
|
-
version: 1.0.5
|
42
|
-
- riot:
|
43
|
-
version: 0.11.2
|
44
|
-
- riot_notifier:
|
45
|
-
version: 0.2.0
|
46
|
-
- yard:
|
47
|
-
version: 0.5.8
|
48
|
-
hash: 6cb15cfba060c9636f2e2b9a7904cd1827b88ade
|
49
|
-
sources:
|
50
|
-
- Rubygems:
|
51
|
-
uri: http://rubygems.org
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ffi (0.6.3)
|
5
|
+
rake (>= 0.8.7)
|
6
|
+
gemcutter (0.6.1)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.4.0)
|
9
|
+
gemcutter (>= 0.1.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rubyforge (>= 2.0.0)
|
12
|
+
json_pure (1.4.6)
|
13
|
+
rake (0.8.7)
|
14
|
+
riot (0.11.2)
|
15
|
+
rr
|
16
|
+
term-ansicolor
|
17
|
+
riot_notifier (0.3.0)
|
18
|
+
riot (~> 0.11.0)
|
19
|
+
rr (1.0.0)
|
20
|
+
rubyforge (2.0.4)
|
21
|
+
json_pure (>= 1.1.7)
|
22
|
+
term-ansicolor (1.0.5)
|
23
|
+
yard (0.6.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
ffi (>= 0.6.2)
|
30
|
+
jeweler
|
31
|
+
riot (= 0.11.2)
|
32
|
+
riot_notifier (>= 0.2.0)
|
33
|
+
yard
|
data/README.rdoc
CHANGED
@@ -15,6 +15,7 @@ RDoc[http://rdoc.info/projects/splattael/libnotify]
|
|
15
15
|
notify.body = "hello"
|
16
16
|
notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
|
17
17
|
notify.urgency = :critical # :low, :normal, :critical
|
18
|
+
notify.append = false # default true - append onto existing notification
|
18
19
|
notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
|
19
20
|
end
|
20
21
|
n.show!
|
@@ -45,8 +46,9 @@ You'll need libnotify. On Debian just type:
|
|
45
46
|
|
46
47
|
== Authors
|
47
48
|
|
48
|
-
* Peter Suschlik
|
49
|
+
* Peter Suschlik (http://github.com/splattael)
|
50
|
+
* Dennis Collective (http://github.com/denniscollective)
|
49
51
|
|
50
52
|
== TODO
|
51
53
|
|
52
|
-
* Mock FFI calls with rrriot. (test/test_libnotify.rb:
|
54
|
+
* Mock FFI calls with rrriot. (test/test_libnotify.rb:61)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/libnotify.rb
CHANGED
@@ -20,7 +20,7 @@ module Libnotify
|
|
20
20
|
# notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
|
21
21
|
# end
|
22
22
|
# n.show!
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# @example Mixed syntax
|
25
25
|
# Libnotify.new(options) do |n|
|
26
26
|
# n.timeout = 1.5 # overrides :timeout in options
|
@@ -77,6 +77,8 @@ module Libnotify
|
|
77
77
|
attach_function :notify_notification_new, [:string, :string, :string, :pointer], :pointer
|
78
78
|
attach_function :notify_notification_set_urgency, [:pointer, :urgency], :void
|
79
79
|
attach_function :notify_notification_set_timeout, [:pointer, :long], :void
|
80
|
+
attach_function :notify_notification_set_hint_string, [:pointer, :string, :string], :void
|
81
|
+
attach_function :notify_notification_clear_hints, [:pointer], :void
|
80
82
|
attach_function :notify_notification_show, [:pointer, :pointer], :bool
|
81
83
|
end
|
82
84
|
|
@@ -84,7 +86,7 @@ module Libnotify
|
|
84
86
|
include FFI
|
85
87
|
|
86
88
|
attr_reader :timeout
|
87
|
-
attr_accessor :summary, :body, :icon_path, :urgency
|
89
|
+
attr_accessor :summary, :body, :icon_path, :urgency, :append
|
88
90
|
|
89
91
|
# Creates a notification object.
|
90
92
|
#
|
@@ -99,6 +101,7 @@ module Libnotify
|
|
99
101
|
self.summary = self.body = ' '
|
100
102
|
self.urgency = :normal
|
101
103
|
self.timeout = nil
|
104
|
+
self.append = true
|
102
105
|
end
|
103
106
|
private :set_defaults
|
104
107
|
|
@@ -110,7 +113,13 @@ module Libnotify
|
|
110
113
|
notify = notify_notification_new(summary, body, icon_path, nil)
|
111
114
|
notify_notification_set_urgency(notify, urgency)
|
112
115
|
notify_notification_set_timeout(notify, timeout || -1)
|
116
|
+
if append
|
117
|
+
notify_notification_set_hint_string(notify, "x-canonical-append", "")
|
118
|
+
notify_notification_set_hint_string(notify, "append", "")
|
119
|
+
end
|
113
120
|
notify_notification_show(notify, nil)
|
121
|
+
ensure
|
122
|
+
notify_notification_clear_hints(notify) if append
|
114
123
|
end
|
115
124
|
|
116
125
|
# @todo Simplify timeout=
|
data/libnotify.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{libnotify}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Suschlik"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-03}
|
13
13
|
s.email = %q{peter-libnotify@suschlik.de}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.rdoc"
|
data/test/test_libnotify.rb
CHANGED
@@ -27,6 +27,7 @@ context Libnotify::API do
|
|
27
27
|
asserts("urgency is :normal") { topic.urgency }.equals(:normal)
|
28
28
|
asserts("timeout is nil") { topic.timeout }.nil
|
29
29
|
asserts("icon_path is nil") { topic.icon_path }.nil
|
30
|
+
asserts("append is true") { topic.append }.equals(true)
|
30
31
|
end
|
31
32
|
|
32
33
|
context "with options and block" do
|
@@ -34,12 +35,14 @@ context Libnotify::API do
|
|
34
35
|
topic.new(:summary => "hello", :body => "body", :invalid_option => 23) do |n|
|
35
36
|
n.body = "overwritten"
|
36
37
|
n.icon_path = "/path/to/icon"
|
38
|
+
n.append = false
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
asserts("summary is set") { topic.summary }.equals("hello")
|
41
43
|
asserts("body was overwritten by block") { topic.body }.equals("overwritten")
|
42
44
|
asserts("icon_path set") { topic.icon_path }.equals("/path/to/icon")
|
45
|
+
asserts("append is set") { topic.append }.equals(false)
|
43
46
|
end
|
44
47
|
|
45
48
|
context "timeout=" do
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Suschlik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-03 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|