lib/sup/modes/inbox-mode.rb in sup-0.0.8 vs lib/sup/modes/inbox-mode.rb in sup-0.1
- old
+ new
@@ -7,16 +7,24 @@
## overwrite toggle_archived with archive
k.add :archive, "Archive thread (remove from inbox)", 'a'
end
def initialize
- super [:inbox], [:inbox]
+ super [:inbox, :sent], { :label => :inbox }
+ raise "can't have more than one!" if defined? @@instance
+ @@instance = self
end
+ def is_relevant? m; m.has_label? :inbox; end
+
+ ## 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
+ def self.instance; @@instance; end
def killable?; false; end
def archive
+ return unless cursor_thread
cursor_thread.remove_label :inbox
hide_thread cursor_thread
regen_text
end
@@ -41,20 +49,9 @@
# show_thread t
# end
def status
super + " #{Index.size} messages in index"
- 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,
- :when_done => (lambda do |num|
- opts[:when_done].call if opts[:when_done]
- BufferManager.flash "Added #{num} threads."
- end)
end
end
end