grim/guifications3

added the install prefix to gflib-genheader
cmake
2010-12-13, Gary Kramlich
999ee3e165df
added the install prefix to gflib-genheader
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* 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 3 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <gflib/gf_object.h>
#include <gflib/gf_intl.h>
/******************************************************************************
* Enums
*****************************************************************************/
enum {
SIG_DESTROY = 0,
SIGS
};
/******************************************************************************
* Globals
*****************************************************************************/
static GObjectClass *parent_class = NULL;
static guint signals[SIGS] = { 0 };
/******************************************************************************
* Helpers
*****************************************************************************/
static void
gf_object_dispose(GObject *obj) {
GfObject *self = GF_OBJECT(obj);
if(!(GF_OBJECT_FLAGS(self) & GF_OBJECT_DESTROYING)) {
GF_OBJECT_SET_FLAGS(self, GF_OBJECT_DESTROYING);
g_signal_emit(self, signals[SIG_DESTROY], 0);
GF_OBJECT_UNSET_FLAGS(self, GF_OBJECT_DESTROYING);
}
parent_class->dispose(obj);
}
static void
gf_object_class_init(GfObjectClass *klass) {
GObjectClass *obj_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
obj_class->dispose = gf_object_dispose;
klass->destroy = gf_object_destroy;
signals[SIG_DESTROY] =
g_signal_new("destroy",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GfObjectClass, destroy),
NULL, NULL,
gf_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
/******************************************************************************
* GfObject API
*****************************************************************************/
GType
gf_object_get_type(void) {
static GType type = 0;
if(type == 0) {
static const GTypeInfo info = {
sizeof(GfObjectClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc)gf_object_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(GfObject),
0, /* n_preallocs */
NULL, /* instance_init */
};
type = g_type_register_static(G_TYPE_OBJECT,
"GfObject",
&info, G_TYPE_FLAG_ABSTRACT);
}
return type;
}
/**
* gf_object_destroy:
* @obj: The #GfObject instance.
*
* Emits the "destroy" signal notifying all reference holders that they
* should release @obj.
*/
void
gf_object_destroy(GfObject *obj) {
g_return_if_fail(GF_IS_OBJECT(obj));
if(!(GF_OBJECT_FLAGS(obj) & GF_OBJECT_DESTROYING))
g_object_run_dispose(G_OBJECT(obj));
}