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

gitk: Add a user preference to enable/disable use of themed widgets

Also move the hide-remotes option up into the commit display options in the Edit->Preferences panel, since it affects the commit display more than the diff display. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Sep 5, 2009 at 22:06 UTC 0cc08ff7ddaf4360966bdedf006af041cdf6f7d9
1 file changed +26 -10
gitk
+26 -10
@@ -2606,7 +2606,7 @@ proc savestuff {w} {
2606 global cmitmode wrapcomment datetimeformat limitdiffs
2607 global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
2608 global autoselect extdifftool perfile_attrs markbgcolor use_ttk
2609 - global hideremotes
2609 + global hideremotes want_ttk
2610
2611 if {$stuffsaved} return
2612 if {![winfo viewable .]} return
@@ -2630,6 +2630,7 @@ proc savestuff {w} {
2630 puts $f [list set showlocalchanges $showlocalchanges]
2631 puts $f [list set datetimeformat $datetimeformat]
2632 puts $f [list set limitdiffs $limitdiffs]
2633 + puts $f [list set want_ttk $want_ttk]
2634 puts $f [list set bgcolor $bgcolor]
2635 puts $f [list set fgcolor $fgcolor]
2636 puts $f [list set colors $colors]
@@ -10586,7 +10587,7 @@ proc doprefs {} {
10587 global oldprefs prefstop showneartags showlocalchanges
10588 global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
10589 global tabstop limitdiffs autoselect extdifftool perfile_attrs
10589 - global hideremotes
10590 + global hideremotes want_ttk have_ttk
10591
10592 set top .gitkprefs
10593 set prefstop $top
@@ -10595,7 +10596,7 @@ proc doprefs {} {
10596 return
10597 }
10598 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10598 - limitdiffs tabstop perfile_attrs hideremotes} {
10599 + limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
10600 set oldprefs($v) [set $v]
10601 }
10602 ttk_toplevel $top
@@ -10616,6 +10617,9 @@ proc doprefs {} {
10617 ${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
10618 -variable autoselect
10619 grid x $top.autoselect -sticky w
10620 + ${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10621 + -variable hideremotes
10622 + grid x $top.hideremotes -sticky w
10623
10624 ${NS}::label $top.ddisp -text [mc "Diff display options"]
10625 grid $top.ddisp - -sticky w -pady 10
@@ -10625,9 +10629,6 @@ proc doprefs {} {
10629 ${NS}::checkbutton $top.ntag -text [mc "Display nearby tags"] \
10630 -variable showneartags
10631 grid x $top.ntag -sticky w
10628 - ${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10629 - -variable hideremotes
10630 - grid x $top.hideremotes -sticky w
10632 ${NS}::checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
10633 -variable limitdiffs
10634 grid x $top.ldiff -sticky w
@@ -10643,6 +10644,17 @@ proc doprefs {} {
10644 pack configure $top.extdifff.l -padx 10
10645 grid x $top.extdifff $top.extdifft -sticky ew
10646
10647 + ${NS}::label $top.lgen -text [mc "General options"]
10648 + grid $top.lgen - -sticky w -pady 10
10649 + ${NS}::checkbutton $top.want_ttk -variable want_ttk \
10650 + -text [mc "Use themed widgets"]
10651 + if {$have_ttk} {
10652 + ${NS}::label $top.ttk_note -text [mc "(change requires restart)"]
10653 + } else {
10654 + ${NS}::label $top.ttk_note -text [mc "(currently unavailable)"]
10655 + }
10656 + grid x $top.want_ttk $top.ttk_note -sticky w
10657 +
10658 ${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
10659 grid $top.cdisp - -sticky w -pady 10
10660 label $top.bg -padx 40 -relief sunk -background $bgcolor
@@ -10689,7 +10701,8 @@ proc doprefs {} {
10701 if {!$use_ttk} {
10702 foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag
10703 ldiff lattr extdifff.l extdifff.b bgbut fgbut
10692 - diffoldbut diffnewbut hunksepbut markbgbut selbgbut} {
10704 + diffoldbut diffnewbut hunksepbut markbgbut selbgbut
10705 + want_ttk ttk_note} {
10706 $top.$w configure -font optionfont
10707 }
10708 }
@@ -10760,7 +10773,7 @@ proc prefscan {} {
10773 global oldprefs prefstop
10774
10775 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10763 - limitdiffs tabstop perfile_attrs hideremotes} {
10776 + limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
10777 global $v
10778 set $v $oldprefs($v)
10779 }
@@ -11236,6 +11249,7 @@ set limitdiffs 1
11249 set datetimeformat "%Y-%m-%d %H:%M:%S"
11250 set autoselect 1
11251 set perfile_attrs 0
11252 +set want_ttk 1
11253
11254 if {[tk windowingsystem] eq "aqua"} {
11255 set extdifftool "opendiff"
@@ -11372,10 +11386,12 @@ set nullid2 "0000000000000000000000000000000000000001"
11386 set nullfile "/dev/null"
11387
11388 set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
11375 -if {![info exists use_ttk]} {
11376 - set use_ttk [llength [info commands ::ttk::style]]
11389 +if {![info exists have_ttk]} {
11390 + set have_ttk [llength [info commands ::ttk::style]]
11391 }
11392 +set use_ttk [expr {$have_ttk && $want_ttk}]
11393 set NS [expr {$use_ttk ? "ttk" : ""}]
11394 +
11395 set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
11396
11397 set runq {}