gdl-tools.h revision 70207641401debe608223aa2febe3c50f412bcbd
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This file is part of the GNOME Devtool Libraries
*
* Copyright (C) 1999-2000 Dave Camp <dave@helixcode.com>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __GDL_TOOLS_H__
#define __GDL_TOOLS_H__
#include <glib.h>
/* FIXME: Toggle this */
#define DO_GDL_TRACE
#ifdef DO_GDL_TRACE
#ifdef __GNUC__
#define GDL_TRACE() G_STMT_START { \
g_log (G_LOG_DOMAIN, \
"file %s: line %d (%s)", \
__FILE__, \
__LINE__, \
g_log (G_LOG_DOMAIN, \
"file %s: line %d (%s): "format, \
__FILE__, \
__LINE__, \
##args); } G_STMT_END
#else /* __GNUC__ */
#define GDL_TRACE() G_STMT_START { \
g_log (G_LOG_DOMAIN, \
"file %s: line %d", \
__FILE__, \
__LINE__); } G_STMT_END
g_log (G_LOG_DOMAIN, \
"file %s: line %d: "format, \
__FILE__, \
__LINE__, \
##args); } G_STMT_END
#endif /* __GNUC__ */
#else /* DO_GDL_TRACE */
#define GDL_TRACE()
#define GDL_TRACE_EXTRA()
#endif /* DO_GDL_TRACE */
/**
* Class boilerplate and base class call macros copied from
* bonobo/bonobo-macros.h. Original copyright follows.
*
* Author:
* Darin Adler <darin@bentspoon.com>
*
* Copyright 2001 Ben Tea Spoons, Inc.
*/
/* Macros for defining classes. Ideas taken from Nautilus and GOB. */
/* Define the boilerplate type stuff to reduce typos and code size. Defines
* the get_type method and the parent_class static variable. */
static void \
{ \
} \
GType \
type_as_function ## _get_type (void) \
{ \
static GType object_type = 0; \
if (object_type == 0) { \
static const GTypeInfo object_info = { \
NULL, /* base_init */ \
NULL, /* base_finalize */ \
NULL, /* class_finalize */ \
NULL, /* class_data */ \
sizeof (type), \
0, /* n_preallocs */ \
}; \
} \
return object_type; \
}
/* Just call the parent handler. This assumes that there is a variable
* named parent_class that points to the (duh!) parent class. Note that
* this macro is not to be used with things that return something, use
* the _WITH_DEFAULT version for that */
/* Same as above, but in case there is no implementation, it evaluates
* to def_return */
#define GDL_CALL_PARENT_WITH_DEFAULT(parent_class_cast, \
/* Define the boilerplate type stuff to reduce typos and code size. Defines
* the get_type method and the parent_class static variable. */
/* GdlPixmap structure and method have been copied from Evolution. */
typedef struct _GdlPixmap {
const char *path;
const char *fname;
char *pixbuf;
} GdlPixmap;
#endif