ruby-libnotify 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.rdoc +4 -0
- data/CHANGELOG.rdoc +55 -0
- data/COPYING +504 -0
- data/README.rdoc +46 -0
- data/doc/classes/Notify.html +343 -0
- data/doc/classes/Notify.src/M000001.html +39 -0
- data/doc/classes/Notify.src/M000002.html +24 -0
- data/doc/classes/Notify.src/M000003.html +25 -0
- data/doc/classes/Notify.src/M000004.html +24 -0
- data/doc/classes/Notify.src/M000005.html +37 -0
- data/doc/classes/Notify.src/M000006.html +55 -0
- data/doc/classes/Notify/Notification.html +787 -0
- data/doc/classes/Notify/Notification.src/M000007.html +65 -0
- data/doc/classes/Notify/Notification.src/M000008.html +49 -0
- data/doc/classes/Notify/Notification.src/M000009.html +43 -0
- data/doc/classes/Notify/Notification.src/M000010.html +35 -0
- data/doc/classes/Notify/Notification.src/M000011.html +33 -0
- data/doc/classes/Notify/Notification.src/M000012.html +36 -0
- data/doc/classes/Notify/Notification.src/M000013.html +48 -0
- data/doc/classes/Notify/Notification.src/M000014.html +36 -0
- data/doc/classes/Notify/Notification.src/M000015.html +38 -0
- data/doc/classes/Notify/Notification.src/M000016.html +38 -0
- data/doc/classes/Notify/Notification.src/M000017.html +39 -0
- data/doc/classes/Notify/Notification.src/M000018.html +38 -0
- data/doc/classes/Notify/Notification.src/M000019.html +45 -0
- data/doc/classes/Notify/Notification.src/M000020.html +67 -0
- data/doc/classes/Notify/Notification.src/M000021.html +33 -0
- data/doc/classes/Notify/Notification.src/M000022.html +33 -0
- data/doc/classes/Notify/Notification.src/M000023.html +36 -0
- data/doc/classes/Notify/Notification.src/M000024.html +34 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/RNotify_rb.html +102 -0
- data/doc/files/rnotify_c.html +90 -0
- data/doc/fr_class_index.html +27 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +71 -0
- data/doc/index.html +21 -0
- data/doc/rdoc-style.css +299 -0
- data/examples/action.rb +39 -0
- data/examples/attach_to.rb +43 -0
- data/examples/attach_to_status_icon.rb +47 -0
- data/examples/base.rb +29 -0
- data/examples/geometry-hints.rb +37 -0
- data/examples/icon.png +0 -0
- data/examples/info.rb +27 -0
- data/examples/markup.rb +29 -0
- data/examples/multi-actions.rb +44 -0
- data/examples/update.rb +36 -0
- data/examples/urgency.rb +47 -0
- data/examples/xy.rb +32 -0
- data/ext/extconf.rb +67 -0
- data/ext/rnotify.c +814 -0
- data/lib/RNotify.rb +15 -0
- data/setup.rb +1333 -0
- metadata +120 -0
data/examples/action.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
action.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify action example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Gtk.init
|
22
|
+
Notify.init("Test3")
|
23
|
+
|
24
|
+
test = Notify::Notification.new("Test 3", "action test", nil, nil)
|
25
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
26
|
+
test.signal_connect("closed") { Gtk.main_quit }
|
27
|
+
|
28
|
+
test.add_action("Click Me action", "Click Me!", "bye!!") do |action, data|
|
29
|
+
puts "#{action} - #{data}"
|
30
|
+
Gtk.main_quit
|
31
|
+
end
|
32
|
+
|
33
|
+
test.show
|
34
|
+
|
35
|
+
Gtk.main
|
36
|
+
|
37
|
+
test.clear_actions
|
38
|
+
test.close
|
39
|
+
Notify.uninit
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
attach_to.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify attach_to example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Gtk.init
|
22
|
+
Notify.init("Test9")
|
23
|
+
|
24
|
+
win = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
25
|
+
win.signal_connect("destroy") { Gtk.main_quit }
|
26
|
+
|
27
|
+
bt = Gtk::Button.new("Click Me!")
|
28
|
+
|
29
|
+
win.add(bt)
|
30
|
+
win.show_all
|
31
|
+
|
32
|
+
test = Notify::Notification.new("Attach_To", "Do you savvy? :P", nil, nil)
|
33
|
+
test.attach_to(bt)
|
34
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
35
|
+
test.add_action("Attach_To", "Click Me!") { Gtk.main_quit }
|
36
|
+
|
37
|
+
bt.signal_connect("clicked", test) { |wid,data| data.show }
|
38
|
+
|
39
|
+
Gtk.main
|
40
|
+
|
41
|
+
test.clear_actions
|
42
|
+
test.close
|
43
|
+
Notify.uninit
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
attach_to_status_icon.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify attach_to_status_icon example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Gtk.init
|
22
|
+
Notify.init("Test11")
|
23
|
+
|
24
|
+
win = Gtk::Window.new(Gtk::Window::TOPLEVEL)
|
25
|
+
win.signal_connect("destroy") { Gtk.main_quit }
|
26
|
+
|
27
|
+
bt = Gtk::Button.new("Click Me!")
|
28
|
+
|
29
|
+
win.add(bt)
|
30
|
+
win.show_all
|
31
|
+
|
32
|
+
icon = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/icon.png")
|
33
|
+
st = Gtk::StatusIcon.new
|
34
|
+
st.pixbuf=icon
|
35
|
+
|
36
|
+
test = Notify::Notification.new("Attach_To", "Do you savvy? :P", nil, st)
|
37
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
38
|
+
test.pixbuf_icon=icon
|
39
|
+
test.add_action("Attach_To", "Click Me!") { Gtk.main_quit }
|
40
|
+
|
41
|
+
bt.signal_connect("clicked", test) { |wid,data| data.show }
|
42
|
+
|
43
|
+
Gtk.main
|
44
|
+
|
45
|
+
test.clear_actions
|
46
|
+
test.close
|
47
|
+
Notify.uninit
|
data/examples/base.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
base.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify basic example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test1")
|
22
|
+
test = Notify::Notification.new("Test 1", "This is a test", nil, nil)
|
23
|
+
test.timeout= 5000 # 5 seconds
|
24
|
+
test.show
|
25
|
+
|
26
|
+
sleep(5)
|
27
|
+
|
28
|
+
test.close
|
29
|
+
Notify.uninit
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
geometry-hints.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify geometry-hints example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Gtk.init
|
22
|
+
Notify.init("Test10")
|
23
|
+
|
24
|
+
screen = Gdk::Screen.default
|
25
|
+
|
26
|
+
test = Notify::Notification.new("Test10", "This notification point to 150,100", nil, nil)
|
27
|
+
test.geometry_hints(screen, 150, 100)
|
28
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
29
|
+
test.add_action("Action", "Click Me!") { Gtk.main_quit }
|
30
|
+
test.signal_connect("closed") { Gtk.main_quit }
|
31
|
+
test.show
|
32
|
+
|
33
|
+
Gtk.main
|
34
|
+
|
35
|
+
test.clear_actions
|
36
|
+
test.close
|
37
|
+
Notify.uninit
|
data/examples/icon.png
ADDED
Binary file
|
data/examples/info.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
info.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify info example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test8")
|
22
|
+
|
23
|
+
puts "APPLICATION NAME: #{Notify.app_name}\n"
|
24
|
+
puts "SERVER CAPS: #{Notify.server_caps}\n"
|
25
|
+
puts "SERVER INFO: #{Notify.server_info}\n"
|
26
|
+
|
27
|
+
Notify.uninit
|
data/examples/markup.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
markup.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify markup example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test6")
|
22
|
+
|
23
|
+
test = Notify::Notification.new("Test 6", "<b>Markup</b> <u>test</u>\n<i> ...savvy?</i>", nil, nil)
|
24
|
+
test.timeout= 5000 #5 seconds
|
25
|
+
test.show
|
26
|
+
|
27
|
+
sleep(2)
|
28
|
+
test.close
|
29
|
+
Notify.uninit
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
multi-actions.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify multi-actions example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Gtk.init
|
22
|
+
Notify.init("Test4")
|
23
|
+
|
24
|
+
test = Notify::Notification.new("Test 4", "multi actions test", nil, nil)
|
25
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
26
|
+
test.signal_connect("closed") { Gtk.main_quit }
|
27
|
+
|
28
|
+
test.add_action("Click Me action 1", "Click Me! - 1", "bye!! - 1") do |action, data|
|
29
|
+
puts "#{action} - #{data}"
|
30
|
+
Gtk.main_quit
|
31
|
+
end
|
32
|
+
|
33
|
+
test.add_action("Click Me action 2", "Click Me! - 2", "bye!! - 2") do |action, data|
|
34
|
+
puts "#{action} - #{data}"
|
35
|
+
Gtk.main_quit
|
36
|
+
end
|
37
|
+
|
38
|
+
test.show
|
39
|
+
|
40
|
+
Gtk.main
|
41
|
+
|
42
|
+
test.clear_actions
|
43
|
+
test.close
|
44
|
+
Notify.uninit
|
data/examples/update.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
update.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify update example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test2")
|
22
|
+
|
23
|
+
test = Notify::Notification.new("Test 2", "This is a test", nil, nil)
|
24
|
+
test.timeout= Notify::Notification::EXPIRES_NEVER
|
25
|
+
test.show
|
26
|
+
|
27
|
+
sleep(3)
|
28
|
+
|
29
|
+
test.update("Test 2", "Message replaced!", nil)
|
30
|
+
test.timeout=5000 #5 seconds
|
31
|
+
test.show
|
32
|
+
|
33
|
+
sleep(6)
|
34
|
+
|
35
|
+
test.close
|
36
|
+
Notify.uninit
|
data/examples/urgency.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
urgency.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify urgency example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test5")
|
22
|
+
|
23
|
+
test = Notify::Notification.new("Test 5", "urgency test - LOW", nil, nil)
|
24
|
+
test.urgency= Notify::Notification::URGENCY_LOW
|
25
|
+
test.timeout= 3000 #3 seconds
|
26
|
+
test.show
|
27
|
+
|
28
|
+
sleep(3)
|
29
|
+
test.close
|
30
|
+
|
31
|
+
test = Notify::Notification.new("Test 5", "urgency test - NORMAL", nil, nil)
|
32
|
+
test.urgency= Notify::Notification::URGENCY_NORMAL
|
33
|
+
test.timeout= 3000 #3 seconds
|
34
|
+
test.show
|
35
|
+
|
36
|
+
sleep(3)
|
37
|
+
test.close
|
38
|
+
|
39
|
+
test = Notify::Notification.new("Test 5", "urgency test - CRITICAL", nil, nil)
|
40
|
+
test.urgency= Notify::Notification::URGENCY_CRITICAL
|
41
|
+
test.timeout= 3000 #3 seconds
|
42
|
+
test.show
|
43
|
+
|
44
|
+
sleep(3)
|
45
|
+
test.close
|
46
|
+
|
47
|
+
Notify.uninit
|
data/examples/xy.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
|
5
|
+
xy.rb
|
6
|
+
|
7
|
+
Luca Russo <vargolo@gmail.com>
|
8
|
+
Copyright (LGPL) 2006 - 2010
|
9
|
+
|
10
|
+
ruby-libnotify xy example
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'RNotify'
|
16
|
+
rescue LoadError
|
17
|
+
require 'rubygems'
|
18
|
+
require 'RNotify'
|
19
|
+
end
|
20
|
+
|
21
|
+
Notify.init("Test7")
|
22
|
+
|
23
|
+
test = Notify::Notification.new("Test 7", "This notification point to 150,100", nil, nil)
|
24
|
+
test.hint32("x", 150)
|
25
|
+
test.hint32("y", 100)
|
26
|
+
test.timeout= 5000 #5 seconds
|
27
|
+
test.show
|
28
|
+
|
29
|
+
sleep(6)
|
30
|
+
test.clear_hints
|
31
|
+
test.close
|
32
|
+
Notify.uninit
|
data/ext/extconf.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
=begin
|
4
|
+
type=0, DEBUG
|
5
|
+
type=1, RELEASE
|
6
|
+
=end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'pkg-config'
|
10
|
+
rescue LoadError
|
11
|
+
puts "ERROR: no pkg-config.rb file found, please install Ruby/GLib2",
|
12
|
+
"[ http://ruby-gnome2.sourceforge.jp/ ]"
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
$preload = nil
|
17
|
+
type = 1
|
18
|
+
|
19
|
+
def find_gtk2_rb
|
20
|
+
(File.exist?("#{Config::CONFIG["sitelibdir"]}/gtk2.rb") ||
|
21
|
+
File.exist?("#{Config::CONFIG["rubylibdir"]}/gtk2.rb"))
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_status_icon_gtk2
|
25
|
+
if PKGConfig.check_version?("gtk+-2.0", 2, 9, 1) == true
|
26
|
+
$CFLAGS << ' -DHAVE_STATUS_ICON'
|
27
|
+
puts "with GtkStatusIcon.. yes"
|
28
|
+
else
|
29
|
+
puts "with GtkStatusIcon.. no"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def check_geometry_hints_libnotify
|
34
|
+
if PKGConfig.check_version?("libnotify", 0, 4, 1) == true
|
35
|
+
$CFLAGS << ' -DHAVE_GEOMETRY_HINTS'
|
36
|
+
puts "with geometry hints.. yes"
|
37
|
+
else
|
38
|
+
puts "with geometry hints.. no"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def check_closed_reason_libnotify
|
43
|
+
if PKGConfig.check_version?("libnotify", 0, 4, 5) == true
|
44
|
+
$CFLAGS << ' -DHAVE_CLOSED_REASON'
|
45
|
+
puts "with closed reason.. yes"
|
46
|
+
else
|
47
|
+
puts "with closed reason.. no"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if find_gtk2_rb == true
|
52
|
+
if have_library("notify", "notify_init") == true
|
53
|
+
$CFLAGS << ' -DDEBUG' if type == 0
|
54
|
+
$CFLAGS << ' -Wall' << " -I#{Config::CONFIG["sitearchdir"]} " << PKGConfig.cflags("libnotify")
|
55
|
+
$LIBS << ' ' << PKGConfig.libs("libnotify")
|
56
|
+
check_status_icon_gtk2
|
57
|
+
check_geometry_hints_libnotify
|
58
|
+
check_closed_reason_libnotify
|
59
|
+
create_makefile("rnotify")
|
60
|
+
else
|
61
|
+
puts "ERROR: please install libnotify",
|
62
|
+
"[ http://www.galago-project.org/ ]"
|
63
|
+
end
|
64
|
+
else
|
65
|
+
puts "ERROR: no gtk2.rb found, please install Ruby/Gtk2",
|
66
|
+
"[ http://ruby-gnome2.sourceforge.jp/ ]"
|
67
|
+
end
|