git-gui: Hide commit related UI during citool --nocommit
If the user started git-gui as "git citool --nocommit" then they don't need the new commit / amend commit radio buttons, or the sign off button in the UI. Rather than use up space with options the user cannot activate they are simply not installed into the UI. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>maint
parent
1e65c6225d
commit
1e02b32e72
100
git-gui.sh
100
git-gui.sh
|
|
@ -2271,23 +2271,25 @@ proc commit_btn_caption {} {
|
||||||
if {[is_enabled multicommit] || [is_enabled singlecommit]} {
|
if {[is_enabled multicommit] || [is_enabled singlecommit]} {
|
||||||
menu .mbar.commit
|
menu .mbar.commit
|
||||||
|
|
||||||
.mbar.commit add radiobutton \
|
if {![is_enabled nocommit]} {
|
||||||
-label [mc "New Commit"] \
|
.mbar.commit add radiobutton \
|
||||||
-command do_select_commit_type \
|
-label [mc "New Commit"] \
|
||||||
-variable selected_commit_type \
|
-command do_select_commit_type \
|
||||||
-value new
|
-variable selected_commit_type \
|
||||||
lappend disable_on_lock \
|
-value new
|
||||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
lappend disable_on_lock \
|
||||||
|
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||||
|
|
||||||
.mbar.commit add radiobutton \
|
.mbar.commit add radiobutton \
|
||||||
-label [mc "Amend Last Commit"] \
|
-label [mc "Amend Last Commit"] \
|
||||||
-command do_select_commit_type \
|
-command do_select_commit_type \
|
||||||
-variable selected_commit_type \
|
-variable selected_commit_type \
|
||||||
-value amend
|
-value amend
|
||||||
lappend disable_on_lock \
|
lappend disable_on_lock \
|
||||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||||
|
|
||||||
.mbar.commit add separator
|
.mbar.commit add separator
|
||||||
|
}
|
||||||
|
|
||||||
.mbar.commit add command -label [mc Rescan] \
|
.mbar.commit add command -label [mc Rescan] \
|
||||||
-command ui_do_rescan \
|
-command ui_do_rescan \
|
||||||
|
|
@ -2329,9 +2331,11 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
|
||||||
|
|
||||||
.mbar.commit add separator
|
.mbar.commit add separator
|
||||||
|
|
||||||
.mbar.commit add command -label [mc "Sign Off"] \
|
if {![is_enabled nocommit]} {
|
||||||
-command do_signoff \
|
.mbar.commit add command -label [mc "Sign Off"] \
|
||||||
-accelerator $M1T-S
|
-command do_signoff \
|
||||||
|
-accelerator $M1T-S
|
||||||
|
}
|
||||||
|
|
||||||
.mbar.commit add command -label [commit_btn_caption] \
|
.mbar.commit add command -label [commit_btn_caption] \
|
||||||
-command do_commit \
|
-command do_commit \
|
||||||
|
|
@ -2657,9 +2661,11 @@ pack .vpane.lower.commarea.buttons.incall -side top -fill x
|
||||||
lappend disable_on_lock \
|
lappend disable_on_lock \
|
||||||
{.vpane.lower.commarea.buttons.incall conf -state}
|
{.vpane.lower.commarea.buttons.incall conf -state}
|
||||||
|
|
||||||
button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
|
if {![is_enabled nocommit]} {
|
||||||
-command do_signoff
|
button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
|
||||||
pack .vpane.lower.commarea.buttons.signoff -side top -fill x
|
-command do_signoff
|
||||||
|
pack .vpane.lower.commarea.buttons.signoff -side top -fill x
|
||||||
|
}
|
||||||
|
|
||||||
button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \
|
button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \
|
||||||
-command do_commit
|
-command do_commit
|
||||||
|
|
@ -2667,15 +2673,10 @@ pack .vpane.lower.commarea.buttons.commit -side top -fill x
|
||||||
lappend disable_on_lock \
|
lappend disable_on_lock \
|
||||||
{.vpane.lower.commarea.buttons.commit conf -state}
|
{.vpane.lower.commarea.buttons.commit conf -state}
|
||||||
|
|
||||||
button .vpane.lower.commarea.buttons.push -text [mc Push] \
|
if {![is_enabled nocommit]} {
|
||||||
-command do_push_anywhere
|
button .vpane.lower.commarea.buttons.push -text [mc Push] \
|
||||||
pack .vpane.lower.commarea.buttons.push -side top -fill x
|
-command do_push_anywhere
|
||||||
|
pack .vpane.lower.commarea.buttons.push -side top -fill x
|
||||||
if {[is_enabled nocommitmsg]} {
|
|
||||||
.vpane.lower.commarea.buttons.signoff configure -state disabled
|
|
||||||
}
|
|
||||||
if {[is_enabled nocommit]} {
|
|
||||||
.vpane.lower.commarea.buttons.push configure -state disabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Commit Message Buffer
|
# -- Commit Message Buffer
|
||||||
|
|
@ -2684,20 +2685,24 @@ frame .vpane.lower.commarea.buffer
|
||||||
frame .vpane.lower.commarea.buffer.header
|
frame .vpane.lower.commarea.buffer.header
|
||||||
set ui_comm .vpane.lower.commarea.buffer.t
|
set ui_comm .vpane.lower.commarea.buffer.t
|
||||||
set ui_coml .vpane.lower.commarea.buffer.header.l
|
set ui_coml .vpane.lower.commarea.buffer.header.l
|
||||||
radiobutton .vpane.lower.commarea.buffer.header.new \
|
|
||||||
-text [mc "New Commit"] \
|
if {![is_enabled nocommit]} {
|
||||||
-command do_select_commit_type \
|
radiobutton .vpane.lower.commarea.buffer.header.new \
|
||||||
-variable selected_commit_type \
|
-text [mc "New Commit"] \
|
||||||
-value new
|
-command do_select_commit_type \
|
||||||
lappend disable_on_lock \
|
-variable selected_commit_type \
|
||||||
[list .vpane.lower.commarea.buffer.header.new conf -state]
|
-value new
|
||||||
radiobutton .vpane.lower.commarea.buffer.header.amend \
|
lappend disable_on_lock \
|
||||||
-text [mc "Amend Last Commit"] \
|
[list .vpane.lower.commarea.buffer.header.new conf -state]
|
||||||
-command do_select_commit_type \
|
radiobutton .vpane.lower.commarea.buffer.header.amend \
|
||||||
-variable selected_commit_type \
|
-text [mc "Amend Last Commit"] \
|
||||||
-value amend
|
-command do_select_commit_type \
|
||||||
lappend disable_on_lock \
|
-variable selected_commit_type \
|
||||||
[list .vpane.lower.commarea.buffer.header.amend conf -state]
|
-value amend
|
||||||
|
lappend disable_on_lock \
|
||||||
|
[list .vpane.lower.commarea.buffer.header.amend conf -state]
|
||||||
|
}
|
||||||
|
|
||||||
label $ui_coml \
|
label $ui_coml \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
|
|
@ -2715,8 +2720,11 @@ proc trace_commit_type {varname args} {
|
||||||
}
|
}
|
||||||
trace add variable commit_type write trace_commit_type
|
trace add variable commit_type write trace_commit_type
|
||||||
pack $ui_coml -side left -fill x
|
pack $ui_coml -side left -fill x
|
||||||
pack .vpane.lower.commarea.buffer.header.amend -side right
|
|
||||||
pack .vpane.lower.commarea.buffer.header.new -side right
|
if {![is_enabled nocommit]} {
|
||||||
|
pack .vpane.lower.commarea.buffer.header.amend -side right
|
||||||
|
pack .vpane.lower.commarea.buffer.header.new -side right
|
||||||
|
}
|
||||||
|
|
||||||
text $ui_comm -background white -foreground black \
|
text $ui_comm -background white -foreground black \
|
||||||
-borderwidth 1 \
|
-borderwidth 1 \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue