view CODING @ 884:ff16ed0d2c8a

Improve ways to specify html browser (used for help, see bug 2015099). Two new rc file options were added: - helpers.html_browser.command_name - helpers.html_browser.command_line These are checked first before trying common browser locations. If these do not lead to a valid browser, then geeqie will search for geeqie_html_browser script in the path, then it will try various common browsers.
author zas_
date Sun, 13 Jul 2008 14:50:07 +0000
parents 83d3abd80b64
children 8b89e3ff286b
line wrap: on
line source

GPL header, in every file, like this:

/** @file relativ/path/with/this/file/name.c
 * Short description of this file.
 * @author Author1
 * @author Author2
 *
 * Optionaly detailed description of this file
 * on more lines.
 */
                                                                                
/*
 *  This file is a part of Geeqie project (http://geeqie.sourceforge.net/).
 *  Copyright (C) 2008 Geeqie team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 */

--------------------------------------------------------------------------------

svn change-log:

Use whole sentences begins with Capital letter. For each modification use new line.
Or you can write the theme, colon and then every change on new line, begin
with "- ".

Example:

I did some bugfixes.
Library:
- the interface was modified
- new functions were added

--------------------------------------------------------------------------------

sources:

Indentation: tabs
Names of variables & functions: small_letters
      of defines: CAPITAL_LETTERS

Try to use explicit variable and function names.


Try not to use macros.
Use EITHER "struct foo" OR "foo"; never both

Conditions, cycles:

if (<cond>)
	{
	<command>;
	...
	<command>;
	}
else
	{
	<command>;
	...
	<command>;
	}
                                                                                
if (<cond_very_very_very_very_very_very_very_very_very_long> &&
    <cond2very_very_very_very_very_very_very_very_very_long)
    <the_only_command>;

switch (<var>)
	{
	case 0:
		<command>;
		<command>;
		break;
	case 1:
		<command>; break;
	}

for (i = 0; i <= 10; i++)
	{
	<command>;
	...
	<command>;
	}
	

Functions:

gint bar(<var_def>, <var_def>, <var_def>)
{
	<command>;
	...
	<command>;

	return 0; // i.e. SUCCESS; if error, you must return minus <err_no>
}

void bar2(void)
{
	<command>;
	...
	<command>;
}

Pragma: (Indentation 2 spaces)

#ifdef ENABLE_NLS
#  undef _
#  define _(String) (String)
#endif /* ENABLE_NLS */

Headers:

#ifndef _FILENAME_H

--------------------------------------------------------------------------------

Use spaces around every operator (except ".", "->", "++" and "--");
        unary operator '*' and '&' are missing the space from right;
        (and also unary '-').
As you can see above, parentheses are closed to inside, i.e. " (blah blah) "
    In "function(<var>)" there are no space before '('. 
You MAY use more tabs/spaces than you OUGHT TO (according to this CodingStyle), if
        it makes your code nicer in being verticaly indented.
Variables declarations should be followed by a blank line and should always be
at the start of the block.

--------------------------------------------------------------------------------

Use glib types when possible (ie. gint and gchar instead of int and char).
Use glib functions when possible (ie. g_ascii_isspace() instead of isspace()).
Check if used functions are not deprecated.

--------------------------------------------------------------------------------

Documentation: use Doxygen