@matheusbsbs / matheus-bagliano / commits / 28e86952dd
Fork 0

git-gui: Change repository browser radio buttons to hyperlinks

Making a user click twice to select which action they want to perform when starting git-gui is just wasting their time. Clicking once on a radio button and then clicking again on the "Next >" button is quite unnecessary. Since the recent repository list is shown as a list of hyperlinks we now offer the 3 basic startup actions as hyperlinks. Clicking on a link will immediately jump to the next UI panel, saving the user time as they don't need to click an additional button. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Oct 12, 2007 at 01:34 UTC 28e86952dd0802315d79f57f666fa2c283d0fbe8
1 file changed +34 -27
lib/choose_repository.tcl
+34 -27
@@ -7,11 +7,11 @@ field top
7 field w
8 field w_body ; # Widget holding the center content
9 field w_next ; # Next button
10 +field w_quit ; # Quit button
11 field o_cons ; # Console object (if active)
12 field w_types ; # List of type buttons in clone
13 field w_recentlist ; # Listbox containing recent repositories
14
14 -field action new ; # What action are we going to perform?
15 field done 0 ; # Finished picking the repository?
16 field local_path {} ; # Where this repository is locally
17 field origin_url {} ; # Where we are cloning from
@@ -65,25 +65,32 @@ constructor pick {} {
65 pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
66
67 set w_body $w.body
68 + set opts $w_body.options
69 frame $w_body
69 - radiobutton $w_body.new \
70 - -anchor w \
71 - -text [mc "Create New Repository"] \
72 - -variable @action \
73 - -value new
74 - radiobutton $w_body.clone \
75 - -anchor w \
76 - -text [mc "Clone Existing Repository"] \
77 - -variable @action \
78 - -value clone
79 - radiobutton $w_body.open \
80 - -anchor w \
81 - -text [mc "Open Existing Repository"] \
82 - -variable @action \
83 - -value open
84 - pack $w_body.new -anchor w -fill x
85 - pack $w_body.clone -anchor w -fill x
86 - pack $w_body.open -anchor w -fill x
70 + text $opts \
71 + -cursor $::cursor_ptr \
72 + -relief flat \
73 + -background [$w_body cget -background] \
74 + -wrap none \
75 + -spacing1 5 \
76 + -width 50 \
77 + -height 3
78 + pack $opts -anchor w -fill x
79 +
80 + $opts tag conf link_new -foreground blue -underline 1
81 + $opts tag bind link_new <1> [cb _next new]
82 + $opts insert end [mc "Create New Repository"] link_new
83 + $opts insert end "\n"
84 +
85 + $opts tag conf link_clone -foreground blue -underline 1
86 + $opts tag bind link_clone <1> [cb _next clone]
87 + $opts insert end [mc "Clone Existing Repository"] link_clone
88 + $opts insert end "\n"
89 +
90 + $opts tag conf link_open -foreground blue -underline 1
91 + $opts tag bind link_open <1> [cb _next open]
92 + $opts insert end [mc "Open Existing Repository"] link_open
93 + $opts insert end "\n"
94
95 set sorted_recent [_get_recentrepos]
96 if {[llength $sorted_recent] > 0} {
@@ -122,15 +129,11 @@ constructor pick {} {
129
130 frame $w.buttons
131 set w_next $w.buttons.next
125 - button $w_next \
126 - -default active \
127 - -text [mc "Next >"] \
128 - -command [cb _next]
129 - pack $w_next -side right -padx 5
130 - button $w.buttons.quit \
132 + set w_quit $w.buttons.quit
133 + button $w_quit \
134 -text [mc "Quit"] \
135 -command exit
133 - pack $w.buttons.quit -side right -padx 5
136 + pack $w_quit -side right -padx 5
137 pack $w.buttons -side bottom -fill x -padx 10 -pady 10
138
139 bind $top <Return> [cb _invoke_next]
@@ -214,8 +217,12 @@ method _open_recent {xy} {
217 _do_open2 $this
218 }
219
217 -method _next {} {
220 +method _next {action} {
221 destroy $w_body
222 + if {![winfo exists $w_next]} {
223 + button $w_next -default active
224 + pack $w_next -side right -padx 5 -before $w_quit
225 + }
226 _do_$action $this
227 }
228