# Gmail sublet file
# Created with sur-0.2
require "gmail"

configure :gmail do |s|
   s.interval = s.config[:interval ] || 120
   s.icon = Subtlext::Icon.new("mail.xbm")
   s.user = s.config[:user]
   s.pass = s.config[:password]
end

on :run do |s|
  begin
    gmail = Gmail.new(s.user, s.pass)
    numb = gmail.inbox.count(:unread)
    gmail.logout
    s.data = s.icon + numb
  rescue => err # Sanitize to prevent unloading
    s.data = "error"
    p err
  end
end
