summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fbee850)
raw | patch | inline | side by side (parent: fbee850)
author | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 16 Nov 2006 03:35:26 +0000 (22:35 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sat, 18 Nov 2006 04:56:15 +0000 (23:56 -0500) |
If we are running on Windows we now offer a 'Create Desktop Icon' menu
item under the Project menu. This pops up a save dialog box letting
the user create a .bat file on their desktop (or somewhere else). The
.bat script will startup Cygwin with a login shell then launch git-gui
in the current working directory.
This is very useful for Windows users who have little to no desire to
start a command window just to run a git-gui session.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
item under the Project menu. This pops up a save dialog box letting
the user create a .bat file on their desktop (or somewhere else). The
.bat script will startup Cygwin with a login shell then launch git-gui
in the current working directory.
This is very useful for Windows users who have little to no desire to
start a command window just to run a git-gui session.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui | patch | blob | history |
index 7c2f803fec4551e6f0d2dbf24a5a2f73edf8d765..def6a5e070766ed42b1ef16d46c9e678fe07bc85 100755 (executable)
--- a/git-gui
+++ b/git-gui
destroy $w
}
+proc do_windows_shortcut {} {
+ global gitdir appname argv0
+
+ set reponame [lindex [file split \
+ [file normalize [file dirname $gitdir]]] \
+ end]
+
+ if {[catch {
+ set desktop [exec cygpath \
+ --windows \
+ --absolute \
+ --long-name \
+ --desktop]
+ }]} {
+ set desktop .
+ }
+ set fn [tk_getSaveFile \
+ -parent . \
+ -title "$appname ($reponame): Create Desktop Icon" \
+ -initialdir $desktop \
+ -initialfile "Git $reponame.bat"]
+ if {$fn != {}} {
+ if {[catch {
+ set fd [open $fn w]
+ set sh [exec cygpath \
+ --windows \
+ --absolute \
+ --long-name \
+ /bin/sh]
+ set me [exec cygpath \
+ --unix \
+ --absolute \
+ $argv0]
+ set gd [exec cygpath \
+ --unix \
+ --absolute \
+ $gitdir]
+ puts -nonewline $fd "\"$sh\" --login -c \""
+ puts -nonewline $fd "GIT_DIR=\\\"$gd\\\""
+ puts -nonewline $fd " \\\"$me\\\""
+ puts $fd "&\""
+ close $fd
+ } err]} {
+ error_popup "Cannot write script:\n\n$err"
+ }
+ }
+}
+
proc toggle_or_diff {w x y} {
global file_lists ui_index ui_other
global last_clicked selected_paths
.mbar.project add command -label {Repack Database} \
-command do_repack \
-font font_ui
+
+ if {$tcl_platform(platform) eq {windows}} {
+ .mbar.project add command \
+ -label {Create Desktop Icon} \
+ -command do_windows_shortcut \
+ -font font_ui
+ }
}
.mbar.project add command -label Quit \
-command do_quit \