ruby-snarl 0.0.5 → 0.0.6

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.
@@ -140,6 +140,11 @@ native API (using DL).
140
140
  <td>=</td>
141
141
  <td class="context-item-value">3</td>
142
142
  </tr>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">NO_TIMEOUT</td>
145
+ <td>=</td>
146
+ <td class="context-item-value">0</td>
147
+ </tr>
143
148
  </table>
144
149
  </div>
145
150
  </div>
@@ -165,17 +170,20 @@ native API (using DL).
165
170
  <div class="method-description">
166
171
  <p>
167
172
  Create a new snarl message, the only thing you need to send is a title note
168
- that if you decide to send an icon, you must provide the complete path
173
+ that if you decide to send an icon, you must provide the complete path. The
174
+ timeout file has a default value (DEFAULT_TIMEOUT -&gt; 3 seconds) but can
175
+ be set to Snarl::NO_TIMEOUT, to force a manual acknowledgement of the
176
+ notification.
169
177
  </p>
170
178
  <p><a class="source-toggle" href="#"
171
179
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
172
180
  <div class="method-source-code" id="M000001-source">
173
181
  <pre>
174
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 77</span>
175
- 77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
176
- 78: <span class="ruby-ivar">@ss</span> = <span class="ruby-constant">SnarlStruct</span>.<span class="ruby-identifier">malloc</span>
177
- 79: <span class="ruby-identifier">show</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">icon</span>, <span class="ruby-identifier">timeout</span>)
178
- 80: <span class="ruby-keyword kw">end</span>
182
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 80</span>
183
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
184
+ 81: <span class="ruby-ivar">@ss</span> = <span class="ruby-constant">SnarlStruct</span>.<span class="ruby-identifier">malloc</span>
185
+ 82: <span class="ruby-identifier">show</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">icon</span>, <span class="ruby-identifier">timeout</span>)
186
+ 83: <span class="ruby-keyword kw">end</span>
179
187
  </pre>
180
188
  </div>
181
189
  </div>
@@ -193,16 +201,19 @@ that if you decide to send an icon, you must provide the complete path
193
201
  <div class="method-description">
194
202
  <p>
195
203
  a quick and easy method to create a new message, when you don&#8217;t care
196
- to access it again
204
+ to access it again. Note that if you decide to send an icon, you must
205
+ provide the complete path. The timeout file has a default value
206
+ (DEFAULT_TIMEOUT -&gt; 3 seconds) but can be set to Snarl::NO_TIMEOUT, to
207
+ force a manual acknowledgement of the notification.
197
208
  </p>
198
209
  <p><a class="source-toggle" href="#"
199
210
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
200
211
  <div class="method-source-code" id="M000002-source">
201
212
  <pre>
202
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 84</span>
203
- 84: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_message</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
204
- 85: <span class="ruby-constant">Snarl</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">icon</span>, <span class="ruby-identifier">timeout</span>)
205
- 86: <span class="ruby-keyword kw">end</span>
213
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 91</span>
214
+ 91: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_message</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
215
+ 92: <span class="ruby-constant">Snarl</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">icon</span>, <span class="ruby-identifier">timeout</span>)
216
+ 93: <span class="ruby-keyword kw">end</span>
206
217
  </pre>
207
218
  </div>
208
219
  </div>
@@ -226,13 +237,13 @@ string &quot;1.0&quot; format
226
237
  onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
227
238
  <div class="method-source-code" id="M000006-source">
228
239
  <pre>
229
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 114</span>
230
- 114: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
231
- 115: <span class="ruby-identifier">ss</span> = <span class="ruby-constant">SnarlAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">SnarlStruct</span>.<span class="ruby-identifier">malloc</span>
232
- 116: <span class="ruby-identifier">ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_GET_VERSION</span>
233
- 117: <span class="ruby-identifier">version</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">ss</span>)
234
- 118: <span class="ruby-node">&quot;#{version &gt;&gt; 16}.#{version &amp; 0xffff}&quot;</span>
235
- 119: <span class="ruby-keyword kw">end</span>
240
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 128</span>
241
+ 128: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
242
+ 129: <span class="ruby-identifier">ss</span> = <span class="ruby-constant">SnarlAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">SnarlStruct</span>.<span class="ruby-identifier">malloc</span>
243
+ 130: <span class="ruby-identifier">ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_GET_VERSION</span>
244
+ 131: <span class="ruby-identifier">version</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">ss</span>)
245
+ 132: <span class="ruby-node">&quot;#{version &gt;&gt; 16}.#{version &amp; 0xffff}&quot;</span>
246
+ 133: <span class="ruby-keyword kw">end</span>
236
247
  </pre>
237
248
  </div>
238
249
  </div>
@@ -257,11 +268,11 @@ Hide you message &#8212; this is the same as dismissing it
257
268
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
258
269
  <div class="method-source-code" id="M000004-source">
259
270
  <pre>
260
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 101</span>
261
- 101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hide</span>
262
- 102: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_HIDE</span>
263
- 103: <span class="ruby-identifier">send?</span>
264
- 104: <span class="ruby-keyword kw">end</span>
271
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 115</span>
272
+ 115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hide</span>
273
+ 116: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_HIDE</span>
274
+ 117: <span class="ruby-identifier">send?</span>
275
+ 118: <span class="ruby-keyword kw">end</span>
265
276
  </pre>
266
277
  </div>
267
278
  </div>
@@ -272,7 +283,7 @@ Hide you message &#8212; this is the same as dismissing it
272
283
 
273
284
  <div class="method-heading">
274
285
  <a href="#M000003" class="method-signature">
275
- <span class="method-name">update</span><span class="method-args">(title,msg=&quot; &quot;,icon=nil)</span>
286
+ <span class="method-name">update</span><span class="method-args">(title,msg=&quot; &quot;,icon=nil, timeout=DEFAULT_TIMEOUT)</span>
276
287
  </a>
277
288
  </div>
278
289
 
@@ -280,21 +291,27 @@ Hide you message &#8212; this is the same as dismissing it
280
291
  <p>
281
292
  Update an existing message, it will return true/false depending upon
282
293
  success (it will fail if the message has already timed out or been
283
- dismissed)
294
+ dismissed) Note that if you decide to send an icon, you must provide the
295
+ complete path. The timeout file has a default value (DEFAULT_TIMEOUT -&gt;
296
+ 3 seconds) but can be set to Snarl::NO_TIMEOUT, to force a manual
297
+ acknowledgement of the notification.
284
298
  </p>
285
299
  <p><a class="source-toggle" href="#"
286
300
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
287
301
  <div class="method-source-code" id="M000003-source">
288
302
  <pre>
289
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 91</span>
290
- 91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">title</span>,<span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>,<span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>)
291
- 92: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_UPDATE</span>
292
- 93: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">title</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">title</span>)
293
- 94: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">text</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">msg</span>)
294
- 95: <span class="ruby-identifier">icon</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">icon</span>)
295
- 96: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">icon</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">icon</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">icon</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">icon</span>)
296
- 97: <span class="ruby-identifier">send?</span>
297
- 98: <span class="ruby-keyword kw">end</span>
303
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 102</span>
304
+ 102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">title</span>,<span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>,<span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
305
+ 103: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_UPDATE</span>
306
+ 104: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">title</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">title</span>)
307
+ 105: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">text</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">msg</span>)
308
+ 106: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">icon</span>
309
+ 107: <span class="ruby-identifier">icon</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">icon</span>)
310
+ 108: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">icon</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">icon</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">icon</span>.<span class="ruby-identifier">to_s</span>)
311
+ 109: <span class="ruby-keyword kw">end</span>
312
+ 110: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">timeout</span>
313
+ 111: <span class="ruby-identifier">send?</span>
314
+ 112: <span class="ruby-keyword kw">end</span>
298
315
  </pre>
299
316
  </div>
300
317
  </div>
@@ -317,11 +334,11 @@ Check to see if the message is still being displayed
317
334
  onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
318
335
  <div class="method-source-code" id="M000005-source">
319
336
  <pre>
320
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 107</span>
321
- 107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">visible?</span>
322
- 108: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_IS_VISIBLE</span>
323
- 109: <span class="ruby-identifier">send?</span>
324
- 110: <span class="ruby-keyword kw">end</span>
337
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 121</span>
338
+ 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">visible?</span>
339
+ 122: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_IS_VISIBLE</span>
340
+ 123: <span class="ruby-identifier">send?</span>
341
+ 124: <span class="ruby-keyword kw">end</span>
325
342
  </pre>
326
343
  </div>
327
344
  </div>
@@ -346,10 +363,10 @@ Return the internal snarl id
346
363
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
347
364
  <div class="method-source-code" id="M000007-source">
348
365
  <pre>
349
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 123</span>
350
- 123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">id</span>
351
- 124: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">id</span>
352
- 125: <span class="ruby-keyword kw">end</span>
366
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 137</span>
367
+ 137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">id</span>
368
+ 138: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">id</span>
369
+ 139: <span class="ruby-keyword kw">end</span>
353
370
  </pre>
354
371
  </div>
355
372
  </div>
@@ -372,10 +389,10 @@ Send the snarl structure, return the unfiltered result
372
389
  onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
373
390
  <div class="method-source-code" id="M000009-source">
374
391
  <pre>
375
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 142</span>
376
- 142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send</span>
377
- 143: <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@ss</span>)
378
- 144: <span class="ruby-keyword kw">end</span>
392
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 156</span>
393
+ 156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send</span>
394
+ 157: <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@ss</span>)
395
+ 158: <span class="ruby-keyword kw">end</span>
379
396
  </pre>
380
397
  </div>
381
398
  </div>
@@ -398,10 +415,10 @@ Send the snarl structure, return a true/false (interpreted from snarl)
398
415
  onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
399
416
  <div class="method-source-code" id="M000010-source">
400
417
  <pre>
401
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 147</span>
402
- 147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send?</span>
403
- 148: <span class="ruby-operator">!</span><span class="ruby-identifier">send</span>.<span class="ruby-identifier">zero?</span>
404
- 149: <span class="ruby-keyword kw">end</span>
418
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 161</span>
419
+ 161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send?</span>
420
+ 162: <span class="ruby-operator">!</span><span class="ruby-identifier">send</span>.<span class="ruby-identifier">zero?</span>
421
+ 163: <span class="ruby-keyword kw">end</span>
405
422
  </pre>
406
423
  </div>
407
424
  </div>
@@ -425,18 +442,18 @@ the original
425
442
  onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
426
443
  <div class="method-source-code" id="M000008-source">
427
444
  <pre>
428
- <span class="ruby-comment cmt"># File lib/snarl.rb, line 129</span>
429
- 129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-identifier">title</span>,<span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
430
- 130: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">title</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">title</span>)
431
- 131: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">text</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">msg</span>)
432
- 132: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">icon</span>
433
- 133: <span class="ruby-identifier">icon</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">icon</span>)
434
- 134: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">icon</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">icon</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">icon</span>.<span class="ruby-identifier">to_s</span>)
435
- 135: <span class="ruby-keyword kw">end</span>
436
- 136: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">timeout</span>
437
- 137: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_SHOW</span>
438
- 138: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">send</span>
439
- 139: <span class="ruby-keyword kw">end</span>
445
+ <span class="ruby-comment cmt"># File lib/snarl.rb, line 143</span>
446
+ 143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-identifier">title</span>,<span class="ruby-identifier">msg</span>=<span class="ruby-value str">&quot; &quot;</span>, <span class="ruby-identifier">icon</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span>=<span class="ruby-constant">DEFAULT_TIMEOUT</span>)
447
+ 144: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">title</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">title</span>)
448
+ 145: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">text</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">msg</span>)
449
+ 146: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">icon</span>
450
+ 147: <span class="ruby-identifier">icon</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">icon</span>)
451
+ 148: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">icon</span> = <span class="ruby-constant">SnarlAPI</span>.<span class="ruby-identifier">to_cha</span>(<span class="ruby-identifier">icon</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">icon</span>.<span class="ruby-identifier">to_s</span>)
452
+ 149: <span class="ruby-keyword kw">end</span>
453
+ 150: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">timeout</span>
454
+ 151: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">cmd</span> = <span class="ruby-constant">SNARL_SHOW</span>
455
+ 152: <span class="ruby-ivar">@ss</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">send</span>
456
+ 153: <span class="ruby-keyword kw">end</span>
440
457
  </pre>
441
458
  </div>
442
459
  </div>
@@ -1 +1 @@
1
- Mon Aug 07 12:53:22 Eastern Standard Time 2006
1
+ Tue Aug 08 07:48:58 Eastern Standard Time 2006
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 07 12:28:12 Eastern Standard Time 2006</td>
59
+ <td>Tue Aug 08 07:48:53 Eastern Standard Time 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,17 +70,24 @@ class Snarl
70
70
 
71
71
  include SnarlAPI
72
72
  DEFAULT_TIMEOUT = 3
73
+ NO_TIMEOUT = 0
73
74
 
74
75
  # Create a new snarl message, the only thing you need to send is a title
75
76
  # note that if you decide to send an icon, you must provide the complete
76
- # path
77
+ # path. The timeout file has a default value (DEFAULT_TIMEOUT -> 3 seconds)
78
+ # but can be set to Snarl::NO_TIMEOUT, to force a manual acknowledgement
79
+ # of the notification.
77
80
  def initialize(title, msg=" ", icon=nil, timeout=DEFAULT_TIMEOUT)
78
81
  @ss = SnarlStruct.malloc
79
82
  show(title, msg, icon, timeout)
80
83
  end
81
84
 
82
85
  # a quick and easy method to create a new message, when you don't care
83
- # to access it again
86
+ # to access it again.
87
+ # Note that if you decide to send an icon, you must provide the complete
88
+ # path. The timeout file has a default value (DEFAULT_TIMEOUT -> 3 seconds)
89
+ # but can be set to Snarl::NO_TIMEOUT, to force a manual acknowledgement
90
+ # of the notification.
84
91
  def self.show_message(title, msg=" ", icon=nil, timeout=DEFAULT_TIMEOUT)
85
92
  Snarl.new(title, msg, icon, timeout)
86
93
  end
@@ -88,12 +95,19 @@ class Snarl
88
95
  # Update an existing message, it will return true/false depending upon
89
96
  # success (it will fail if the message has already timed out or been
90
97
  # dismissed)
91
- def update(title,msg=" ",icon=nil)
98
+ # Note that if you decide to send an icon, you must provide the complete
99
+ # path. The timeout file has a default value (DEFAULT_TIMEOUT -> 3 seconds)
100
+ # but can be set to Snarl::NO_TIMEOUT, to force a manual acknowledgement
101
+ # of the notification.
102
+ def update(title,msg=" ",icon=nil, timeout=DEFAULT_TIMEOUT)
92
103
  @ss.cmd = SNARL_UPDATE
93
104
  @ss.title = SnarlAPI.to_cha(title)
94
105
  @ss.text = SnarlAPI.to_cha(msg)
95
- icon = File.expand_path(icon)
96
- @ss.icon = SnarlAPI.to_cha(icon) if icon && File.exist?(icon)
106
+ if icon
107
+ icon = File.expand_path(icon)
108
+ @ss.icon = SnarlAPI.to_cha(icon) if File.exist?(icon.to_s)
109
+ end
110
+ @ss.timeout = timeout
97
111
  send?
98
112
  end
99
113
 
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "ruby-snarl"
5
- s.version = "0.0.5"
5
+ s.version = "0.0.6"
6
6
  s.author = "Patrick Hurley"
7
7
  s.email = "phurley@gmail.com"
8
8
  s.homepage = "http://ruby-snarl.rubyforge.org/"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-snarl
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.5
7
- date: 2006-08-07 00:00:00 -04:00
6
+ version: 0.0.6
7
+ date: 2006-08-08 00:00:00 -04:00
8
8
  summary: Snarl (http://www.fullphat.net/snarl.html) is a simple notification system, similar to Growl under OSX. This is a simple pure Ruby wrapper to the native API (using DL).
9
9
  require_paths:
10
10
  - lib