Browse Source

git-gui: refactor remote submenu creation into subroutine

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
maint
Heiko Voigt 14 years ago committed by Pat Thoyts
parent
commit
e8db4035df
  1. 40
      lib/remote.tcl

40
lib/remote.tcl

@ -157,22 +157,7 @@ proc add_fetch_entry {r} { @@ -157,22 +157,7 @@ proc add_fetch_entry {r} {
}

if {$enable} {
if {![winfo exists $fetch_m]} {
menu $remove_m
$remote_m insert 0 cascade \
-label [mc "Remove Remote"] \
-menu $remove_m

menu $prune_m
$remote_m insert 0 cascade \
-label [mc "Prune from"] \
-menu $prune_m

menu $fetch_m
$remote_m insert 0 cascade \
-label [mc "Fetch from"] \
-menu $fetch_m
}
make_sure_remote_submenues_exist $remote_m

$fetch_m add command \
-label $r \
@ -222,6 +207,29 @@ proc add_push_entry {r} { @@ -222,6 +207,29 @@ proc add_push_entry {r} {
}
}

proc make_sure_remote_submenues_exist {remote_m} {
set fetch_m $remote_m.fetch
set prune_m $remote_m.prune
set remove_m $remote_m.remove

if {![winfo exists $fetch_m]} {
menu $remove_m
$remote_m insert 0 cascade \
-label [mc "Remove Remote"] \
-menu $remove_m

menu $prune_m
$remote_m insert 0 cascade \
-label [mc "Prune from"] \
-menu $prune_m

menu $fetch_m
$remote_m insert 0 cascade \
-label [mc "Fetch from"] \
-menu $fetch_m
}
}

proc populate_remotes_menu {} {
global all_remotes


Loading…
Cancel
Save