Fix incorrect wording in git-merge.txt.
[git/git-svn.git] / git-gui / lib / error.tcl
blob8c27678e3a45c011cfc6a21f5d53b0d87c66b4a6
1 # git-gui branch (create/delete) support
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc _error_parent {} {
5 set p [grab current .]
6 if {$p eq {}} {
7 return .
9 return $p
12 proc error_popup {msg} {
13 set title [appname]
14 if {[reponame] ne {}} {
15 append title " ([reponame])"
17 set cmd [list tk_messageBox \
18 -icon error \
19 -type ok \
20 -title [append "$title: " [mc "error"]] \
21 -message $msg]
22 if {[winfo ismapped [_error_parent]]} {
23 lappend cmd -parent [_error_parent]
25 eval $cmd
28 proc warn_popup {msg} {
29 set title [appname]
30 if {[reponame] ne {}} {
31 append title " ([reponame])"
33 set cmd [list tk_messageBox \
34 -icon warning \
35 -type ok \
36 -title [append "$title: " [mc "warning"]] \
37 -message $msg]
38 if {[winfo ismapped [_error_parent]]} {
39 lappend cmd -parent [_error_parent]
41 eval $cmd
44 proc info_popup {msg} {
45 set title [appname]
46 if {[reponame] ne {}} {
47 append title " ([reponame])"
49 tk_messageBox \
50 -parent [_error_parent] \
51 -icon info \
52 -type ok \
53 -title $title \
54 -message $msg
57 proc ask_popup {msg} {
58 set title [appname]
59 if {[reponame] ne {}} {
60 append title " ([reponame])"
62 set cmd [list tk_messageBox \
63 -icon question \
64 -type yesno \
65 -title $title \
66 -message $msg]
67 if {[winfo ismapped [_error_parent]]} {
68 lappend cmd -parent [_error_parent]
70 eval $cmd
73 proc hook_failed_popup {hook msg {is_fatal 1}} {
74 set w .hookfail
75 toplevel $w
77 frame $w.m
78 label $w.m.l1 -text "$hook hook failed:" \
79 -anchor w \
80 -justify left \
81 -font font_uibold
82 text $w.m.t \
83 -background white -borderwidth 1 \
84 -relief sunken \
85 -width 80 -height 10 \
86 -font font_diff \
87 -yscrollcommand [list $w.m.sby set]
88 scrollbar $w.m.sby -command [list $w.m.t yview]
89 pack $w.m.l1 -side top -fill x
90 if {$is_fatal} {
91 label $w.m.l2 \
92 -text [mc "You must correct the above errors before committing."] \
93 -anchor w \
94 -justify left \
95 -font font_uibold
96 pack $w.m.l2 -side bottom -fill x
98 pack $w.m.sby -side right -fill y
99 pack $w.m.t -side left -fill both -expand 1
100 pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
102 $w.m.t insert 1.0 $msg
103 $w.m.t conf -state disabled
105 button $w.ok -text OK \
106 -width 15 \
107 -command "destroy $w"
108 pack $w.ok -side bottom -anchor e -pady 10 -padx 10
110 bind $w <Visibility> "grab $w; focus $w"
111 bind $w <Key-Return> "destroy $w"
112 wm title $w [strcat "[appname] ([reponame]): " [mc "error"]]
113 tkwait window $w