Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 1 | # git-gui options editor |
| 2 | # Copyright (C) 2006, 2007 Shawn Pearce |
| 3 | |
Alexander Gavrilov | 72e6b00 | 2008-09-18 01:07:32 +0400 | [diff] [blame] | 4 | proc config_check_encodings {} { |
| 5 | global repo_config_new global_config_new |
| 6 | |
| 7 | set enc $global_config_new(gui.encoding) |
| 8 | if {$enc eq {}} { |
| 9 | set global_config_new(gui.encoding) [encoding system] |
| 10 | } elseif {[tcl_encoding $enc] eq {}} { |
| 11 | error_popup [mc "Invalid global encoding '%s'" $enc] |
| 12 | return 0 |
| 13 | } |
| 14 | |
| 15 | set enc $repo_config_new(gui.encoding) |
| 16 | if {$enc eq {}} { |
| 17 | set repo_config_new(gui.encoding) [encoding system] |
| 18 | } elseif {[tcl_encoding $enc] eq {}} { |
| 19 | error_popup [mc "Invalid repo encoding '%s'" $enc] |
| 20 | return 0 |
| 21 | } |
| 22 | |
| 23 | return 1 |
| 24 | } |
| 25 | |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 26 | proc save_config {} { |
| 27 | global default_config font_descs |
Alexander Gavrilov | 153ad78 | 2008-11-16 21:46:47 +0300 | [diff] [blame] | 28 | global repo_config global_config system_config |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 29 | global repo_config_new global_config_new |
Shawn O. Pearce | 95b002e | 2008-02-07 02:35:25 -0500 | [diff] [blame] | 30 | global ui_comm_spell |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 31 | |
| 32 | foreach option $font_descs { |
| 33 | set name [lindex $option 0] |
| 34 | set font [lindex $option 1] |
| 35 | font configure $font \ |
| 36 | -family $global_config_new(gui.$font^^family) \ |
| 37 | -size $global_config_new(gui.$font^^size) |
| 38 | font configure ${font}bold \ |
| 39 | -family $global_config_new(gui.$font^^family) \ |
| 40 | -size $global_config_new(gui.$font^^size) |
Shawn O. Pearce | debcd0f | 2007-06-02 17:15:56 -0400 | [diff] [blame] | 41 | font configure ${font}italic \ |
| 42 | -family $global_config_new(gui.$font^^family) \ |
| 43 | -size $global_config_new(gui.$font^^size) |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 44 | set global_config_new(gui.$name) [font configure $font] |
| 45 | unset global_config_new(gui.$font^^family) |
| 46 | unset global_config_new(gui.$font^^size) |
| 47 | } |
| 48 | |
| 49 | foreach name [array names default_config] { |
| 50 | set value $global_config_new($name) |
| 51 | if {$value ne $global_config($name)} { |
Alexander Gavrilov | 153ad78 | 2008-11-16 21:46:47 +0300 | [diff] [blame] | 52 | if {$value eq $system_config($name)} { |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 53 | catch {git config --global --unset $name} |
| 54 | } else { |
| 55 | regsub -all "\[{}\]" $value {"} value |
| 56 | git config --global $name $value |
| 57 | } |
| 58 | set global_config($name) $value |
| 59 | if {$value eq $repo_config($name)} { |
| 60 | catch {git config --unset $name} |
| 61 | set repo_config($name) $value |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | foreach name [array names default_config] { |
| 67 | set value $repo_config_new($name) |
| 68 | if {$value ne $repo_config($name)} { |
| 69 | if {$value eq $global_config($name)} { |
| 70 | catch {git config --unset $name} |
| 71 | } else { |
| 72 | regsub -all "\[{}\]" $value {"} value |
| 73 | git config $name $value |
| 74 | } |
| 75 | set repo_config($name) $value |
| 76 | } |
| 77 | } |
Shawn O. Pearce | 95b002e | 2008-02-07 02:35:25 -0500 | [diff] [blame] | 78 | |
| 79 | if {[info exists repo_config(gui.spellingdictionary)]} { |
| 80 | set value $repo_config(gui.spellingdictionary) |
| 81 | if {$value eq {none}} { |
| 82 | if {[info exists ui_comm_spell]} { |
| 83 | $ui_comm_spell stop |
| 84 | } |
| 85 | } elseif {[info exists ui_comm_spell]} { |
| 86 | $ui_comm_spell lang $value |
| 87 | } |
| 88 | } |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 89 | } |
| 90 | |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 91 | proc do_options {} { |
| 92 | global repo_config global_config font_descs |
| 93 | global repo_config_new global_config_new |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 94 | global ui_comm_spell use_ttk NS |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 95 | |
| 96 | array unset repo_config_new |
| 97 | array unset global_config_new |
| 98 | foreach name [array names repo_config] { |
| 99 | set repo_config_new($name) $repo_config($name) |
| 100 | } |
| 101 | load_config 1 |
| 102 | foreach name [array names repo_config] { |
| 103 | switch -- $name { |
| 104 | gui.diffcontext {continue} |
| 105 | } |
| 106 | set repo_config_new($name) $repo_config($name) |
| 107 | } |
| 108 | foreach name [array names global_config] { |
| 109 | set global_config_new($name) $global_config($name) |
| 110 | } |
| 111 | |
| 112 | set w .options_editor |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 113 | Dialog $w |
| 114 | wm withdraw $w |
| 115 | wm transient $w [winfo parent $w] |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 116 | wm geometry $w "+[winfo rootx .]+[winfo rooty .]" |
| 117 | |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 118 | ${NS}::frame $w.buttons |
| 119 | ${NS}::button $w.buttons.restore -text [mc "Restore Defaults"] \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 120 | -default normal \ |
| 121 | -command do_restore_defaults |
| 122 | pack $w.buttons.restore -side left |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 123 | ${NS}::button $w.buttons.save -text [mc Save] \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 124 | -default active \ |
| 125 | -command [list do_save_config $w] |
| 126 | pack $w.buttons.save -side right |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 127 | ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 128 | -default normal \ |
| 129 | -command [list destroy $w] |
| 130 | pack $w.buttons.cancel -side right -padx 5 |
| 131 | pack $w.buttons -side bottom -fill x -pady 10 -padx 10 |
| 132 | |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 133 | ${NS}::labelframe $w.repo -text [mc "%s Repository" [reponame]] |
| 134 | ${NS}::labelframe $w.global -text [mc "Global (All Repositories)"] |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 135 | pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5 |
| 136 | pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5 |
| 137 | |
| 138 | set optid 0 |
| 139 | foreach option { |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 140 | {t user.name {mc "User Name"}} |
| 141 | {t user.email {mc "Email Address"}} |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 142 | |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 143 | {b merge.summary {mc "Summarize Merge Commits"}} |
| 144 | {i-1..5 merge.verbosity {mc "Merge Verbosity"}} |
| 145 | {b merge.diffstat {mc "Show Diffstat After Merge"}} |
Alexander Gavrilov | 7e30682 | 2008-08-31 00:56:51 +0400 | [diff] [blame] | 146 | {t merge.tool {mc "Use Merge Tool"}} |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 147 | |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 148 | {b gui.trustmtime {mc "Trust File Modification Timestamps"}} |
| 149 | {b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}} |
| 150 | {b gui.matchtrackingbranch {mc "Match Tracking Branches"}} |
Clément Poulain | 1fbacca | 2010-07-30 09:11:02 +0100 | [diff] [blame] | 151 | {b gui.textconv {mc "Use Textconv For Diffs and Blames"}} |
Alexander Gavrilov | 57cae87 | 2008-07-17 00:43:48 +0400 | [diff] [blame] | 152 | {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}} |
| 153 | {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}} |
Alexander Gavrilov | a9c80b8 | 2008-08-23 12:30:00 +0400 | [diff] [blame] | 154 | {i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}} |
Clemens Buchacher | 55ba8a3 | 2008-08-30 18:45:27 +0200 | [diff] [blame] | 155 | {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}} |
Tilman Vogel | 54531e7 | 2011-01-21 11:59:45 +0100 | [diff] [blame] | 156 | {t gui.diffopts {mc "Additional Diff Parameters"}} |
Adam PiÄ…tyszek | 11027d5 | 2008-03-06 20:38:40 +0100 | [diff] [blame] | 157 | {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}} |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 158 | {t gui.newbranchtemplate {mc "New Branch Name Template"}} |
Alexander Gavrilov | 50102c5 | 2008-09-18 01:07:33 +0400 | [diff] [blame] | 159 | {c gui.encoding {mc "Default File Contents Encoding"}} |
Bert Wesarg | f49517a | 2011-10-22 21:39:39 +0200 | [diff] [blame] | 160 | {b gui.warndetachedcommit {mc "Warn before committing to a detached head"}} |
Bert Wesarg | bb196e2 | 2011-10-14 21:25:21 +0200 | [diff] [blame] | 161 | {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}} |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 162 | } { |
| 163 | set type [lindex $option 0] |
| 164 | set name [lindex $option 1] |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 165 | set text [eval [lindex $option 2]] |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 166 | incr optid |
| 167 | foreach f {repo global} { |
| 168 | switch -glob -- $type { |
| 169 | b { |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 170 | ${NS}::checkbutton $w.$f.$optid -text $text \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 171 | -variable ${f}_config_new($name) \ |
| 172 | -onvalue true \ |
| 173 | -offvalue false |
| 174 | pack $w.$f.$optid -side top -anchor w |
| 175 | } |
| 176 | i-* { |
| 177 | regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 178 | ${NS}::frame $w.$f.$optid |
| 179 | ${NS}::label $w.$f.$optid.l -text "$text:" |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 180 | pack $w.$f.$optid.l -side left -anchor w -fill x |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 181 | tspinbox $w.$f.$optid.v \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 182 | -textvariable ${f}_config_new($name) \ |
| 183 | -from $min \ |
| 184 | -to $max \ |
| 185 | -increment 1 \ |
| 186 | -width [expr {1 + [string length $max]}] |
| 187 | bind $w.$f.$optid.v <FocusIn> {%W selection range 0 end} |
| 188 | pack $w.$f.$optid.v -side right -anchor e -padx 5 |
| 189 | pack $w.$f.$optid -side top -anchor w -fill x |
| 190 | } |
Alexander Gavrilov | 50102c5 | 2008-09-18 01:07:33 +0400 | [diff] [blame] | 191 | c - |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 192 | t { |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 193 | ${NS}::frame $w.$f.$optid |
| 194 | ${NS}::label $w.$f.$optid.l -text "$text:" |
| 195 | ${NS}::entry $w.$f.$optid.v \ |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 196 | -width 20 \ |
| 197 | -textvariable ${f}_config_new($name) |
| 198 | pack $w.$f.$optid.l -side left -anchor w |
| 199 | pack $w.$f.$optid.v -side left -anchor w \ |
| 200 | -fill x -expand 1 \ |
| 201 | -padx 5 |
Alexander Gavrilov | 50102c5 | 2008-09-18 01:07:33 +0400 | [diff] [blame] | 202 | if {$type eq {c}} { |
| 203 | menu $w.$f.$optid.m |
| 204 | build_encoding_menu $w.$f.$optid.m \ |
| 205 | [list set ${f}_config_new($name)] 1 |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 206 | ${NS}::button $w.$f.$optid.b \ |
Alexander Gavrilov | 50102c5 | 2008-09-18 01:07:33 +0400 | [diff] [blame] | 207 | -text [mc "Change"] \ |
| 208 | -command [list popup_btn_menu \ |
| 209 | $w.$f.$optid.m $w.$f.$optid.b] |
| 210 | pack $w.$f.$optid.b -side left -anchor w |
| 211 | } |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 212 | pack $w.$f.$optid -side top -anchor w -fill x |
| 213 | } |
Bert Wesarg | bb196e2 | 2011-10-14 21:25:21 +0200 | [diff] [blame] | 214 | s { |
| 215 | set opts [eval [lindex $option 3]] |
| 216 | ${NS}::frame $w.$f.$optid |
| 217 | ${NS}::label $w.$f.$optid.l -text "$text:" |
| 218 | if {$use_ttk} { |
| 219 | ttk::combobox $w.$f.$optid.v \ |
| 220 | -textvariable ${f}_config_new($name) \ |
| 221 | -values $opts -state readonly |
| 222 | } else { |
| 223 | eval tk_optionMenu $w.$f.$optid.v \ |
| 224 | ${f}_config_new($name) \ |
| 225 | $opts |
| 226 | } |
| 227 | pack $w.$f.$optid.l -side left -anchor w -fill x |
| 228 | pack $w.$f.$optid.v -side right -anchor e -padx 5 |
| 229 | pack $w.$f.$optid -side top -anchor w -fill x |
| 230 | } |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | } |
| 234 | |
Shawn O. Pearce | 95b002e | 2008-02-07 02:35:25 -0500 | [diff] [blame] | 235 | set all_dicts [linsert \ |
| 236 | [spellcheck::available_langs] \ |
| 237 | 0 \ |
| 238 | none] |
| 239 | incr optid |
| 240 | foreach f {repo global} { |
| 241 | if {![info exists ${f}_config_new(gui.spellingdictionary)]} { |
| 242 | if {[info exists ui_comm_spell]} { |
| 243 | set value [$ui_comm_spell lang] |
| 244 | } else { |
| 245 | set value none |
| 246 | } |
| 247 | set ${f}_config_new(gui.spellingdictionary) $value |
| 248 | } |
| 249 | |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 250 | ${NS}::frame $w.$f.$optid |
| 251 | ${NS}::label $w.$f.$optid.l -text [mc "Spelling Dictionary:"] |
| 252 | if {$use_ttk} { |
| 253 | ttk::combobox $w.$f.$optid.v \ |
| 254 | -textvariable ${f}_config_new(gui.spellingdictionary) \ |
| 255 | -values $all_dicts -state readonly |
| 256 | } else { |
| 257 | eval tk_optionMenu $w.$f.$optid.v \ |
| 258 | ${f}_config_new(gui.spellingdictionary) \ |
| 259 | $all_dicts |
| 260 | } |
Shawn O. Pearce | 95b002e | 2008-02-07 02:35:25 -0500 | [diff] [blame] | 261 | pack $w.$f.$optid.l -side left -anchor w -fill x |
Shawn O. Pearce | 740b9b9 | 2008-02-14 01:07:39 -0500 | [diff] [blame] | 262 | pack $w.$f.$optid.v -side right -anchor e -padx 5 |
Shawn O. Pearce | 95b002e | 2008-02-07 02:35:25 -0500 | [diff] [blame] | 263 | pack $w.$f.$optid -side top -anchor w -fill x |
| 264 | } |
| 265 | unset all_dicts |
| 266 | |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 267 | set all_fonts [lsort [font families]] |
| 268 | foreach option $font_descs { |
| 269 | set name [lindex $option 0] |
| 270 | set font [lindex $option 1] |
Christian Stimming | 1ac1795 | 2007-07-21 14:21:34 +0200 | [diff] [blame] | 271 | set text [eval [lindex $option 2]] |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 272 | |
| 273 | set global_config_new(gui.$font^^family) \ |
| 274 | [font configure $font -family] |
| 275 | set global_config_new(gui.$font^^size) \ |
| 276 | [font configure $font -size] |
| 277 | |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 278 | ${NS}::frame $w.global.$name |
| 279 | ${NS}::label $w.global.$name.l -text "$text:" |
| 280 | ${NS}::button $w.global.$name.b \ |
Shawn O. Pearce | afe2098 | 2007-09-13 19:07:46 -0400 | [diff] [blame] | 281 | -text [mc "Change Font"] \ |
| 282 | -command [list \ |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 283 | tchoosefont \ |
Shawn O. Pearce | afe2098 | 2007-09-13 19:07:46 -0400 | [diff] [blame] | 284 | $w \ |
| 285 | [mc "Choose %s" $text] \ |
| 286 | global_config_new(gui.$font^^family) \ |
| 287 | global_config_new(gui.$font^^size) \ |
| 288 | ] |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 289 | ${NS}::label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) |
| 290 | ${NS}::label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) |
| 291 | ${NS}::label $w.global.$name.pt -text [mc "pt."] |
Shawn O. Pearce | afe2098 | 2007-09-13 19:07:46 -0400 | [diff] [blame] | 292 | pack $w.global.$name.l -side left -anchor w |
| 293 | pack $w.global.$name.b -side right -anchor e |
| 294 | pack $w.global.$name.pt -side right -anchor w |
| 295 | pack $w.global.$name.s -side right -anchor w |
| 296 | pack $w.global.$name.f -side right -anchor w |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 297 | pack $w.global.$name -side top -anchor w -fill x |
| 298 | } |
| 299 | |
| 300 | bind $w <Visibility> "grab $w; focus $w.buttons.save" |
| 301 | bind $w <Key-Escape> "destroy $w" |
| 302 | bind $w <Key-Return> [list do_save_config $w] |
Shawn O. Pearce | 13824e2 | 2007-10-07 22:39:08 -0700 | [diff] [blame] | 303 | |
| 304 | if {[is_MacOSX]} { |
| 305 | set t [mc "Preferences"] |
| 306 | } else { |
| 307 | set t [mc "Options"] |
| 308 | } |
| 309 | wm title $w "[appname] ([reponame]): $t" |
Pat Thoyts | c80d7be | 2010-01-26 00:05:31 +0000 | [diff] [blame] | 310 | wm deiconify $w |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 311 | tkwait window $w |
| 312 | } |
| 313 | |
| 314 | proc do_restore_defaults {} { |
Alexander Gavrilov | 153ad78 | 2008-11-16 21:46:47 +0300 | [diff] [blame] | 315 | global font_descs default_config repo_config system_config |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 316 | global repo_config_new global_config_new |
| 317 | |
| 318 | foreach name [array names default_config] { |
Alexander Gavrilov | 153ad78 | 2008-11-16 21:46:47 +0300 | [diff] [blame] | 319 | set repo_config_new($name) $system_config($name) |
| 320 | set global_config_new($name) $system_config($name) |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | foreach option $font_descs { |
| 324 | set name [lindex $option 0] |
Alexander Gavrilov | 153ad78 | 2008-11-16 21:46:47 +0300 | [diff] [blame] | 325 | set repo_config(gui.$name) $system_config(gui.$name) |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 326 | } |
| 327 | apply_config |
| 328 | |
| 329 | foreach option $font_descs { |
| 330 | set name [lindex $option 0] |
| 331 | set font [lindex $option 1] |
| 332 | set global_config_new(gui.$font^^family) \ |
| 333 | [font configure $font -family] |
| 334 | set global_config_new(gui.$font^^size) \ |
| 335 | [font configure $font -size] |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | proc do_save_config {w} { |
Alexander Gavrilov | 72e6b00 | 2008-09-18 01:07:32 +0400 | [diff] [blame] | 340 | if {![config_check_encodings]} return |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 341 | if {[catch {save_config} err]} { |
Shawn O. Pearce | 31bb1d1 | 2007-09-14 01:50:09 -0400 | [diff] [blame] | 342 | error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"] |
Shawn O. Pearce | f522c9b | 2007-05-07 23:35:48 -0400 | [diff] [blame] | 343 | } |
| 344 | reshow_diff |
| 345 | destroy $w |
| 346 | } |