Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] toggle killed status
@ 2011-04-24  0:46 Evan Hanson
  2011-06-20 23:01 ` Hamish Downer
  0 siblings, 1 reply; 2+ messages in thread
From: Evan Hanson @ 2011-04-24  0:46 UTC (permalink / raw)
  To: sup-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 203 bytes --]

Attached allows toggling 'killed' status of a thread. If there was a way to do
this previously, please ignore.

UpdateManager didn't seem responsive to 'killed'/'unkilled' so uses 'labeled'.

Evan

[-- Attachment #1.1.2: toggle-killed-status.patch --]
[-- Type: application/octet-stream, Size: 1464 bytes --]

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 11548c7..943065e 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -473,23 +473,35 @@ EOS
 
   ## m-m-m-m-MULTI-KILL
   def multi_kill threads
-    UndoManager.register "killing #{threads.size.pluralize 'thread'}" do
+    UndoManager.register "killing/unkilling #{threads.size.pluralize 'threads'}" do
       threads.each do |t|
-        t.remove_label :killed
-        add_or_unhide t.first
+        if t.toggle_label :killed
+          add_or_unhide t.first
+        else
+          hide_thread t
+        end
+      end.each do |t|
+        UpdateManager.relay self, :labeled, t.first
         Index.save_thread t
       end
       regen_text
     end
 
     threads.each do |t|
-      t.apply_label :killed
-      hide_thread t
+      if t.toggle_label :killed
+        hide_thread t
+      else
+        add_or_unhide t.first
+      end
+    end.each do |t|
+      # send 'labeled'... this might be more specific
+      UpdateManager.relay self, :labeled, t.first
+      Index.save_thread t
     end
 
+    killed, unkilled = threads.partition { |t| t.has_label? :killed }.map(&:size)
+    BufferManager.flash "#{killed.pluralize 'thread'} killed, #{unkilled} unkilled"
     regen_text
-    BufferManager.flash "#{threads.size.pluralize 'thread'} killed."
-    threads.each { |t| Index.save_thread t }
   end
 
   def cleanup

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sup-devel] [PATCH] toggle killed status
  2011-04-24  0:46 [sup-devel] [PATCH] toggle killed status Evan Hanson
@ 2011-06-20 23:01 ` Hamish Downer
  0 siblings, 0 replies; 2+ messages in thread
From: Hamish Downer @ 2011-06-20 23:01 UTC (permalink / raw)
  To: sup-devel

Excerpts from Evan Hanson's message of Sun Apr 24 01:46:59 +0100 2011:
> Attached allows toggling 'killed' status of a thread. If there was a way to do
> this previously, please ignore.

Found while trawling for old patches - applied to next.

Hamish

-- 
Hamish Downer <hamish@foobacca.co.uk>

Web: http://www.foobacca.co.uk/
GPG: B7C48416
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-20 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-24  0:46 [sup-devel] [PATCH] toggle killed status Evan Hanson
2011-06-20 23:01 ` Hamish Downer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox