Sha256: b775ce5d68c0a5c6a618a23d5c594b0687d421cd6538010b4bd95a6b59d1b538

Contents?: true

Size: 977 Bytes

Versions: 2

Compression:

Stored size: 977 Bytes

Contents

require 'thread'

module Redwood

class InboxMode < ThreadIndexMode
  register_keymap do |k|
    ## overwrite toggle_archived with archive
    k.add :archive, "Archive thread (remove from inbox)", 'a'
  end

  def initialize
    super [:inbox], [:inbox]
  end

  def killable?; false; end

  def archive
    remove_label_and_hide_thread cursor_thread, :inbox
    regen_text
  end

  def multi_archive threads
    threads.each { |t| remove_label_and_hide_thread t, :inbox }
    regen_text
  end

  def is_relevant? m; m.has_label? :inbox; end

  def load_threads opts={}
    n = opts[:num] || ThreadIndexMode::LOAD_MORE_THREAD_NUM
    load_n_threads_background n, :label => :inbox,
                                 :load_killed => false,
                                 :load_spam => false,
                                 :when_done => (lambda do |num|
      opts[:when_done].call if opts[:when_done]
      BufferManager.flash "Added #{num} threads."
    end)
  end
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sup-0.0.5 lib/sup/modes/inbox-mode.rb
sup-0.0.6 lib/sup/modes/inbox-mode.rb