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>
This commit is contained in:
Shawn O. Pearce
2007-10-12 01:34:36 -04:00
parent 24f7c64b21
commit 28e86952dd

View File

@ -7,11 +7,11 @@ field top
field w field w
field w_body ; # Widget holding the center content field w_body ; # Widget holding the center content
field w_next ; # Next button field w_next ; # Next button
field w_quit ; # Quit button
field o_cons ; # Console object (if active) field o_cons ; # Console object (if active)
field w_types ; # List of type buttons in clone field w_types ; # List of type buttons in clone
field w_recentlist ; # Listbox containing recent repositories field w_recentlist ; # Listbox containing recent repositories
field action new ; # What action are we going to perform?
field done 0 ; # Finished picking the repository? field done 0 ; # Finished picking the repository?
field local_path {} ; # Where this repository is locally field local_path {} ; # Where this repository is locally
field origin_url {} ; # Where we are cloning from field origin_url {} ; # Where we are cloning from
@ -65,25 +65,32 @@ constructor pick {} {
pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10 pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
set w_body $w.body set w_body $w.body
set opts $w_body.options
frame $w_body frame $w_body
radiobutton $w_body.new \ text $opts \
-anchor w \ -cursor $::cursor_ptr \
-text [mc "Create New Repository"] \ -relief flat \
-variable @action \ -background [$w_body cget -background] \
-value new -wrap none \
radiobutton $w_body.clone \ -spacing1 5 \
-anchor w \ -width 50 \
-text [mc "Clone Existing Repository"] \ -height 3
-variable @action \ pack $opts -anchor w -fill x
-value clone
radiobutton $w_body.open \ $opts tag conf link_new -foreground blue -underline 1
-anchor w \ $opts tag bind link_new <1> [cb _next new]
-text [mc "Open Existing Repository"] \ $opts insert end [mc "Create New Repository"] link_new
-variable @action \ $opts insert end "\n"
-value open
pack $w_body.new -anchor w -fill x $opts tag conf link_clone -foreground blue -underline 1
pack $w_body.clone -anchor w -fill x $opts tag bind link_clone <1> [cb _next clone]
pack $w_body.open -anchor w -fill x $opts insert end [mc "Clone Existing Repository"] link_clone
$opts insert end "\n"
$opts tag conf link_open -foreground blue -underline 1
$opts tag bind link_open <1> [cb _next open]
$opts insert end [mc "Open Existing Repository"] link_open
$opts insert end "\n"
set sorted_recent [_get_recentrepos] set sorted_recent [_get_recentrepos]
if {[llength $sorted_recent] > 0} { if {[llength $sorted_recent] > 0} {
@ -122,15 +129,11 @@ constructor pick {} {
frame $w.buttons frame $w.buttons
set w_next $w.buttons.next set w_next $w.buttons.next
button $w_next \ set w_quit $w.buttons.quit
-default active \ button $w_quit \
-text [mc "Next >"] \
-command [cb _next]
pack $w_next -side right -padx 5
button $w.buttons.quit \
-text [mc "Quit"] \ -text [mc "Quit"] \
-command exit -command exit
pack $w.buttons.quit -side right -padx 5 pack $w_quit -side right -padx 5
pack $w.buttons -side bottom -fill x -padx 10 -pady 10 pack $w.buttons -side bottom -fill x -padx 10 -pady 10
bind $top <Return> [cb _invoke_next] bind $top <Return> [cb _invoke_next]
@ -214,8 +217,12 @@ method _open_recent {xy} {
_do_open2 $this _do_open2 $this
} }
method _next {} { method _next {action} {
destroy $w_body destroy $w_body
if {![winfo exists $w_next]} {
button $w_next -default active
pack $w_next -side right -padx 5 -before $w_quit
}
_do_$action $this _do_$action $this
} }