git-gui: Simplified format of geometry configuration.
The gui.geometry config value was starting to contain the odd string \\{ as part of its value due to the way the Tcl lists were being supplied to git repo-config. Now we write out only three values: the overall window geomtry, the y position of the horizontal sash, and the x position of the vertical sash. All other data is skipped, which makes the gui.geometry value simpler. While debugging this I noticed that the save_my_config procedure was being invoked multiple times during exit due to do_quit getting invoked over and over again. So now we set a flag in do_quit and don't perform any of our "at exit" type of logic if we've already been through the do_quit procedure once. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 11, 2006 at 19:32 UTC
c4fe7728529fd9f3dc2c413ce889d359732cd3a4
1 file changed
+19
-10
git-gui
+19
-10
@@ -48,11 +48,9 @@ proc save_my_config {} {
48
set repo_config(gui.trustmtime) [list $cfg_trust_mtime]
49
}
50
51
- set cfg_geometry [list \
52
- [wm geometry .] \
53
- [.vpane sash coord 0] \
54
- [.vpane.files sash coord 0] \
55
- ]
51
+ set cfg_geometry [wm geometry .]
52
+ append cfg_geometry " [lindex [.vpane sash coord 0] 1]"
53
+ append cfg_geometry " [lindex [.vpane.files sash coord 0] 0]"
54
if {[catch {set rc_geometry $repo_config(gui.geometry)}]} {
55
set rc_geometry [list [list]]
56
}
@@ -1422,8 +1420,13 @@ proc do_repack {} {
1420
console_exec $w $cmd
1421
}
1422
1423
+set quitting 0
1424
+
1425
proc do_quit {} {
1426
- global gitdir ui_comm
1426
+ global gitdir ui_comm quitting
1427
+
1428
+ if {$quitting} return
1429
+ set quitting 1
1430
1431
set save [file join $gitdir GITGUI_MSG]
1432
set msg [string trim [$ui_comm get 0.0 end]]
@@ -1837,10 +1840,16 @@ pack .status -anchor w -side bottom -fill x
1840
1841
# -- Load geometry
1842
catch {
1840
-wm geometry . [lindex $repo_config(gui.geometry) 0 0]
1841
-eval .vpane sash place 0 [lindex $repo_config(gui.geometry) 0 1]
1842
-eval .vpane.files sash place 0 [lindex $repo_config(gui.geometry) 0 2]
1843
-}
1843
+set gm [lindex $repo_config(gui.geometry) 0]
1844
+wm geometry . [lindex $gm 0]
1845
+.vpane sash place 0 \
1846
+ [lindex [.vpane sash coord 0] 0] \
1847
+ [lindex $gm 1]
1848
+.vpane.files sash place 0 \
1849
+ [lindex $gm 2] \
1850
+ [lindex [.vpane.files sash coord 0] 1]
1851
+}
1852
+unset gm
1853
1854
# -- Key Bindings
1855
bind $ui_comm <$M1B-Key-Return> {do_commit;break}