Commit 2faef5e2a27492ce9d4dc8fc2d188bca35015256

Sup widget module

Commit diff

lib/amazing/widgets.rb

 
1818require 'amazing/widgets/noop'
1919require 'amazing/widgets/pacman'
2020require 'amazing/widgets/raggle'
21require 'amazing/widgets/sup'
2122
2223module Amazing
2324 module Widgets
toggle raw diff

lib/amazing/widgets/sup.rb

 
1# Copyright (C) 2008 Dag Odenhall <dag.odenhall@gmail.com>
2# Licensed under the Academic Free License version 3.0
3
4require 'amazing/widget'
5
6begin
7 require 'rubygems'
8rescue LoadError
9end
10
11module Amazing
12 module Widgets
13 class Sup < Widget
14 description "Mail count in sup for the specified search terms"
15 dependency "sup", "gem install sup, http://sup.rubyforge.org/"
16 option :terms, "Search terms", "label:inbox -label:deleted -label:spam"
17 field :count, "Numer of messages matching search terms"
18 default { @count }
19
20 init do
21 Redwood::Index.new
22 Redwood::Index.load
23 @count = Redwood::Index.index.search_each(@terms) {}
24 end
25 end
26 end
27end
toggle raw diff