Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Minimalist view
@ 2009-06-12 20:46 Marcus Williams
  2009-06-14  1:36 ` Ben Walton
  0 siblings, 1 reply; 6+ messages in thread
From: Marcus Williams @ 2009-06-12 20:46 UTC (permalink / raw)


Adds a keypress to toggle to a minimalist view in thread index mode.
This removes the date, authors and number of threads from the view
leaving more room for labels/snippets
---
 lib/sup/modes/thread-index-mode.rb |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 0bd8110..5fa4f4c 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -45,6 +45,7 @@ EOS
     k.add :apply_to_tagged, "Apply next command to all tagged threads", '+', '='
     k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
     k.add :undo, "Undo the previous action", 'u'
+    k.add :toggle_minimalist, "Toggle minimalist view", '~'
   end
 
   def initialize hidden_labels=[], load_thread_opts={}
@@ -62,6 +63,8 @@ EOS
     @hidden_labels = hidden_labels + LabelManager::HIDDEN_RESERVED_LABELS
     @date_width = DATE_WIDTH
 
+    @minimal = false
+
     @interrupt_search = false
     
     initialize_threads # defines @ts and @ts_mutex
@@ -261,6 +264,11 @@ EOS
     end
   end  
 
+  def toggle_minimalist 
+    @minimal = !@minimal
+    regen_text
+  end
+
   def toggle_starred 
     t = cursor_thread or return
     undo = actually_toggle_starred t
@@ -833,13 +841,25 @@ protected
 
     size_widget_text = sprintf "%#{ @size_widget_width}s", size_widget
 
-    [ 
-      [:tagged_color, @tags.tagged?(t) ? ">" : " "],
-      [:none, sprintf("%#{@date_width}s", date)],
-      (starred ? [:starred_color, "*"] : [:none, " "]),
-    ] +
-      from +
-      [
+
+    if @minimal
+      if size_widget!=""
+        size_widget_text = "+" 
+      else
+        size_widget_text = " " 
+      end
+      line = []
+    else
+      line =  [ 
+                [:tagged_color, @tags.tagged?(t) ? ">" : " "],
+                [:none, sprintf("%#{@date_width}s", date)],
+                (starred ? [:starred_color, "*"] : [:none, " "]),
+              ] + from
+    end
+
+
+    line +
+    [
       [subj_color, size_widget_text],
       [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
       [:to_me_color, dp ? ">" : (p ? '+' : " ")],
-- 
1.5.4.1


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

* [sup-talk] [PATCH] Minimalist view
  2009-06-12 20:46 [sup-talk] [PATCH] Minimalist view Marcus Williams
@ 2009-06-14  1:36 ` Ben Walton
  2009-06-14 13:17   ` Marcus Williams
  2009-06-15 13:50   ` William Morgan
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Walton @ 2009-06-14  1:36 UTC (permalink / raw)


Excerpts from Marcus Williams's message of Fri Jun 12 16:46:32 -0400 2009:
> Adds a keypress to toggle to a minimalist view in thread index mode.
> This removes the date, authors and number of threads from the view
> leaving more room for labels/snippets

This patch looks sound, but I wonder if a Hook might be in order to
make the alternate display customizable?  Not a bad idea at all
though.

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090613/4467445f/attachment.bin>


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

* [sup-talk] [PATCH] Minimalist view
  2009-06-14  1:36 ` Ben Walton
@ 2009-06-14 13:17   ` Marcus Williams
  2009-06-15 13:50   ` William Morgan
  1 sibling, 0 replies; 6+ messages in thread
From: Marcus Williams @ 2009-06-14 13:17 UTC (permalink / raw)


On 14.6.2009, Ben Walton wrote:
> This patch looks sound, but I wonder if a Hook might be in order to
> make the alternate display customizable?  Not a bad idea at all
> though.

Slightly ahead of you :) This is the default view for my next patch
which implements exactly that hook.

I'm just wandering through my local commits and cleaning stuff up for
submission so hopefully a few more to come as well.

Marcus


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

* [sup-talk] [PATCH] Minimalist view
  2009-06-14  1:36 ` Ben Walton
  2009-06-14 13:17   ` Marcus Williams
@ 2009-06-15 13:50   ` William Morgan
  2009-06-15 13:54     ` Ben Walton
  2009-06-16 12:45     ` Marcus Williams
  1 sibling, 2 replies; 6+ messages in thread
From: William Morgan @ 2009-06-15 13:50 UTC (permalink / raw)


Reformatted excerpts from Ben Walton's message of 2009-06-13:
> This patch looks sound, but I wonder if a Hook might be in order to
> make the alternate display customizable?  Not a bad idea at all
> though.

Yeah, I would generally like to have this type of thing done through
hooks, but if a lot of people like this mode then I could integrate it
directly.
-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] [PATCH] Minimalist view
  2009-06-15 13:50   ` William Morgan
@ 2009-06-15 13:54     ` Ben Walton
  2009-06-16 12:45     ` Marcus Williams
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Walton @ 2009-06-15 13:54 UTC (permalink / raw)


Excerpts from William Morgan's message of Mon Jun 15 09:50:37 -0400 2009:

> Yeah, I would generally like to have this type of thing done through
> hooks, but if a lot of people like this mode then I could integrate it
> directly.

What about a Hook with this as the default alternate view if the Hook
isn't set?  I'd also suggest changing the name from minimalist to
alternate, since if there is a hook available, it may not actually be
a minimal view?

Thanks
-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090615/82450fd6/attachment.bin>


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

* [sup-talk] [PATCH] Minimalist view
  2009-06-15 13:50   ` William Morgan
  2009-06-15 13:54     ` Ben Walton
@ 2009-06-16 12:45     ` Marcus Williams
  1 sibling, 0 replies; 6+ messages in thread
From: Marcus Williams @ 2009-06-16 12:45 UTC (permalink / raw)


On 15.6.2009, William Morgan wrote:
> Yeah, I would generally like to have this type of thing done through
> hooks, but if a lot of people like this mode then I could integrate it
> directly.

New patch sent as separate message - renamed to alternative view and
extendable via the hook mechanism.

Marcus


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

end of thread, other threads:[~2009-06-16 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-12 20:46 [sup-talk] [PATCH] Minimalist view Marcus Williams
2009-06-14  1:36 ` Ben Walton
2009-06-14 13:17   ` Marcus Williams
2009-06-15 13:50   ` William Morgan
2009-06-15 13:54     ` Ben Walton
2009-06-16 12:45     ` Marcus Williams

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