@matheusbsbs / matheus-bagliano / commits / 68099eeeed
Fork 0

git-gui: Refactor about dialog code into its own module

The about dialog is getting somewhat long in size and will probably only get more complex as I try to improve upon its display. As the options dialog is even more complex than the about dialog we move the about dialog into its own module to reduce the complexity of the option dialog module. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Oct 5, 2007 at 08:38 UTC 68099eeeed161fd1adf0822de1dcb388663fc686
2 files changed +80 -78
lib/about.tcl new
+80
@@ -0,0 +1,80 @@
1 +# git-gui about git-gui dialog
2 +# Copyright (C) 2006, 2007 Shawn Pearce
3 +
4 +proc do_about {} {
5 + global appvers copyright oguilib
6 + global tcl_patchLevel tk_patchLevel
7 +
8 + set w .about_dialog
9 + toplevel $w
10 + wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
11 +
12 + label $w.header -text [mc "About %s" [appname]] \
13 + -font font_uibold
14 + pack $w.header -side top -fill x
15 +
16 + frame $w.buttons
17 + button $w.buttons.close -text {Close} \
18 + -default active \
19 + -command [list destroy $w]
20 + pack $w.buttons.close -side right
21 + pack $w.buttons -side bottom -fill x -pady 10 -padx 10
22 +
23 + label $w.desc \
24 + -text "[mc "git-gui - a graphical user interface for Git."]\n$copyright" \
25 + -padx 5 -pady 5 \
26 + -justify left \
27 + -anchor w \
28 + -borderwidth 1 \
29 + -relief solid
30 + pack $w.desc -side top -fill x -padx 5 -pady 5
31 +
32 + set v {}
33 + append v "git-gui version $appvers\n"
34 + append v "[git version]\n"
35 + append v "\n"
36 + if {$tcl_patchLevel eq $tk_patchLevel} {
37 + append v "Tcl/Tk version $tcl_patchLevel"
38 + } else {
39 + append v "Tcl version $tcl_patchLevel"
40 + append v ", Tk version $tk_patchLevel"
41 + }
42 +
43 + set d {}
44 + append d "git wrapper: $::_git\n"
45 + append d "git exec dir: [gitexec]\n"
46 + append d "git-gui lib: $oguilib"
47 +
48 + label $w.vers \
49 + -text $v \
50 + -padx 5 -pady 5 \
51 + -justify left \
52 + -anchor w \
53 + -borderwidth 1 \
54 + -relief solid
55 + pack $w.vers -side top -fill x -padx 5 -pady 5
56 +
57 + label $w.dirs \
58 + -text $d \
59 + -padx 5 -pady 5 \
60 + -justify left \
61 + -anchor w \
62 + -borderwidth 1 \
63 + -relief solid
64 + pack $w.dirs -side top -fill x -padx 5 -pady 5
65 +
66 + menu $w.ctxm -tearoff 0
67 + $w.ctxm add command \
68 + -label {Copy} \
69 + -command "
70 + clipboard clear
71 + clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
72 + "
73 +
74 + bind $w <Visibility> "grab $w; focus $w.buttons.close"
75 + bind $w <Key-Escape> "destroy $w"
76 + bind $w <Key-Return> "destroy $w"
77 + bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
78 + wm title $w "About [appname]"
79 + tkwait window $w
80 +}
lib/option.tcl
-78
@@ -54,84 +54,6 @@ proc save_config {} {
54 }
55 }
56
57 -proc do_about {} {
58 - global appvers copyright oguilib
59 - global tcl_patchLevel tk_patchLevel
60 -
61 - set w .about_dialog
62 - toplevel $w
63 - wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
64 -
65 - label $w.header -text [mc "About %s" [appname]] \
66 - -font font_uibold
67 - pack $w.header -side top -fill x
68 -
69 - frame $w.buttons
70 - button $w.buttons.close -text {Close} \
71 - -default active \
72 - -command [list destroy $w]
73 - pack $w.buttons.close -side right
74 - pack $w.buttons -side bottom -fill x -pady 10 -padx 10
75 -
76 - label $w.desc \
77 - -text "[mc "git-gui - a graphical user interface for Git."]\n$copyright" \
78 - -padx 5 -pady 5 \
79 - -justify left \
80 - -anchor w \
81 - -borderwidth 1 \
82 - -relief solid
83 - pack $w.desc -side top -fill x -padx 5 -pady 5
84 -
85 - set v {}
86 - append v "git-gui version $appvers\n"
87 - append v "[git version]\n"
88 - append v "\n"
89 - if {$tcl_patchLevel eq $tk_patchLevel} {
90 - append v "Tcl/Tk version $tcl_patchLevel"
91 - } else {
92 - append v "Tcl version $tcl_patchLevel"
93 - append v ", Tk version $tk_patchLevel"
94 - }
95 -
96 - set d {}
97 - append d "git wrapper: $::_git\n"
98 - append d "git exec dir: [gitexec]\n"
99 - append d "git-gui lib: $oguilib"
100 -
101 - label $w.vers \
102 - -text $v \
103 - -padx 5 -pady 5 \
104 - -justify left \
105 - -anchor w \
106 - -borderwidth 1 \
107 - -relief solid
108 - pack $w.vers -side top -fill x -padx 5 -pady 5
109 -
110 - label $w.dirs \
111 - -text $d \
112 - -padx 5 -pady 5 \
113 - -justify left \
114 - -anchor w \
115 - -borderwidth 1 \
116 - -relief solid
117 - pack $w.dirs -side top -fill x -padx 5 -pady 5
118 -
119 - menu $w.ctxm -tearoff 0
120 - $w.ctxm add command \
121 - -label {Copy} \
122 - -command "
123 - clipboard clear
124 - clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
125 - "
126 -
127 - bind $w <Visibility> "grab $w; focus $w.buttons.close"
128 - bind $w <Key-Escape> "destroy $w"
129 - bind $w <Key-Return> "destroy $w"
130 - bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
131 - wm title $w "About [appname]"
132 - tkwait window $w
133 -}
134 -
57 proc do_options {} {
58 global repo_config global_config font_descs
59 global repo_config_new global_config_new