rb-notifu 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rb-notifu.rb +38 -16
  2. data/lib/rb-notifu/version.rb +1 -1
  3. metadata +5 -5
@@ -17,7 +17,7 @@ module RbNotifu
17
17
 
18
18
  @option_default = {
19
19
  :type => :info,
20
- :display => 3000,
20
+ :display => 1000,
21
21
  :title => "rb-notifu",
22
22
  :message => " ",
23
23
  :icon => false,
@@ -27,6 +27,38 @@ module RbNotifu
27
27
  :xp => false
28
28
  }
29
29
 
30
+ # There was an error in one the argument or some required argument was missing.
31
+ ERROR_ARGUMENT = 1
32
+
33
+ # IUserNotification class object or interface is not supported on this version of Windows.
34
+ ERROR_NOT_SUPPORTED = 5
35
+
36
+ # There was some unexpected error.
37
+ ERROR_UNEXPECTED = 256
38
+
39
+ ERRORS = [ERROR_ARGUMENT, ERROR_NOT_SUPPORTED, ERROR_UNEXPECTED]
40
+
41
+ # Registry was succesfully edited. Only returned when /e is used with no other argument.
42
+ SUCCESS_REGISTRY = 0
43
+
44
+ # The balloon timed out waiting. The user didn't click the close button or the balloon itself.
45
+ SUCCESS_TIMEOUT = 2
46
+
47
+ # The user clicked the balloon.
48
+ SUCCESS_CLICK = 3
49
+
50
+ # The user closed the balloon using the X in the top right corner.
51
+ SUCCESS_CLOSE = 4
52
+
53
+ # The user clicked with the right mouse button on the icon, in the system notification area (Vista and later)
54
+ SUCCESS_RIGHT = 6
55
+
56
+ # The user clicked with the left mouse button on the icon, in the system notification area (Vista and later)
57
+ SUCCESS_LEFT = 7
58
+
59
+ # A new instance of Notifu dismissed a running instace
60
+ SUCCESS_NEW_INSTANCE = 8
61
+
30
62
  #Params:
31
63
  # :type The type of message to display values are:
32
64
  # info The message is an informational message
@@ -40,19 +72,7 @@ module RbNotifu
40
72
  # :nosound Do not play a sound when the tooltip is displayed
41
73
  # :noquiet Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
42
74
  # :xp Use IUserNotification interface event when IUserNotification2 is available
43
- #
44
- #Returns
45
- # 0 Registry was succesfully edited. Only returned when /e is used with no other argument.
46
- # 1 There was an error in one the argument or some required argument was missing.
47
- # 2 The balloon timed out waiting. The user didn't click the close button or the balloon itself.
48
- # 3 The user clicked the balloon.
49
- # 4 The user closed the balloon using the X in the top right corner.
50
- # 5 IUserNotification class object or interface is not supported on this version of Windows.
51
- # 6 The user clicked with the right mouse button on the icon, in the system notification area (Vista and later)
52
- # 7 The user clicked with the left mouse button on the icon, in the system notification area (Vista and later)
53
- # 8 A new instance of Notifu dismissed a running instace
54
- # 255 There was some unexpected error.
55
- def self.show(options = {})
75
+ def self.show(options = {}, &block)
56
76
  flags = ""
57
77
  @option_default.each do |key, value|
58
78
  flag = options.key?(key) ? options[key] : value
@@ -60,8 +80,10 @@ module RbNotifu
60
80
  flags += "/" + @option_to_flag[key] + " " + self.escape(flag) + " "
61
81
  end
62
82
  end
63
- system "#{@executable} #{flags}"
64
- return $?.exitstatus
83
+ Thread.new{
84
+ system "#{@executable} #{flags}"
85
+ block.call($?.exitstatus)
86
+ }
65
87
  end
66
88
 
67
89
  def self.escape(value)
@@ -1,3 +1,3 @@
1
1
  module RbNotifu
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-notifu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
- requirement: &2981976 !ruby/object:Gem::Requirement
17
+ requirement: &15073368 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2981976
25
+ version_requirements: *15073368
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &1989096 !ruby/object:Gem::Requirement
28
+ requirement: &1759716 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *1989096
36
+ version_requirements: *1759716
37
37
  description: Notification system for windows. Trying to be Growl. Ruby wrapper around
38
38
  notifu (http://www.paralint.com/projects/notifu/index.html)
39
39
  email: