@matheusbsbs / matheus-bagliano / commits / 4343434307
Fork 0

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 <spearce@spearce.org>

Shawn O. Pearce committed Jan 21, 2007 at 17:02 UTC 4343434307dca441cd2dade1ece7c0ef5d4a7de2
1 file changed +24 -9
git-gui.sh
+24 -9
@@ -1768,16 +1768,26 @@ proc do_create_branch_action {w} {
1768 }
1769 }
1770
1771 +proc radio_selector {varname value args} {
1772 + upvar #0 $varname var
1773 + set var $value
1774 +}
1775 +
1776 +trace add variable create_branch_head write \
1777 + [list radio_selector create_branch_revtype head]
1778 +trace add variable create_branch_trackinghead write \
1779 + [list radio_selector create_branch_revtype tracking]
1780 +
1781 +trace add variable delete_branch_head write \
1782 + [list radio_selector delete_branch_checktype head]
1783 +trace add variable delete_branch_trackinghead write \
1784 + [list radio_selector delete_branch_checktype tracking]
1785 +
1786 proc do_create_branch {} {
1787 global all_heads current_branch repo_config
1788 global create_branch_checkout create_branch_revtype
1789 global create_branch_head create_branch_trackinghead
1790
1776 - set create_branch_checkout 1
1777 - set create_branch_revtype head
1778 - set create_branch_head $current_branch
1779 - set create_branch_trackinghead {}
1780 -
1791 set w .branch_editor
1792 toplevel $w
1793 wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
@@ -1863,6 +1873,8 @@ proc do_create_branch {} {
1873 bind $w.from.exp_t <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
1874 bind $w.from.exp_t <Key-Tab> {focus [tk_focusNext %W];break}
1875 bind $w.from.exp_t <Key-Return> "do_create_branch_action $w;break"
1876 + bind $w.from.exp_t <Key-space> break
1877 + bind $w.from.exp_t <Key> {set create_branch_revtype expression}
1878 grid columnconfigure $w.from 1 -weight 1
1879 pack $w.from -anchor nw -fill x -pady 5 -padx 5
1880
@@ -1876,6 +1888,10 @@ proc do_create_branch {} {
1888 pack $w.postActions.checkout -anchor nw
1889 pack $w.postActions -anchor nw -fill x -pady 5 -padx 5
1890
1891 + set create_branch_checkout 1
1892 + set create_branch_head $current_branch
1893 + set create_branch_revtype head
1894 +
1895 bind $w <Visibility> "grab $w; focus $w.desc.name_t"
1896 bind $w <Key-Escape> "destroy $w"
1897 bind $w <Key-Return> "do_create_branch_action $w;break"
@@ -1978,10 +1994,6 @@ proc do_delete_branch {} {
1994 global all_heads tracking_branches current_branch
1995 global delete_branch_checktype delete_branch_head delete_branch_trackinghead
1996
1981 - set delete_branch_checktype head
1982 - set delete_branch_head $current_branch
1983 - set delete_branch_trackinghead {}
1984 -
1997 set w .branch_editor
1998 toplevel $w
1999 wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
@@ -2049,6 +2061,9 @@ proc do_delete_branch {} {
2061 grid columnconfigure $w.validate 1 -weight 1
2062 pack $w.validate -anchor nw -fill x -pady 5 -padx 5
2063
2064 + set delete_branch_head $current_branch
2065 + set delete_branch_checktype head
2066 +
2067 bind $w <Visibility> "grab $w; focus $w"
2068 bind $w <Key-Escape> "destroy $w"
2069 wm title $w "[appname] ([reponame]): Delete Branch"