summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2014-09-14 23:35:57 +0300
committerPaul Mackerras <paulus@samba.org>2014-10-30 09:43:15 +1100
commit9fabefb1f3f658e77eb18afa3f95efe1a0ee8d0d (patch)
treeebdf32b8edb2ae58e1702a2be34c1f9a7a8d0752
parent4d5e1b1319d27d2381d31dc26bfd16360fe79ab8 (diff)
downloadgit-9fabefb1f3f658e77eb18afa3f95efe1a0ee8d0d.tar.gz
gitk: Remove boilerplate for configuration variables
Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk88
1 files changed, 20 insertions, 68 deletions
diff --git a/gitk b/gitk
index 84f1405d4d..78358a712a 100755
--- a/gitk
+++ b/gitk
@@ -2777,23 +2777,11 @@ proc doprogupdate {} {
}
proc savestuff {w} {
- global canv canv2 canv3 mainfont textfont uifont tabstop
- global stuffsaved findmergefiles maxgraphpct
- global maxwidth showneartags showlocalchanges
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
- global cmitmode wrapcomment datetimeformat limitdiffs
- global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor
- global uifgcolor uifgdisabledcolor
- global headbgcolor headfgcolor headoutlinecolor remotebgcolor
- global tagbgcolor tagfgcolor tagoutlinecolor
- global reflinecolor filesepbgcolor filesepfgcolor
- global mergecolors foundbgcolor currentsearchhitbgcolor
- global linehoverbgcolor linehoverfgcolor linehoveroutlinecolor circlecolors
- global mainheadcirclecolor workingfilescirclecolor indexcirclecolor
- global linkfgcolor circleoutlinecolor
- global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
- global hideremotes want_ttk maxrefs visiblerefs
+ global use_ttk
+ global stuffsaved
global config_file config_file_tmp
+ global config_variables
if {$stuffsaved} return
if {![winfo viewable .]} return
@@ -2805,59 +2793,10 @@ proc savestuff {w} {
if {$::tcl_platform(platform) eq {windows}} {
file attributes $config_file_tmp -hidden true
}
- puts $f [list set mainfont $mainfont]
- puts $f [list set textfont $textfont]
- puts $f [list set uifont $uifont]
- puts $f [list set tabstop $tabstop]
- puts $f [list set findmergefiles $findmergefiles]
- puts $f [list set maxgraphpct $maxgraphpct]
- puts $f [list set maxwidth $maxwidth]
- puts $f [list set cmitmode $cmitmode]
- puts $f [list set wrapcomment $wrapcomment]
- puts $f [list set autoselect $autoselect]
- puts $f [list set autosellen $autosellen]
- puts $f [list set showneartags $showneartags]
- puts $f [list set maxrefs $maxrefs]
- puts $f [list set visiblerefs $visiblerefs]
- puts $f [list set hideremotes $hideremotes]
- puts $f [list set showlocalchanges $showlocalchanges]
- puts $f [list set datetimeformat $datetimeformat]
- puts $f [list set limitdiffs $limitdiffs]
- puts $f [list set uicolor $uicolor]
- puts $f [list set want_ttk $want_ttk]
- puts $f [list set bgcolor $bgcolor]
- puts $f [list set fgcolor $fgcolor]
- puts $f [list set uifgcolor $uifgcolor]
- puts $f [list set uifgdisabledcolor $uifgdisabledcolor]
- puts $f [list set colors $colors]
- puts $f [list set diffcolors $diffcolors]
- puts $f [list set mergecolors $mergecolors]
- puts $f [list set markbgcolor $markbgcolor]
- puts $f [list set diffcontext $diffcontext]
- puts $f [list set selectbgcolor $selectbgcolor]
- puts $f [list set foundbgcolor $foundbgcolor]
- puts $f [list set currentsearchhitbgcolor $currentsearchhitbgcolor]
- puts $f [list set extdifftool $extdifftool]
- puts $f [list set perfile_attrs $perfile_attrs]
- puts $f [list set headbgcolor $headbgcolor]
- puts $f [list set headfgcolor $headfgcolor]
- puts $f [list set headoutlinecolor $headoutlinecolor]
- puts $f [list set remotebgcolor $remotebgcolor]
- puts $f [list set tagbgcolor $tagbgcolor]
- puts $f [list set tagfgcolor $tagfgcolor]
- puts $f [list set tagoutlinecolor $tagoutlinecolor]
- puts $f [list set reflinecolor $reflinecolor]
- puts $f [list set filesepbgcolor $filesepbgcolor]
- puts $f [list set filesepfgcolor $filesepfgcolor]
- puts $f [list set linehoverbgcolor $linehoverbgcolor]
- puts $f [list set linehoverfgcolor $linehoverfgcolor]
- puts $f [list set linehoveroutlinecolor $linehoveroutlinecolor]
- puts $f [list set mainheadcirclecolor $mainheadcirclecolor]
- puts $f [list set workingfilescirclecolor $workingfilescirclecolor]
- puts $f [list set indexcirclecolor $indexcirclecolor]
- puts $f [list set circlecolors $circlecolors]
- puts $f [list set linkfgcolor $linkfgcolor]
- puts $f [list set circleoutlinecolor $circleoutlinecolor]
+ foreach var_name $config_variables {
+ upvar #0 $var_name var
+ puts $f [list set $var_name $var]
+ }
puts $f "set geometry(main) [wm geometry .]"
puts $f "set geometry(state) [wm state .]"
@@ -12171,6 +12110,19 @@ catch {
source $config_file
}
+set config_variables {
+ mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
+ cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs
+ hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
+ bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
+ markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
+ extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor
+ remotebgcolor tagbgcolor tagfgcolor tagoutlinecolor reflinecolor
+ filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
+ linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
+ indexcirclecolor circlecolors linkfgcolor circleoutlinecolor
+}
+
parsefont mainfont $mainfont
eval font create mainfont [fontflags mainfont]
eval font create mainfontbold [fontflags mainfont 1]