From 4343434307dca441cd2dade1ece7c0ef5d4a7de2 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 21 Jan 2007 17:02:25 -0500 Subject: [PATCH] git-gui: Automatically toggle the relevant radio buttons. When the user selects a starting revision from one of our offered popup lists (local branches or tracking branches) or enters in an expression in the expression input field we should automatically activate the corresponding radio button for them. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 87fdce593..593e4fd5a 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1768,16 +1768,26 @@ proc do_create_branch_action {w} { } } +proc radio_selector {varname value args} { + upvar #0 $varname var + set var $value +} + +trace add variable create_branch_head write \ + [list radio_selector create_branch_revtype head] +trace add variable create_branch_trackinghead write \ + [list radio_selector create_branch_revtype tracking] + +trace add variable delete_branch_head write \ + [list radio_selector delete_branch_checktype head] +trace add variable delete_branch_trackinghead write \ + [list radio_selector delete_branch_checktype tracking] + proc do_create_branch {} { global all_heads current_branch repo_config global create_branch_checkout create_branch_revtype global create_branch_head create_branch_trackinghead - set create_branch_checkout 1 - set create_branch_revtype head - set create_branch_head $current_branch - set create_branch_trackinghead {} - set w .branch_editor toplevel $w wm geometry $w "+[winfo rootx .]+[winfo rooty .]" @@ -1863,6 +1873,8 @@ proc do_create_branch {} { bind $w.from.exp_t {focus [tk_focusPrev %W];break} bind $w.from.exp_t {focus [tk_focusNext %W];break} bind $w.from.exp_t "do_create_branch_action $w;break" + bind $w.from.exp_t break + bind $w.from.exp_t {set create_branch_revtype expression} grid columnconfigure $w.from 1 -weight 1 pack $w.from -anchor nw -fill x -pady 5 -padx 5 @@ -1876,6 +1888,10 @@ proc do_create_branch {} { pack $w.postActions.checkout -anchor nw pack $w.postActions -anchor nw -fill x -pady 5 -padx 5 + set create_branch_checkout 1 + set create_branch_head $current_branch + set create_branch_revtype head + bind $w "grab $w; focus $w.desc.name_t" bind $w "destroy $w" bind $w "do_create_branch_action $w;break" @@ -1978,10 +1994,6 @@ proc do_delete_branch {} { global all_heads tracking_branches current_branch global delete_branch_checktype delete_branch_head delete_branch_trackinghead - set delete_branch_checktype head - set delete_branch_head $current_branch - set delete_branch_trackinghead {} - set w .branch_editor toplevel $w wm geometry $w "+[winfo rootx .]+[winfo rooty .]" @@ -2049,6 +2061,9 @@ proc do_delete_branch {} { grid columnconfigure $w.validate 1 -weight 1 pack $w.validate -anchor nw -fill x -pady 5 -padx 5 + set delete_branch_head $current_branch + set delete_branch_checktype head + bind $w "grab $w; focus $w" bind $w "destroy $w" wm title $w "[appname] ([reponame]): Delete Branch" -- 2.26.2