general: run uncrustify

And make the style of Nautilus the same for all files.
Hopefully we can fix all the style issues we can find in the next days,
so expect a little of movement on this.

https://bugzilla.gnome.org/show_bug.cgi?id=770564
parent 4cafccd8
/* check-program.c: A simple driver for eel self checks.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
see <http://www.gnu.org/licenses/>.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
*
* Copyright (C) 2000 Eazel, Inc.
*
* The Gnome Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Gnome Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Gnome Library; see the file COPYING.LIB. If not,
* see <http://www.gnu.org/licenses/>.
*
* Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
......@@ -32,27 +31,29 @@
#include <stdlib.h>
int
main (int argc, char *argv[])
main (int argc,
char *argv[])
{
#if !defined (EEL_OMIT_SELF_CHECK)
eel_make_warnings_and_criticals_stop_in_debugger ();
eel_make_warnings_and_criticals_stop_in_debugger ();
LIBXML_TEST_VERSION
gtk_init (&argc, &argv);
/* Run the checks for eel twice. */
LIBXML_TEST_VERSION
gtk_init (&argc,
&argv);
eel_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
/* Run the checks for eel twice. */
eel_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
eel_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
eel_debug_shut_down ();
eel_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
eel_debug_shut_down ();
#endif /* !EEL_OMIT_SELF_CHECK */
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
/* eel-accessibility.h - Utility functions for accessibility
Copyright (C) 2002 Anders Carlsson, Sun Microsystems, Inc.
The Eel Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Eel Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Eel Library; see the file COPYING.LIB. If not,
see <http://www.gnu.org/licenses/>.
Authors:
Anders Carlsson <andersca@gnu.org>
Michael Meeks <michael@ximian.com>
*/
*
* Copyright (C) 2002 Anders Carlsson, Sun Microsystems, Inc.
*
* The Eel Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Eel Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Eel Library; see the file COPYING.LIB. If not,
* see <http://www.gnu.org/licenses/>.
*
* Authors:
* Anders Carlsson <andersca@gnu.org>
* Michael Meeks <michael@ximian.com>
*/
#include <config.h>
#include <gtk/gtk.h>
#include <atk/atkrelationset.h>
#include <eel/eel-accessibility.h>
void
eel_accessibility_set_up_label_widget_relation (GtkWidget *label, GtkWidget *widget)
eel_accessibility_set_up_label_widget_relation (GtkWidget *label,
GtkWidget *widget)
{
AtkObject *atk_widget, *atk_label;
AtkObject *atk_widget, *atk_label;
atk_label = gtk_widget_get_accessible (label);
atk_widget = gtk_widget_get_accessible (widget);
atk_label = gtk_widget_get_accessible (label);
atk_widget = gtk_widget_get_accessible (widget);
/* Create the label -> widget relation */
atk_object_add_relationship (atk_label, ATK_RELATION_LABEL_FOR, atk_widget);
/* Create the label -> widget relation */
atk_object_add_relationship (atk_label, ATK_RELATION_LABEL_FOR, atk_widget);
/* Create the widget -> label relation */
atk_object_add_relationship (atk_widget, ATK_RELATION_LABELLED_BY, atk_label);
/* Create the widget -> label relation */
atk_object_add_relationship (atk_widget, ATK_RELATION_LABELLED_BY, atk_label);
}
static GQuark
get_quark_gobject (void)
{
static GQuark quark_accessible_gobject = 0;
static GQuark quark_accessible_gobject = 0;
if (!quark_accessible_gobject) {
quark_accessible_gobject = g_quark_from_static_string
("object-for-accessible");
}
if (!quark_accessible_gobject)
{
quark_accessible_gobject = g_quark_from_static_string
("object-for-accessible");
}
return quark_accessible_gobject;
return quark_accessible_gobject;
}
/**
* eel_accessibility_get_gobject:
* @object: an AtkObject
*
*
* gets the GObject associated with the AtkObject, for which
* @object provides accessibility support.
*
*
* Return value: the accessible's associated GObject
**/
gpointer
eel_accessibility_get_gobject (AtkObject *object)
{
return g_object_get_qdata (G_OBJECT (object), get_quark_gobject ());
return g_object_get_qdata (G_OBJECT (object), get_quark_gobject ());
}
static GailTextUtil *
get_simple_text (gpointer object)
{
GObject *gobject;
EelAccessibleTextIface *aif;
if (GTK_IS_ACCESSIBLE (object)) {
gobject = G_OBJECT (gtk_accessible_get_widget (GTK_ACCESSIBLE (object)));
} else {
gobject = eel_accessibility_get_gobject (object);
}
if (!gobject) {
return NULL;
}
aif = EEL_ACCESSIBLE_TEXT_GET_IFACE (gobject);
if (!aif) {
g_warning ("No accessible text inferface on '%s'",
g_type_name_from_instance ((gpointer) gobject));
} else if (aif->get_text) {
return aif->get_text (gobject);
}
return NULL;
GObject *gobject;
EelAccessibleTextIface *aif;
if (GTK_IS_ACCESSIBLE (object))
{
gobject = G_OBJECT (gtk_accessible_get_widget (GTK_ACCESSIBLE (object)));
}
else
{
gobject = eel_accessibility_get_gobject (object);
}
if (!gobject)
{
return NULL;
}
aif = EEL_ACCESSIBLE_TEXT_GET_IFACE (gobject);
if (!aif)
{
g_warning ("No accessible text inferface on '%s'",
g_type_name_from_instance ((gpointer) gobject));
}
else if (aif->get_text)
{
return aif->get_text (gobject);
}
return NULL;
}
char *
eel_accessibility_text_get_text (AtkText *text,
gint start_pos,
gint end_pos)
gint start_pos,
gint end_pos)
{
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
return gail_text_util_get_substring (util, start_pos, end_pos);
return gail_text_util_get_substring (util, start_pos, end_pos);
}
gunichar
gunichar
eel_accessibility_text_get_character_at_offset (AtkText *text,
gint offset)
gint offset)
{
char *txt, *index;
gint sucks1 = 0, sucks2 = -1;
gunichar c;
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, 0);
char *txt, *index;
gint sucks1 = 0, sucks2 = -1;
gunichar c;
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, 0);
txt = gail_text_util_get_substring (util, sucks1, sucks2);
txt = gail_text_util_get_substring (util, sucks1, sucks2);
index = g_utf8_offset_to_pointer (txt, offset);
c = g_utf8_get_char (index);
g_free (txt);
index = g_utf8_offset_to_pointer (txt, offset);
c = g_utf8_get_char (index);
g_free (txt);
return c;
return c;
}
char *
eel_accessibility_text_get_text_before_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
eel_accessibility_text_get_text_before_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
return gail_text_util_get_text (
util, NULL, GAIL_BEFORE_OFFSET,
boundary_type, offset, start_offset, end_offset);
return gail_text_util_get_text (
util, NULL, GAIL_BEFORE_OFFSET,
boundary_type, offset, start_offset, end_offset);
}
char *
eel_accessibility_text_get_text_at_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
eel_accessibility_text_get_text_at_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
return gail_text_util_get_text (
util, NULL, GAIL_AT_OFFSET,
boundary_type, offset, start_offset, end_offset);
return gail_text_util_get_text (
util, NULL, GAIL_AT_OFFSET,
boundary_type, offset, start_offset, end_offset);
}
gchar*
eel_accessibility_text_get_text_after_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
gchar *
eel_accessibility_text_get_text_after_offset (AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, NULL);
return gail_text_util_get_text (
util, NULL, GAIL_AFTER_OFFSET,
boundary_type, offset, start_offset, end_offset);
return gail_text_util_get_text (
util, NULL, GAIL_AFTER_OFFSET,
boundary_type, offset, start_offset, end_offset);
}
gint
eel_accessibility_text_get_character_count (AtkText *text)
{
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, -1);
GailTextUtil *util = get_simple_text (text);
g_return_val_if_fail (util != NULL, -1);
return gtk_text_buffer_get_char_count (util->buffer);
return gtk_text_buffer_get_char_count (util->buffer);
}
GType
eel_accessible_text_get_type (void)
{
static GType type = 0;
if (!type) {
const GTypeInfo tinfo = {
sizeof (AtkTextIface),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) NULL,
(GClassFinalizeFunc) NULL
};
type = g_type_register_static (
G_TYPE_INTERFACE, "EelAccessibleText", &tinfo, 0);
}
return type;
static GType type = 0;
if (!type)
{
const GTypeInfo tinfo =
{
sizeof (AtkTextIface),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) NULL,
(GClassFinalizeFunc) NULL
};
type = g_type_register_static (
G_TYPE_INTERFACE, "EelAccessibleText", &tinfo, 0);
}
return type;
}
/* eel-art-extensions.c - implementation of libart extension functions.
Copyright (C) 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
see <http://www.gnu.org/licenses/>.
Authors: Darin Adler <darin@eazel.com>
Ramiro Estrugo <ramiro@eazel.com>
*/
*
* Copyright (C) 2000 Eazel, Inc.
*
* The Gnome Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Gnome Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Gnome Library; see the file COPYING.LIB. If not,
* see <http://www.gnu.org/licenses/>.
*
* Authors: Darin Adler <darin@eazel.com>
* Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
......@@ -31,170 +30,185 @@ const EelDRect eel_drect_empty = { 0.0, 0.0, 0.0, 0.0 };
const EelIRect eel_irect_empty = { 0, 0, 0, 0 };
void
eel_irect_copy (EelIRect *dest, const EelIRect *src)
eel_irect_copy (EelIRect *dest,
const EelIRect *src)
{
dest->x0 = src->x0;
dest->y0 = src->y0;
dest->x1 = src->x1;
dest->y1 = src->y1;
dest->x0 = src->x0;
dest->y0 = src->y0;
dest->x1 = src->x1;
dest->y1 = src->y1;
}
void
eel_irect_union (EelIRect *dest,
const EelIRect *src1,
const EelIRect *src2) {
if (eel_irect_is_empty (src1)) {
eel_irect_copy (dest, src2);
} else if (eel_irect_is_empty (src2)) {
eel_irect_copy (dest, src1);
} else {
dest->x0 = MIN (src1->x0, src2->x0);
dest->y0 = MIN (src1->y0, src2->y0);
dest->x1 = MAX (src1->x1, src2->x1);
dest->y1 = MAX (src1->y1, src2->y1);
}
eel_irect_union (EelIRect *dest,
const EelIRect *src1,
const EelIRect *src2)
{
if (eel_irect_is_empty (src1))
{
eel_irect_copy (dest, src2);
}
else if (eel_irect_is_empty (src2))
{
eel_irect_copy (dest, src1);
}
else
{
dest->x0 = MIN (src1->x0, src2->x0);
dest->y0 = MIN (src1->y0, src2->y0);
dest->x1 = MAX (src1->x1, src2->x1);
dest->y1 = MAX (src1->y1, src2->y1);
}
}
void
eel_irect_intersect (EelIRect *dest,
const EelIRect *src1,
const EelIRect *src2)
eel_irect_intersect (EelIRect *dest,
const EelIRect *src1,
const EelIRect *src2)
{
dest->x0 = MAX (src1->x0, src2->x0);
dest->y0 = MAX (src1->y0, src2->y0);
dest->x1 = MIN (src1->x1, src2->x1);
dest->y1 = MIN (src1->y1, src2->y1);
dest->x0 = MAX (src1->x0, src2->x0);
dest->y0 = MAX (src1->y0, src2->y0);
dest->x1 = MIN (src1->x1, src2->x1);
dest->y1 = MIN (src1->y1, src2->y1);
}
gboolean
eel_irect_is_empty (const EelIRect *src)
{
return (src->x1 <= src->x0 ||
src->y1 <= src->y0);
return (src->x1 <= src->x0 ||
src->y1 <= src->y0);
}
/**
* eel_irect_get_width:
*
*
* @rectangle: An EelIRect.
*
* Returns: The width of the rectangle.
*
*
*/
int
eel_irect_get_width (EelIRect rectangle)
{
return rectangle.x1 - rectangle.x0;
return rectangle.x1 - rectangle.x0;
}
/**
* eel_irect_get_height:
*
*
* @rectangle: An EelIRect.
*
* Returns: The height of the rectangle.
*
*
*/
int
eel_irect_get_height (EelIRect rectangle)
{
return rectangle.y1 - rectangle.y0;
return rectangle.y1 - rectangle.y0;
}
static void
eel_drect_copy (EelDRect *dest,
const EelDRect *src)
eel_drect_copy (EelDRect *dest,
const EelDRect *src)
{
dest->x0 = src->x0;
dest->y0 = src->y0;
dest->x1 = src->x1;
dest->y1 = src->y1;
dest->x0 = src->x0;
dest->y0 = src->y0;
dest->x1 = src->x1;
dest->y1 = src->y1;
}
static gboolean
eel_drect_is_empty (const EelDRect *src)
{
return (src->x1 <= src->x0 || src->y1 <= src->y0);
return (src->x1 <= src->x0 || src->y1 <= src->y0);
}
void
eel_drect_union (EelDRect *dest,
const EelDRect *src1,
const EelDRect *src2)
eel_drect_union (EelDRect *dest,
const EelDRect *src1,
const EelDRect *src2)
{
if (eel_drect_is_empty (src1)) {
eel_drect_copy (dest, src2);
} else if (eel_drect_is_empty (src2)) {
eel_drect_copy (dest, src1);
} else {
dest->x0 = MIN (src1->x0, src2->x0);
dest->y0 = MIN (src1->y0, src2->y0);
dest->x1 = MAX (src1->x1, src2->x1);
dest->y1 = MAX (src1->y1, src2->y1);
}
if (eel_drect_is_empty (src1))
{
eel_drect_copy (dest, src2);
}
else if (eel_drect_is_empty (src2))
{
eel_drect_copy (dest, src1);
}
else
{
dest->x0 = MIN (src1->x0, src2->x0);
dest->y0 = MIN (src1->y0, src2->y0);
dest->x1 = MAX (src1->x1, src2->x1);
dest->y1 = MAX (src1->y1, src2->y1);
}
}
/**
* eel_irect_contains_point:
*
*
* @rectangle: An EelIRect.
* @x: X coordinate to test.
* @y: Y coordinate to test.
*
* Returns: A boolean value indicating whether the rectangle
* Returns: A boolean value indicating whether the rectangle
* contains the x,y coordinate.
*
*
*/
gboolean
eel_irect_contains_point (EelIRect rectangle,
int x,
int y)
int x,
int y)