summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Heiko Voigt <hvoigt@hvoigt.net>2011-02-13 14:50:38 +0100
committerLibravatar Pat Thoyts <patthoyts@users.sourceforge.net>2011-02-14 12:10:54 +0000
commite8db4035df29edc29815ac9a374d0e3dfb8ef329 (patch)
tree6408438e0986b35866bfd918d297860a242d6fba
parentgit-gui: always default to the last merged branch in remote delete (diff)
downloadtgif-e8db4035df29edc29815ac9a374d0e3dfb8ef329.tar.xz
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>
-rw-r--r--lib/remote.tcl40
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/remote.tcl b/lib/remote.tcl
index 1383e9786c..cf2fc9501d 100644
--- a/lib/remote.tcl
+++ b/lib/remote.tcl
@@ -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} {
}
}
+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