Skip to content

Commit 9b1c537

Browse files
committed
git-gui: remove non-ttk code
git-gui has code paths to support older non-ttk widgets, but this code is no longer reachable as ttk is always used. Remove that code. Signed-off-by: Mark Levedahl <[email protected]>
1 parent fdc0e3a commit 9b1c537

26 files changed

+70
-219
lines changed

git-gui.sh

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,6 @@ proc apply_config {} {
912912
font configure ${font}italic -slant italic
913913
}
914914

915-
global use_ttk NS
916-
set use_ttk 1
917-
set NS ttk
918915
bind [winfo class .] <<ThemeChanged>> [list InitTheme]
919916
pave_toplevel .
920917
color::sync_with_theme
@@ -2313,7 +2310,7 @@ proc do_quit {{rc {1}}} {
23132310
global ui_comm is_quitting repo_config commit_type
23142311
global GITGUI_BCK_exists GITGUI_BCK_i
23152312
global ui_comm_spell
2316-
global ret_code use_ttk
2313+
global ret_code
23172314

23182315
if {$is_quitting} return
23192316
set is_quitting 1
@@ -2371,13 +2368,8 @@ proc do_quit {{rc {1}}} {
23712368
}
23722369
set cfg_geometry [list]
23732370
lappend cfg_geometry [wm geometry .]
2374-
if {$use_ttk} {
2375-
lappend cfg_geometry [.vpane sashpos 0]
2376-
lappend cfg_geometry [.vpane.files sashpos 0]
2377-
} else {
2378-
lappend cfg_geometry [lindex [.vpane sash coord 0] 0]
2379-
lappend cfg_geometry [lindex [.vpane.files sash coord 0] 1]
2380-
}
2371+
lappend cfg_geometry [.vpane sashpos 0]
2372+
lappend cfg_geometry [.vpane.files sashpos 0]
23812373
if {[catch {set rc_geometry $repo_config(gui.geometry)}]} {
23822374
set rc_geometry {}
23832375
}
@@ -3260,7 +3252,6 @@ default {
32603252
# -- Branch Control
32613253
#
32623254
ttk::frame .branch
3263-
if {!$use_ttk} {.branch configure -borderwidth 1 -relief sunken}
32643255
ttk::label .branch.l1 \
32653256
-text [mc "Current Branch:"] \
32663257
-anchor w \
@@ -3277,11 +3268,7 @@ pack .branch -side top -fill x
32773268
#
32783269
ttk::panedwindow .vpane -orient horizontal
32793270
ttk::panedwindow .vpane.files -orient vertical
3280-
if {$use_ttk} {
3281-
.vpane add .vpane.files
3282-
} else {
3283-
.vpane add .vpane.files -sticky nsew -height 100 -width 200
3284-
}
3271+
.vpane add .vpane.files
32853272
pack .vpane -anchor n -side top -fill both -expand 1
32863273

32873274
# -- Working Directory File List
@@ -3331,10 +3318,6 @@ pack $ui_index -side left -fill both -expand 1
33313318
#
33323319
.vpane.files add .vpane.files.workdir
33333320
.vpane.files add .vpane.files.index
3334-
if {!$use_ttk} {
3335-
.vpane.files paneconfigure .vpane.files.workdir -sticky news
3336-
.vpane.files paneconfigure .vpane.files.index -sticky news
3337-
}
33383321

33393322
proc set_selection_colors {w has_focus} {
33403323
foreach tag [list in_diff in_sel] {
@@ -3361,13 +3344,8 @@ ttk::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500
33613344
.vpane.lower add .vpane.lower.diff
33623345
.vpane.lower add .vpane.lower.commarea
33633346
.vpane add .vpane.lower
3364-
if {$use_ttk} {
3365-
.vpane.lower pane .vpane.lower.diff -weight 1
3366-
.vpane.lower pane .vpane.lower.commarea -weight 0
3367-
} else {
3368-
.vpane.lower paneconfigure .vpane.lower.diff -stretch always
3369-
.vpane.lower paneconfigure .vpane.lower.commarea -stretch never
3370-
}
3347+
.vpane.lower pane .vpane.lower.diff -weight 1
3348+
.vpane.lower pane .vpane.lower.commarea -weight 0
33713349

33723350
# -- Commit Area Buttons
33733351
#
@@ -3888,29 +3866,14 @@ proc on_ttk_pane_mapped {w pane pos} {
38883866
bind $w <Map> {}
38893867
after 0 [list after idle [list $w sashpos $pane $pos]]
38903868
}
3891-
proc on_tk_pane_mapped {w pane x y} {
3892-
bind $w <Map> {}
3893-
after 0 [list after idle [list $w sash place $pane $x $y]]
3894-
}
38953869
proc on_application_mapped {} {
3896-
global repo_config use_ttk
3870+
global repo_config
38973871
bind . <Map> {}
38983872
set gm $repo_config(gui.geometry)
3899-
if {$use_ttk} {
3900-
bind .vpane <Map> \
3901-
[list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
3902-
bind .vpane.files <Map> \
3903-
[list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
3904-
} else {
3905-
bind .vpane <Map> \
3906-
[list on_tk_pane_mapped %W 0 \
3907-
[lindex $gm 1] \
3908-
[lindex [.vpane sash coord 0] 1]]
3909-
bind .vpane.files <Map> \
3910-
[list on_tk_pane_mapped %W 0 \
3911-
[lindex [.vpane.files sash coord 0] 0] \
3912-
[lindex $gm 2]]
3913-
}
3873+
bind .vpane <Map> \
3874+
[list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
3875+
bind .vpane.files <Map> \
3876+
[list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
39143877
wm geometry . [lindex $gm 0]
39153878
}
39163879
if {[info exists repo_config(gui.geometry)]} {

lib/about.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
proc do_about {} {
55
global appvers copyright oguilib
66
global tcl_patchLevel tk_patchLevel
7-
global ui_comm_spell use_ttk
7+
global ui_comm_spell
88

99
set w .about_dialog
1010
Dialog $w

lib/branch_checkout.tcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ field opt_fetch 1; # refetch tracking branch if used?
1010
field opt_detach 0; # force a detached head case?
1111

1212
constructor dialog {} {
13-
global use_ttk
1413
make_dialog top w
1514
wm withdraw $w
1615
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]

lib/branch_create.tcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ field opt_fetch 1; # refetch tracking branch if used?
1616
field reset_ok 0; # did the user agree to reset?
1717

1818
constructor dialog {} {
19-
global repo_config use_ttk
19+
global repo_config
2020

2121
make_dialog top w
2222
wm withdraw $w
@@ -44,7 +44,6 @@ constructor dialog {} {
4444
-text [mc "Name:"] \
4545
-value user \
4646
-variable @name_type
47-
if {!$use_ttk} {$w.desc.name_r configure -anchor w}
4847
set w_name $w.desc.name_t
4948
ttk::entry $w_name \
5049
-width 40 \
@@ -57,7 +56,6 @@ constructor dialog {} {
5756
-text [mc "Match Tracking Branch Name"] \
5857
-value match \
5958
-variable @name_type
60-
if {!$use_ttk} {$w.desc.match_r configure -anchor w}
6159
grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2
6260

6361
grid columnconfigure $w.desc 1 -weight 1

lib/branch_delete.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ field w_check ; # revision picker for merge test
99
field w_delete ; # delete button
1010

1111
constructor dialog {} {
12-
global current_branch use_ttk
12+
global current_branch
1313

1414
make_dialog top w
1515
wm withdraw $w

lib/branch_rename.tcl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ field oldname
88
field newname
99

1010
constructor dialog {} {
11-
global current_branch use_ttk
11+
global current_branch
1212

1313
make_dialog top w
1414
wm withdraw $w
@@ -36,12 +36,8 @@ constructor dialog {} {
3636

3737
ttk::frame $w.rename
3838
ttk::label $w.rename.oldname_l -text [mc "Branch:"]
39-
if {$use_ttk} {
40-
ttk::combobox $w.rename.oldname_m -textvariable @oldname \
41-
-values [load_all_heads] -state readonly
42-
} else {
43-
eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads]
44-
}
39+
ttk::combobox $w.rename.oldname_m -textvariable @oldname \
40+
-values [load_all_heads] -state readonly
4541

4642
ttk::label $w.rename.newname_l -text [mc "New Name:"]
4743
ttk::entry $w.rename.newname_t \

lib/browser.tcl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ field browser_busy 1
2121
field ls_buf {}; # Buffered record output from ls-tree
2222

2323
constructor new {commit {path {}}} {
24-
global cursor_ptr M1B use_ttk
24+
global cursor_ptr M1B
2525
make_dialog top w
2626
wm withdraw $top
2727
wm title $top [mc "%s (%s): File Browser" [appname] [reponame]]
@@ -40,7 +40,6 @@ constructor new {commit {path {}}} {
4040
-anchor w \
4141
-justify left \
4242
-font font_uibold
43-
if {!$use_ttk} { $w.path configure -borderwidth 1 -relief sunken}
4443
pack $w.path -anchor w -side top -fill x
4544

4645
ttk::frame $w.list
@@ -66,7 +65,6 @@ constructor new {commit {path {}}} {
6665
-textvariable @browser_status \
6766
-anchor w \
6867
-justify left
69-
if {!$use_ttk} { $w.status configure -borderwidth 1 -relief sunken}
7068
pack $w.status -anchor w -side bottom -fill x
7169

7270
bind $w_list <Button-1> "[cb _click 0 @%x,%y];break"
@@ -269,7 +267,6 @@ field w ; # widget path
269267
field w_rev ; # mega-widget to pick the initial revision
270268

271269
constructor dialog {} {
272-
global use_ttk
273270
make_dialog top w
274271
wm withdraw $top
275272
wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]]

lib/choose_font.tcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ variable all_families [list] ; # All fonts known to Tk
1717

1818
constructor pick {path title a_family a_size} {
1919
variable all_families
20-
global use_ttk
2120

2221
set v_family $a_family
2322
set v_size $a_size

lib/choose_repository.tcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ field readtree_err ; # Error output from read-tree (if any)
3535
field sorted_recent ; # recent repositories (sorted)
3636

3737
constructor pick {} {
38-
global M1T M1B use_ttk
38+
global M1T M1B
3939

4040
if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
4141
set maxrecent 10
@@ -378,7 +378,6 @@ proc _objdir {path} {
378378
## Create New Repository
379379

380380
method _do_new {} {
381-
global use_ttk
382381
$w_next conf \
383382
-state disabled \
384383
-command [cb _do_new2] \
@@ -462,7 +461,6 @@ proc _new_ok {p} {
462461
## Clone Existing Repository
463462

464463
method _do_clone {} {
465-
global use_ttk
466464
$w_next conf \
467465
-state disabled \
468466
-command [cb _do_clone2] \

lib/choose_rev.tcl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ proc new_unmerged {path {title {}}} {
3232
}
3333

3434
constructor _new {path unmerged_only title} {
35-
global current_branch is_detached use_ttk
35+
global current_branch is_detached
3636

3737
if {![info exists ::all_remotes]} {
3838
load_all_remotes
@@ -52,7 +52,6 @@ constructor _new {path unmerged_only title} {
5252
-text [mc "This Detached Checkout"] \
5353
-value HEAD \
5454
-variable @revtype
55-
if {!$use_ttk} {$w.detachedhead_r configure -anchor w}
5655
grid $w.detachedhead_r -sticky we -padx {0 5} -columnspan 2
5756
}
5857

@@ -95,11 +94,7 @@ constructor _new {path unmerged_only title} {
9594
] -side right
9695
grid $w.types -sticky we -padx {0 5} -columnspan 2
9796

98-
if {$use_ttk} {
99-
ttk::frame $w.list -style SListbox.TFrame -padding 2
100-
} else {
101-
frame $w.list
102-
}
97+
ttk::frame $w.list -style SListbox.TFrame -padding 2
10398
set w_list $w.list.l
10499
listbox $w_list \
105100
-font font_diff \
@@ -109,9 +104,7 @@ constructor _new {path unmerged_only title} {
109104
-exportselection false \
110105
-xscrollcommand [cb _sb_set $w.list.sbx h] \
111106
-yscrollcommand [cb _sb_set $w.list.sby v]
112-
if {$use_ttk} {
113-
$w_list configure -relief flat -highlightthickness 0 -borderwidth 0
114-
}
107+
$w_list configure -relief flat -highlightthickness 0 -borderwidth 0
115108
pack $w_list -fill both -expand 1
116109
grid $w.list -sticky nswe -padx {20 5} -columnspan 2
117110
bind $w_list <Any-Motion> [cb _show_tooltip @%x,%y]
@@ -238,12 +231,10 @@ constructor _new {path unmerged_only title} {
238231
}
239232

240233
method none {text} {
241-
global use_ttk
242234
if {![winfo exists $w.none_r]} {
243235
ttk::radiobutton $w.none_r \
244236
-value none \
245237
-variable @revtype
246-
if {!$use_ttk} {$w.none_r configure -anchor w}
247238
grid $w.none_r -sticky we -padx {0 5} -columnspan 2
248239
}
249240
$w.none_r configure -text $text

0 commit comments

Comments
 (0)