annotate CODING @ 747:8a743884483b

Use the same label for toolbar buttons tooltip than in main menu.
author zas_
date Fri, 23 May 2008 22:55:23 +0000
parents f20e7cebcb12
children 83d3abd80b64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
1 GPL header, in every file, like this:
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
2
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
3 /** @file relativ/path/with/this/file/name.c
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
4 * Short description of this file.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
5 * @author Author1
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
6 * @author Author2
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
7 *
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
8 * Optionaly detailed description of this file
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
9 * on more lines.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
10 */
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
11
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
12 /*
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
13 * This file is a part of Geeqie project (http://geeqie.sourceforge.net/).
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
14 * Copyright (C) 2008 Geeqie team
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
15 *
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
16 * This program is free software; you can redistribute it and/or modify
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
17 * it under the terms of the GNU General Public License as published by
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
18 * the Free Software Foundation; either version 2 of the License, or
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
19 * (at your option) any later version.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
20 *
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
21 * This program is distributed in the hope that it will be useful,
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
24 * GNU General Public License for more details.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
25 */
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
26
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
27 --------------------------------------------------------------------------------
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
28
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
29 svn change-log:
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
30
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
31 Use whole sentences begins with Capital letter. For each modification use new line.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
32 Or you can write the theme, colon and then every change on new line, begin
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
33 with "- ".
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
34
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
35 Example:
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
36
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
37 I done some bugfixes.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
38 Library:
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
39 - I change the interface
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
40 - added some new functions
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
41
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
42 --------------------------------------------------------------------------------
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
43
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
44 sources:
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
45
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
46 Indentation: tabs
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
47 Names of variables & functions: small_letters
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
48 of defines: CAPITAL_LETTERS
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
49
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
50 Try to use explicit variable and function names.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
51
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
52
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
53 Try not to use macros.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
54 Use EITHER "struct foo" OR "foo"; never both
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
55
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
56 Conditions, cycles:
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
57
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
58 if (<cond>)
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
59 {
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
60 <command>;
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
61 ...
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
62 <command>;
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
63 }
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
64 else
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
65 {
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
66 <command>;
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
67 ...
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
68 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
69 }
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
70
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
71 if (<cond_very_very_very_very_very_very_very_very_very_long> &&
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
72 <cond2very_very_very_very_very_very_very_very_very_long)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
73 <the_only_command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
74
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
75 switch (<var>)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
76 {
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
77 case 0:
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
78 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
79 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
80 break;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
81 case 1:
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
82 <command>; break;
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
83 }
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
84
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
85 for (i = 0; i <= 10; i++)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
86 {
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
87 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
88 ...
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
89 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
90 }
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
91
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
92
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
93 Functions:
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
94
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
95 int bar(<var_def>, <var_def>, <var_def>)
611
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
96 {
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
97 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
98 ...
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
99 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
100
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
101 return 0; // i.e. SUCCESS; if error, you must return minus <err_no>
611
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
102 }
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
103
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
104 void bar2(void)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
105 {
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
106 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
107 ...
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
108 <command>;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
109 }
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
110
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
111 Pragma: (Indentation 2 spaces)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
112
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
113 #ifdef ENABLE_NLS
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
114 # undef _
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
115 # define _(String) (String)
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
116 #endif /* ENABLE_NLS */
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
117
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
118 Headers:
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
119
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
120 #ifndef _FILENAME_H
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
121
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
122 --------------------------------------------------------------------------------
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
123
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
124 Use spaces around every operator (except ".", "->", "++" and "--");
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
125 unary operator '*' and '&' are missing the space from right;
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
126 (and also unary '-').
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
127 As you can see above, parentheses are closed to inside, i.e. " (blah blah) "
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
128 In "function(<var>)" there are no space before '('.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
129 You MAY use more tabs/spaces than you OUGHT TO (according to this CodingStyle), if
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
130 it makes your code nicer in being verticaly indented.
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
131
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
132 --------------------------------------------------------------------------------
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
133
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
134 Use glib types when possible (ie. gint and gchar instead of int and char).
611
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
135 Use glib functions when possible (ie. g_ascii_isspace() instead of isspace()).
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
136 Check if used functions are not deprecated.
f31ae0d9e163 Update CODING and HACKING files, and add po/README file for translators.
zas_
parents: 525
diff changeset
137
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
138 --------------------------------------------------------------------------------
524
7659ccaf2a74 Document the Geeqie coding style.
zas_
parents:
diff changeset
139
685
f20e7cebcb12 Updated CODING (GPL header, macros, svn change-log, ...).
bruclik
parents: 611
diff changeset
140 Documentation: use Doxygen