tin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -0
- data/Rakefile +0 -0
- data/lib/sn.rb +18 -0
- data/lib/sn/notify.rb +29 -0
- metadata +48 -0
data/README
ADDED
File without changes
|
data/Rakefile
ADDED
File without changes
|
data/lib/sn.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'sn/notify.rb'
|
2
|
+
|
3
|
+
Notify.start $0
|
4
|
+
|
5
|
+
at_exit do
|
6
|
+
Notify.stop
|
7
|
+
end
|
8
|
+
|
9
|
+
class Notification
|
10
|
+
def initialize(summary, message="", icon="")
|
11
|
+
@notification = Notify.create summary, message, icon
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
Notify.show @notification
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/sn/notify.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fiddle'
|
2
|
+
|
3
|
+
module Notify
|
4
|
+
def Notify.start(app_name)
|
5
|
+
@dl = DL.dlopen 'libnotify.so'
|
6
|
+
@init = Fiddle::Function.new(@dl['notify_init'], [Fiddle::TYPE_VOIDP],
|
7
|
+
Fiddle::TYPE_INT)
|
8
|
+
@uninit = Fiddle::Function.new(@dl['notify_uninit'], [], Fiddle::TYPE_VOID)
|
9
|
+
@newnot = Fiddle::Function.new(@dl['notify_notification_new'],
|
10
|
+
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
|
11
|
+
Fiddle::TYPE_VOIDP)
|
12
|
+
@shownot = Fiddle::Function.new(@dl['notify_notification_show'],
|
13
|
+
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
|
14
|
+
Fiddle::TYPE_INT)
|
15
|
+
@init.call app_name
|
16
|
+
end
|
17
|
+
|
18
|
+
def Notify.stop
|
19
|
+
@uninit.call
|
20
|
+
end
|
21
|
+
|
22
|
+
def Notify.create(summary, message="", icon="")
|
23
|
+
@newnot.call summary, message, icon
|
24
|
+
end
|
25
|
+
|
26
|
+
def Notify.show(notification)
|
27
|
+
@shownot.call notification, nil
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brian A. Guthrie
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-10 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: An incredibly simple interface to libnotify using Fiddle.
|
15
|
+
email: baguthrie@sbcglobal.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/sn.rb
|
21
|
+
- lib/sn/notify.rb
|
22
|
+
- README
|
23
|
+
- Rakefile
|
24
|
+
homepage: http://github.com/gamma9mu/tin
|
25
|
+
licenses: []
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project: tin
|
44
|
+
rubygems_version: 1.8.11
|
45
|
+
signing_key:
|
46
|
+
specification_version: 3
|
47
|
+
summary: Very simple libnotify access
|
48
|
+
test_files: []
|