Code

git-gui: Display error dialog on Mac OS X when no .git found.
authorShawn O. Pearce <spearce@spearce.org>
Sat, 18 Nov 2006 06:20:37 +0000 (01:20 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 18 Nov 2006 06:20:37 +0000 (01:20 -0500)
If we can't locate a .git directory for the given directory we need to
show a message to the user to let them know the directory wasn't found.
But since this is before we have shown our main application window we
cannot use that as the parent for the error popup; on Mac OS X this
causes an error and prevents the dialog from showing.

Instead only add -parent . to the popup call if we have mapped (shown)
the main window.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui

diff --git a/git-gui b/git-gui
index 472bcb7e32bee22cb58d5d7e5b0ad43a72c1c734..12a46e976c0c3f5f6fb366e1c0742e6e74ad6555 100755 (executable)
--- a/git-gui
+++ b/git-gui
@@ -130,12 +130,15 @@ proc error_popup {msg} {
                        end]
                append title {)}
        }
-       tk_messageBox \
-               -parent . \
+       set cmd [list tk_messageBox \
                -icon error \
                -type ok \
                -title "$title: error" \
-               -message $msg
+               -message $msg]
+       if {[winfo ismapped .]} {
+               lappend cmd -parent .
+       }
+       eval $cmd
 }
 
 proc info_popup {msg} {