]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: always use themed Tk (ttk)
authorMark Levedahl <mlevedahl@gmail.com>
Sun, 8 Jun 2025 12:16:34 +0000 (08:16 -0400)
committerMark Levedahl <mlevedahl@gmail.com>
Thu, 17 Jul 2025 03:01:51 +0000 (23:01 -0400)
gitk added the option to used themed Tk (ttk) in 0cc08ff7dd ("gitk: Add
a user preference to enable/disable use of themed widgets", 2009-09-05).
Using ttk had to be optional as Tk 8.4, then in common use, does not
have ttk. ttk is the default when available, so the ttk code paths are
by now very well tested. gitk also has code paths for the older default
widgets, increasing the maintenance burden. Let's make ttk non-optional
to reduce code complexity in later commits.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
gitk

diff --git a/gitk b/gitk
index e4e100a87bd2de00dd5bbad0b15d841e88fe7336..b97300068218c6809d45ef2b6cc036813e05bb1f 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -11669,7 +11669,7 @@ proc create_prefs_page {w} {
 }
 
 proc prefspage_general {notebook} {
-    global NS have_ttk
+    global NS
     global {*}$::config_variables
 
     set page [create_prefs_page $notebook.general]
@@ -11747,14 +11747,6 @@ proc prefspage_general {notebook} {
 
     ${NS}::label $page.lgen -text [mc "General options"] -font mainfontbold
     grid $page.lgen - -sticky w -pady 10
-    ${NS}::checkbutton $page.want_ttk -variable want_ttk \
-        -text [mc "Use themed widgets"]
-    if {$have_ttk} {
-        ${NS}::label $page.ttk_note -text [mc "(change requires restart)"]
-    } else {
-        ${NS}::label $page.ttk_note -text [mc "(currently unavailable)"]
-    }
-    grid x $page.want_ttk $page.ttk_note -sticky w
     return $page
 }
 
@@ -12506,7 +12498,6 @@ set autocopy 0
 set autoselect 1
 set autosellen 40
 set perfile_attrs 0
-set want_ttk 1
 
 if {[tk windowingsystem] eq "aqua"} {
     set extdifftool "opendiff"
@@ -12651,7 +12642,6 @@ set config_variables {
     uifgdisabledcolor
     uifont
     visiblerefs
-    want_ttk
     web_browser
     workingfilescirclecolor
     wrapcomment
@@ -12748,16 +12738,9 @@ set nullid "0000000000000000000000000000000000000000"
 set nullid2 "0000000000000000000000000000000000000001"
 set nullfile "/dev/null"
 
-if {![info exists have_ttk]} {
-    set have_ttk [llength [info commands ::ttk::style]]
-}
-set use_ttk [expr {$have_ttk && $want_ttk}]
-set NS [expr {$use_ttk ? "ttk" : ""}]
-
-if {$use_ttk} {
-    setttkstyle
-}
-
+setttkstyle
+set use_ttk 1
+set NS ttk
 set appname "gitk"
 
 set runq {}