The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
2.6 KiB
125 lines
2.6 KiB
8 years ago
|
#include "dep2.h"
|
||
|
|
||
|
struct _MesonDep2
|
||
|
{
|
||
|
GObject parent_instance;
|
||
|
|
||
|
gchar *msg;
|
||
|
};
|
||
|
|
||
|
G_DEFINE_TYPE (MesonDep2, meson_dep2, G_TYPE_OBJECT)
|
||
|
|
||
|
enum {
|
||
|
PROP_0,
|
||
|
PROP_MSG,
|
||
|
LAST_PROP
|
||
|
};
|
||
|
|
||
|
static GParamSpec *gParamSpecs [LAST_PROP];
|
||
|
|
||
|
/**
|
||
|
* meson_dep2_new:
|
||
|
* @msg: The message to set.
|
||
|
*
|
||
|
* Allocates a new #MesonDep2.
|
||
|
*
|
||
|
* Returns: (transfer full): a #MesonDep2.
|
||
|
*/
|
||
|
MesonDep2 *
|
||
|
meson_dep2_new (const gchar *msg)
|
||
|
{
|
||
|
g_return_val_if_fail (msg != NULL, NULL);
|
||
|
|
||
|
return g_object_new (MESON_TYPE_DEP2,
|
||
|
"message", msg,
|
||
|
NULL);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
meson_dep2_finalize (GObject *object)
|
||
|
{
|
||
|
MesonDep2 *self = (MesonDep2 *)object;
|
||
|
|
||
|
g_clear_pointer (&self->msg, g_free);
|
||
|
|
||
|
G_OBJECT_CLASS (meson_dep2_parent_class)->finalize (object);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
meson_dep2_get_property (GObject *object,
|
||
|
guint prop_id,
|
||
|
GValue *value,
|
||
|
GParamSpec *pspec)
|
||
|
{
|
||
|
MesonDep2 *self = MESON_DEP2 (object);
|
||
|
|
||
|
switch (prop_id)
|
||
|
{
|
||
|
case PROP_MSG:
|
||
|
g_value_set_string (value, self->msg);
|
||
|
break;
|
||
|
default:
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
meson_dep2_set_property (GObject *object,
|
||
|
guint prop_id,
|
||
|
const GValue *value,
|
||
|
GParamSpec *pspec)
|
||
|
{
|
||
|
MesonDep2 *self = MESON_DEP2 (object);
|
||
|
|
||
|
switch (prop_id)
|
||
|
{
|
||
|
case PROP_MSG:
|
||
|
self->msg = g_value_dup_string (value);
|
||
|
break;
|
||
|
default:
|
||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
meson_dep2_class_init (MesonDep2Class *klass)
|
||
|
{
|
||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||
|
|
||
|
object_class->finalize = meson_dep2_finalize;
|
||
|
object_class->get_property = meson_dep2_get_property;
|
||
|
object_class->set_property = meson_dep2_set_property;
|
||
|
|
||
|
gParamSpecs [PROP_MSG] =
|
||
|
g_param_spec_string ("message",
|
||
|
"Message",
|
||
|
"The message to print.",
|
||
|
NULL,
|
||
|
(G_PARAM_READWRITE |
|
||
|
G_PARAM_CONSTRUCT_ONLY |
|
||
|
G_PARAM_STATIC_STRINGS));
|
||
|
|
||
|
g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
meson_dep2_init (MesonDep2 *self)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* meson_dep2_return_message:
|
||
|
* @self: a #MesonDep2.
|
||
|
*
|
||
|
* Returns the message.
|
||
|
*
|
||
|
* Returns: (transfer none): a const gchar*
|
||
|
*/
|
||
|
const gchar*
|
||
|
meson_dep2_return_message (MesonDep2 *self)
|
||
|
{
|
||
|
g_return_val_if_fail (MESON_IS_DEP2 (self), NULL);
|
||
|
|
||
|
return (const gchar*) self->msg;
|
||
|
}
|