Subject: Re: [PATCH 2/2] git-gui: fetch/prune all entry appears last

From: Pat Thoyts <[email-masked]>
Date: Thu, 24 Feb 2011 00:09:28 +0000

Heiko Voigt <[email-masked]> writes:

>The user might have got used to the order the remotes appeared previously.
>Lets add the all entry last so the all entry does not confuse previous
>users.
>
>Signed-off-by: Heiko Voigt <[email-masked]>
>---
>
>On Tue, Feb 22, 2011 at 07:36:23PM +0100, Jens Lehmann wrote:
>> 2) I would rather like to see it at the *end* of the submenu, not at the
>>    beginning. Being used to always click on the first menu entry only
>>    to learn that the remote that used to be there got with something
>>    else is kind of surprising ;-)
>
>And this? Disclaimer: Also only superficially tested on OSX.
>
> lib/remote.tcl |   22 ++++++++++------------
> 1 files changed, 10 insertions(+), 12 deletions(-)
>
>diff --git a/lib/remote.tcl b/lib/remote.tcl
>index 18d3d06..5e4e7f4 100644
>--- a/lib/remote.tcl
>+++ b/lib/remote.tcl
>@@ -245,29 +245,27 @@ proc update_all_remotes_menu_entry {} {
> 	set prune_m $remote_m.prune
> 	if {$have_remote > 1} {
> 		make_sure_remote_submenues_exist $remote_m
>-		set index [expr {[$fetch_m type 0] eq "tearoff" ? 1 : 0}]
>-		if {[$fetch_m entrycget $index -label] ne "All"} {
>+		if {[$fetch_m entrycget end -label] ne "All"} {
> 
>-			$fetch_m insert $index separator
>-			$fetch_m insert $index command \
>+			$fetch_m insert end separator
>+			$fetch_m insert end command \
> 				-label "All" \
> 				-command fetch_from_all
> 
>-			$prune_m insert $index separator
>-			$prune_m insert $index command \
>+			$prune_m insert end separator
>+			$prune_m insert end command \
> 				-label "All" \
> 				-command prune_from_all
> 		}
> 	} else {
> 		if {[winfo exists $fetch_m]} {
>-			set index [expr {[$fetch_m type 0] eq "tearoff" ? 1 : 0}]
>-			if {[$fetch_m type end] eq "separator"} {
>+			if {[$fetch_m entrycget end -label] eq "All"} {
> 
>-				delete_from_menu $fetch_m $index
>-				delete_from_menu $fetch_m $index
>+				delete_from_menu $fetch_m end
>+				delete_from_menu $fetch_m end
> 
>-				delete_from_menu $prune_m $index
>-				delete_from_menu $prune_m $index
>+				delete_from_menu $prune_m end
>+				delete_from_menu $prune_m end
> 			}
> 		}
> 	}

This is fine as well. Tested it on windows. Applied to master.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD