Code

git-gui: Change accelerator for "Include All" to M1-I.
[git.git] / git-gui
diff --git a/git-gui b/git-gui
index ad3aa0727c55a8e62609cec658108e7ecf3dedd6..20c36c2d2e3e2c9bf68da635bdd001f0c806417a 100755 (executable)
--- a/git-gui
+++ b/git-gui
@@ -7,6 +7,86 @@ exec wish "$0" -- "$@"
 # and distributed under the terms of the GNU General Public Licence,
 # either version 2, or (at your option) any later version.
 
+######################################################################
+##
+## config
+
+proc load_repo_config {} {
+       global repo_config
+       global cfg_trust_mtime
+
+       array unset repo_config
+       catch {
+               set fd_rc [open "| git repo-config --list" r]
+               while {[gets $fd_rc line] >= 0} {
+                       if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
+                               lappend repo_config($name) $value
+                       }
+               }
+               close $fd_rc
+       }
+
+       if {[catch {set cfg_trust_mtime \
+                       [lindex $repo_config(gui.trustmtime) 0]
+               }]} {
+               set cfg_trust_mtime false
+       }
+}
+
+proc save_my_config {} {
+       global repo_config
+       global cfg_trust_mtime
+
+       if {[catch {set rc_trustMTime $repo_config(gui.trustmtime)}]} {
+               set rc_trustMTime [list false]
+       }
+       if {$cfg_trust_mtime != [lindex $rc_trustMTime 0]} {
+               exec git repo-config gui.trustMTime $cfg_trust_mtime
+               set repo_config(gui.trustmtime) [list $cfg_trust_mtime]
+       }
+
+       set cfg_geometry [list \
+               [wm geometry .] \
+               [.vpane sash coord 0] \
+               [.vpane.files sash coord 0] \
+               ]
+       if {[catch {set rc_geometry $repo_config(gui.geometry)}]} {
+               set rc_geometry [list [list]]
+       }
+       if {$cfg_geometry != [lindex $rc_geometry 0]} {
+               exec git repo-config gui.geometry $cfg_geometry
+               set repo_config(gui.geometry) [list $cfg_geometry]
+       }
+}
+
+######################################################################
+##
+## repository setup
+
+set appname [lindex [file split $argv0] end]
+set gitdir {}
+set GIT_COMMITTER_IDENT {}
+
+if {[catch {set cdup [exec git rev-parse --show-cdup]} err]} {
+       show_msg {} . "Cannot find the git directory: $err"
+       exit 1
+}
+if {$cdup != ""} {
+       cd $cdup
+}
+unset cdup
+
+if {[catch {set gitdir [exec git rev-parse --git-dir]} err]} {
+       show_msg {} . "Cannot find the git directory: $err"
+       exit 1
+}
+
+if {$appname == {git-citool}} {
+       set single_commit 1
+}
+
+load_repo_config
+
 ######################################################################
 ##
 ## task management
@@ -903,39 +983,7 @@ proc toggle_mode {path} {
 
 ######################################################################
 ##
-## config (fetch push pull)
-
-proc load_repo_config {} {
-       global repo_config
-       global cfg_trust_mtime
-
-       array unset repo_config
-       catch {
-               set fd_rc [open "| git repo-config --list" r]
-               while {[gets $fd_rc line] >= 0} {
-                       if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
-                               lappend repo_config($name) $value
-                       }
-               }
-               close $fd_rc
-       }
-
-       if {[catch {set cfg_trust_mtime $repo_config(gui.trustmtime)}]} {
-               set cfg_trust_mtime false
-       }
-}
-
-proc save_my_config {} {
-       global repo_config
-       global cfg_trust_mtime
-
-       if {[catch {set rc_trustMTime $repo_config(gui.trustmtime)}]} {
-               set rc_trustMTime false
-       }
-       if {$cfg_trust_mtime != $rc_trustMTime} {
-               exec git repo-config gui.trustMTime $cfg_trust_mtime
-       }
-}
+## remote management
 
 proc load_all_remotes {} {
        global gitdir all_remotes repo_config
@@ -1398,8 +1446,6 @@ proc do_include_all {} {
        }
 }
 
-set GIT_COMMITTER_IDENT {}
-
 proc do_signoff {} {
        global ui_comm GIT_COMMITTER_IDENT
 
@@ -1514,7 +1560,7 @@ lappend disable_on_lock \
        [list .mbar.commit entryconf [.mbar.commit index last] -state]
 .mbar.commit add command -label {Include All Files} \
        -command do_include_all \
-       -accelerator $M1T-U \
+       -accelerator $M1T-I \
        -font $mainfont
 lappend disable_on_lock \
        [list .mbar.commit entryconf [.mbar.commit index last] -state]
@@ -1724,16 +1770,26 @@ label .status -textvariable ui_status_value \
        -font $mainfont
 pack .status -anchor w -side bottom -fill x
 
+# -- Load geometry
+catch {
+wm geometry . [lindex $repo_config(gui.geometry) 0 0]
+eval .vpane sash place 0 [lindex $repo_config(gui.geometry) 0 1]
+eval .vpane.files sash place 0 [lindex $repo_config(gui.geometry) 0 2]
+}
+
 # -- Key Bindings
 bind $ui_comm <$M1B-Key-Return> {do_commit;break}
+bind $ui_comm <$M1B-Key-i> {do_include_all;break}
+bind $ui_comm <$M1B-Key-I> {do_include_all;break}
+
 bind .   <Destroy> do_quit
 bind all <Key-F5> do_rescan
 bind all <$M1B-Key-r> do_rescan
 bind all <$M1B-Key-R> do_rescan
 bind .   <$M1B-Key-s> do_signoff
 bind .   <$M1B-Key-S> do_signoff
-bind .   <$M1B-Key-u> do_include_all
-bind .   <$M1B-Key-U> do_include_all
+bind .   <$M1B-Key-i> do_include_all
+bind .   <$M1B-Key-I> do_include_all
 bind .   <$M1B-Key-Return> do_commit
 bind all <$M1B-Key-q> do_quit
 bind all <$M1B-Key-Q> do_quit
@@ -1746,34 +1802,8 @@ foreach i [list $ui_index $ui_other] {
 }
 unset i M1B M1T
 
-######################################################################
-##
-## main
-
-set appname [lindex [file split $argv0] end]
-set gitdir {}
-
-if {[catch {set cdup [exec git rev-parse --show-cdup]} err]} {
-       show_msg {} . "Cannot find the git directory: $err"
-       exit 1
-}
-if {$cdup != ""} {
-       cd $cdup
-}
-unset cdup
-
-if {[catch {set gitdir [exec git rev-parse --git-dir]} err]} {
-       show_msg {} . "Cannot find the git directory: $err"
-       exit 1
-}
-
-if {$appname == {git-citool}} {
-       set single_commit 1
-}
-
 wm title . "$appname ([file normalize [file dirname $gitdir]])"
 focus -force $ui_comm
-load_repo_config
 load_all_remotes
 populate_remote_menu .mbar.fetch From fetch_from
 populate_remote_menu .mbar.push To push_to