The GTK+ coding style is basically the GNU coding style
(https://www.gnu.org/prep/standards_toc.html).
The Gnome libraries are less consistent, but lean
toward the Linux kernel coding style (documented in
/usr/src/linux/Documentation/CodingStyle on many
Linux systems).
The GTK+ style uses two-space indentation, puts all
braces on a new line, and leaves one space between
identifiers and opening parentheses, like this:
if (whatever)
{
foo (arg1, arg2);
}
|
Emacs uses this style by default.
The Gnome style uses eight-space indentation and
Kernighan and Ritchie braces, like so:
if (whatever) {
foo (arg1, arg2);
}
|
It also leaves a space between identifiers and opening
parentheses. To make Emacs use the Gnome style, add a
line like this to the top of your source files:
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
|
When preparing a patch for any piece of free software,
it's polite the style of the preexisting code. It's
customary to include a file called HACKING in source code distributions
addressing this and similar issues; read it if it
exists.