1 # git-gui branch (create/delete) support
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc _error_parent
{} {
12 proc error_popup
{msg
} {
14 if {[reponame
] ne
{}} {
15 append title
" ([reponame])"
17 set cmd
[list tk_messageBox \
20 -title [append "$title: " [mc
"error"]] \
22 if {[winfo ismapped
[_error_parent
]]} {
23 lappend cmd
-parent [_error_parent
]
28 proc warn_popup
{msg
} {
30 if {[reponame
] ne
{}} {
31 append title
" ([reponame])"
33 set cmd
[list tk_messageBox \
36 -title [append "$title: " [mc
"warning"]] \
38 if {[winfo ismapped
[_error_parent
]]} {
39 lappend cmd
-parent [_error_parent
]
44 proc info_popup
{msg
} {
46 if {[reponame
] ne
{}} {
47 append title
" ([reponame])"
50 -parent [_error_parent
] \
57 proc ask_popup
{msg
} {
59 if {[reponame
] ne
{}} {
60 append title
" ([reponame])"
62 set cmd
[list tk_messageBox \
67 if {[winfo ismapped
[_error_parent
]]} {
68 lappend cmd
-parent [_error_parent
]
73 proc hook_failed_popup
{hook msg
{is_fatal
1}} {
80 ${NS
}::label $w.m.l1
-text "$hook hook failed:" \
89 -width 80 -height 10 \
91 -yscrollcommand [list $w.m.sby
set]
92 ${NS
}::scrollbar $w.m.sby
-command [list $w.m.t yview
]
93 pack $w.m.l1
-side top
-fill x
95 ${NS
}::label $w.m.l2
\
96 -text [mc
"You must correct the above errors before committing."] \
100 pack $w.m.l2
-side bottom
-fill x
102 pack $w.m.sby
-side right
-fill y
103 pack $w.m.t
-side left
-fill both
-expand 1
104 pack $w.m
-side top
-fill both
-expand 1 -padx 5 -pady 10
106 $w.m.t insert
1.0 $msg
107 $w.m.t conf
-state disabled
109 ${NS
}::button $w.ok
-text OK
\
111 -command "destroy $w"
112 pack $w.ok
-side bottom
-anchor e
-pady 10 -padx 10
114 bind $w <Visibility
> "grab $w; focus $w"
115 bind $w <Key-Return
> "destroy $w"
116 wm title
$w [strcat
"[appname] ([reponame]): " [mc
"error"]]