Commit b4e3ea995a8175e15c5f0ca296178885f58f5b36

Move singleton and unkillable stuff from InboxMode to MainInboxMode

Now we'll be able to use InboxMode to query subsets of the Inbox.

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
lib/sup/modes/inbox-mode.rb
(0 / 7)
  
1111
1212 def initialize
1313 super [:inbox, :sent, :draft], { :label => :inbox, :skip_killed => true }
14 raise "can't have more than one!" if defined? @@instance
15 @@instance = self
1614 end
17
18 ## label-list-mode wants to be able to raise us if the user selects
19 ## the "inbox" label, so we need to keep our singletonness around
20 def self.instance; @@instance; end
21 def killable?; false; end
2215
2316 def archive
2417 return unless cursor_thread
lib/sup/modes/label-search-results-mode.rb
(1 / 1)
  
2727 case label
2828 when nil
2929 when :inbox
30 BufferManager.raise_to_front InboxMode.instance.buffer
30 BufferManager.raise_to_front MainInboxMode.instance.buffer
3131 else
3232 b, new = BufferManager.spawn_unless_exists("All threads with label '#{label}'") { LabelSearchResultsMode.new [label] }
3333 b.mode.load_threads :num => b.content_height if new
lib/sup/modes/main-inbox-mode.rb
(11 / 0)
  
11module Redwood
22
33class MainInboxMode < InboxMode
4
5 def initialize
6 super
7 raise "can't have more than one!" if defined? @@instance
8 @@instance = self
9 end
10
11 ## label-list-mode wants to be able to raise us if the user selects
12 ## the "inbox" label, so we need to keep our singletonness around
13 def self.instance; @@instance; end
14 def killable?; false; end
415end
516
617end

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment