1 # git-gui branch (create/delete) support
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc _error_parent
{} {
5 return [grab current .
]
8 proc error_popup
{msg
} {
10 if {[reponame
] ne
{}} {
11 append title
" ([reponame])"
13 set cmd
[list tk_messageBox \
16 -title [append "$title: " [mc
"error"]] \
18 if {[winfo ismapped
[_error_parent
]]} {
19 lappend cmd
-parent [_error_parent
]
24 proc warn_popup
{msg
} {
26 if {[reponame
] ne
{}} {
27 append title
" ([reponame])"
29 set cmd
[list tk_messageBox \
32 -title [append "$title: " [mc
"warning"]] \
34 if {[winfo ismapped
[_error_parent
]]} {
35 lappend cmd
-parent [_error_parent
]
40 proc info_popup
{msg
} {
42 if {[reponame
] ne
{}} {
43 append title
" ([reponame])"
53 proc ask_popup
{msg
} {
55 if {[reponame
] ne
{}} {
56 append title
" ([reponame])"
58 set cmd
[list tk_messageBox \
63 if {[winfo ismapped
[_error_parent
]]} {
64 lappend cmd
-parent [_error_parent
]
69 proc hook_failed_popup
{hook msg
{is_fatal
1}} {
74 label $w.m.l1
-text "$hook hook failed:" \
79 -background white
-borderwidth 1 \
81 -width 80 -height 10 \
83 -yscrollcommand [list $w.m.sby
set]
84 scrollbar $w.m.sby
-command [list $w.m.t yview
]
85 pack $w.m.l1
-side top
-fill x
88 -text [mc
"You must correct the above errors before committing."] \
92 pack $w.m.l2
-side bottom
-fill x
94 pack $w.m.sby
-side right
-fill y
95 pack $w.m.t
-side left
-fill both
-expand 1
96 pack $w.m
-side top
-fill both
-expand 1 -padx 5 -pady 10
98 $w.m.t insert
1.0 $msg
99 $w.m.t conf
-state disabled
101 button $w.ok
-text OK
\
103 -command "destroy $w"
104 pack $w.ok
-side bottom
-anchor e
-pady 10 -padx 10
106 bind $w <Visibility
> "grab $w; focus $w"
107 bind $w <Key-Return
> "destroy $w"
108 wm title
$w [strcat
"[appname] ([reponame]): " [mc
"error"]]