class Redwood::InboxMode

Public Class Methods

instance() click to toggle source

label-list-mode wants to be able to raise us if the user selects the “inbox” label, so we need to keep our singletonness around

# File lib/sup/modes/inbox_mode.rb, line 29
def self.instance; @@instance; end
new() click to toggle source
Calls superclass method
# File lib/sup/modes/inbox_mode.rb, line 12
def initialize
  super [:inbox, :sent, :draft], { :label => :inbox, :skip_killed => true }
  raise "can't have more than one!" if defined? @@instance
  @@instance = self
end

Public Instance Methods

archive() click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 32
def archive
  return unless cursor_thread
  thread = cursor_thread # to make sure lambda only knows about 'old' cursor_thread

  UndoManager.register "archiving thread" do
    thread.apply_label :inbox
    add_or_unhide thread.first
    Index.save_thread thread
  end

  cursor_thread.remove_label :inbox
  hide_thread cursor_thread
  regen_text
  Index.save_thread thread
end
handle_archived_update(sender, m) click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 70
def handle_archived_update sender, m
  t = thread_containing(m) or return
  hide_thread t
  regen_text
end
handle_idle_update(sender, idle_since) click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 76
def handle_idle_update sender, idle_since
  flush_index
end
handle_unarchived_update(sender, m) click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 66
def handle_unarchived_update sender, m
  add_or_unhide m
end
is_relevant?(m;) click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 18
def is_relevant? m; (m.labels & [:spam, :deleted, :killed, :inbox]) == Set.new([:inbox]) end
killable?() click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 30
def killable?; false; end
multi_archive(threads) click to toggle source
# File lib/sup/modes/inbox_mode.rb, line 48
def multi_archive threads
  UndoManager.register "archiving #{threads.size.pluralize 'thread'}" do
    threads.map do |t|
      t.apply_label :inbox
      add_or_unhide t.first
      Index.save_thread t
    end
    regen_text
  end

  threads.each do |t|
    t.remove_label :inbox
    hide_thread t
  end
  regen_text
  threads.each { |t| Index.save_thread t }
end
status() click to toggle source
Calls superclass method
# File lib/sup/modes/inbox_mode.rb, line 80
def status
  super + "    #{Index.size} messages in index"
end