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>
Shawn O. Pearce committed
Sep 24, 2008 at 09:48 UTC
1e02b32e7212d4f5f596a7161dc7c5cb76ac965d
1 file changed
+56
-48
git-gui.sh
+56
-48
@@ -2271,23 +2271,25 @@ proc commit_btn_caption {} {
2271
if {[is_enabled multicommit] || [is_enabled singlecommit]} {
2272
menu .mbar.commit
2273
2274
- .mbar.commit add radiobutton \
2275
- -label [mc "New Commit"] \
2276
- -command do_select_commit_type \
2277
- -variable selected_commit_type \
2278
- -value new
2279
- lappend disable_on_lock \
2280
- [list .mbar.commit entryconf [.mbar.commit index last] -state]
2281
-
2282
- .mbar.commit add radiobutton \
2283
- -label [mc "Amend Last Commit"] \
2284
- -command do_select_commit_type \
2285
- -variable selected_commit_type \
2286
- -value amend
2287
- lappend disable_on_lock \
2288
- [list .mbar.commit entryconf [.mbar.commit index last] -state]
2289
-
2290
- .mbar.commit add separator
2274
+ if {![is_enabled nocommit]} {
2275
+ .mbar.commit add radiobutton \
2276
+ -label [mc "New Commit"] \
2277
+ -command do_select_commit_type \
2278
+ -variable selected_commit_type \
2279
+ -value new
2280
+ lappend disable_on_lock \
2281
+ [list .mbar.commit entryconf [.mbar.commit index last] -state]
2282
+
2283
+ .mbar.commit add radiobutton \
2284
+ -label [mc "Amend Last Commit"] \
2285
+ -command do_select_commit_type \
2286
+ -variable selected_commit_type \
2287
+ -value amend
2288
+ lappend disable_on_lock \
2289
+ [list .mbar.commit entryconf [.mbar.commit index last] -state]
2290
+
2291
+ .mbar.commit add separator
2292
+ }
2293
2294
.mbar.commit add command -label [mc Rescan] \
2295
-command ui_do_rescan \
@@ -2329,9 +2331,11 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
2331
2332
.mbar.commit add separator
2333
2332
- .mbar.commit add command -label [mc "Sign Off"] \
2333
- -command do_signoff \
2334
- -accelerator $M1T-S
2334
+ if {![is_enabled nocommit]} {
2335
+ .mbar.commit add command -label [mc "Sign Off"] \
2336
+ -command do_signoff \
2337
+ -accelerator $M1T-S
2338
+ }
2339
2340
.mbar.commit add command -label [commit_btn_caption] \
2341
-command do_commit \
@@ -2657,9 +2661,11 @@ pack .vpane.lower.commarea.buttons.incall -side top -fill x
2661
lappend disable_on_lock \
2662
{.vpane.lower.commarea.buttons.incall conf -state}
2663
2660
-button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
2661
- -command do_signoff
2662
-pack .vpane.lower.commarea.buttons.signoff -side top -fill x
2664
+if {![is_enabled nocommit]} {
2665
+ button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
2666
+ -command do_signoff
2667
+ pack .vpane.lower.commarea.buttons.signoff -side top -fill x
2668
+}
2669
2670
button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \
2671
-command do_commit
@@ -2667,15 +2673,10 @@ pack .vpane.lower.commarea.buttons.commit -side top -fill x
2673
lappend disable_on_lock \
2674
{.vpane.lower.commarea.buttons.commit conf -state}
2675
2670
-button .vpane.lower.commarea.buttons.push -text [mc Push] \
2671
- -command do_push_anywhere
2672
-pack .vpane.lower.commarea.buttons.push -side top -fill x
2673
-
2674
-if {[is_enabled nocommitmsg]} {
2675
- .vpane.lower.commarea.buttons.signoff configure -state disabled
2676
-}
2677
-if {[is_enabled nocommit]} {
2678
- .vpane.lower.commarea.buttons.push configure -state disabled
2676
+if {![is_enabled nocommit]} {
2677
+ button .vpane.lower.commarea.buttons.push -text [mc Push] \
2678
+ -command do_push_anywhere
2679
+ pack .vpane.lower.commarea.buttons.push -side top -fill x
2680
}
2681
2682
# -- Commit Message Buffer
@@ -2684,20 +2685,24 @@ frame .vpane.lower.commarea.buffer
2685
frame .vpane.lower.commarea.buffer.header
2686
set ui_comm .vpane.lower.commarea.buffer.t
2687
set ui_coml .vpane.lower.commarea.buffer.header.l
2687
-radiobutton .vpane.lower.commarea.buffer.header.new \
2688
- -text [mc "New Commit"] \
2689
- -command do_select_commit_type \
2690
- -variable selected_commit_type \
2691
- -value new
2692
-lappend disable_on_lock \
2693
- [list .vpane.lower.commarea.buffer.header.new conf -state]
2694
-radiobutton .vpane.lower.commarea.buffer.header.amend \
2695
- -text [mc "Amend Last Commit"] \
2696
- -command do_select_commit_type \
2697
- -variable selected_commit_type \
2698
- -value amend
2699
-lappend disable_on_lock \
2700
- [list .vpane.lower.commarea.buffer.header.amend conf -state]
2688
+
2689
+if {![is_enabled nocommit]} {
2690
+ radiobutton .vpane.lower.commarea.buffer.header.new \
2691
+ -text [mc "New Commit"] \
2692
+ -command do_select_commit_type \
2693
+ -variable selected_commit_type \
2694
+ -value new
2695
+ lappend disable_on_lock \
2696
+ [list .vpane.lower.commarea.buffer.header.new conf -state]
2697
+ radiobutton .vpane.lower.commarea.buffer.header.amend \
2698
+ -text [mc "Amend Last Commit"] \
2699
+ -command do_select_commit_type \
2700
+ -variable selected_commit_type \
2701
+ -value amend
2702
+ lappend disable_on_lock \
2703
+ [list .vpane.lower.commarea.buffer.header.amend conf -state]
2704
+}
2705
+
2706
label $ui_coml \
2707
-anchor w \
2708
-justify left
@@ -2715,8 +2720,11 @@ proc trace_commit_type {varname args} {
2720
}
2721
trace add variable commit_type write trace_commit_type
2722
pack $ui_coml -side left -fill x
2718
-pack .vpane.lower.commarea.buffer.header.amend -side right
2719
-pack .vpane.lower.commarea.buffer.header.new -side right
2723
+
2724
+if {![is_enabled nocommit]} {
2725
+ pack .vpane.lower.commarea.buffer.header.amend -side right
2726
+ pack .vpane.lower.commarea.buffer.header.new -side right
2727
+}
2728
2729
text $ui_comm -background white -foreground black \
2730
-borderwidth 1 \