2 * Copyright (C) 2010 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3 of the License, or (at your option) any
8 * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the
17 PROP_SHORT_DESCRIPTION,
21 struct _LdmLayoutPrivate
24 gchar *short_description;
28 G_DEFINE_TYPE (LdmLayout, ldm_layout, G_TYPE_OBJECT);
33 * Create a new layout.
34 * @name: The layout name
35 * @short_description: Short description for the layout
36 * @description: Long description for the layout
38 * Return value: the new #LdmLayout
41 ldm_layout_new (const gchar *name, const gchar *short_description, const gchar *description)
43 return g_object_new (LDM_TYPE_LAYOUT, "name", name, "short-description", short_description, "description", description, NULL);
47 * ldm_layout_get_name:
48 * @layout: A #LdmLayout
50 * Get the name of a layout.
52 * Return value: The name of the layout
55 ldm_layout_get_name (LdmLayout *layout)
57 return layout->priv->name;
61 * ldm_layout_get_short_description:
62 * @layout: A #LdmLayout
64 * Get the short description of a layout.
66 * Return value: A short description of the layout
69 ldm_layout_get_short_description (LdmLayout *layout)
71 return layout->priv->short_description;
75 * ldm_layout_get_description:
76 * @layout: A #LdmLayout
78 * Get the long description of a layout.
80 * Return value: A long description of the layout
83 ldm_layout_get_description (LdmLayout *layout)
85 return layout->priv->description;
89 ldm_layout_init (LdmLayout *layout)
91 layout->priv = G_TYPE_INSTANCE_GET_PRIVATE (layout, LDM_TYPE_LAYOUT, LdmLayoutPrivate);
95 ldm_layout_set_property (GObject *object,
102 self = LDM_LAYOUT (object);
106 g_free (self->priv->name);
107 self->priv->name = g_strdup (g_value_get_string (value));
109 case PROP_SHORT_DESCRIPTION:
110 g_free (self->priv->short_description);
111 self->priv->short_description = g_strdup (g_value_get_string (value));
113 case PROP_DESCRIPTION:
114 g_free (self->priv->description);
115 self->priv->description = g_strdup (g_value_get_string (value));
118 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
124 ldm_layout_get_property (GObject *object,
131 self = LDM_LAYOUT (object);
135 g_value_set_string (value, ldm_layout_get_name (self));
137 case PROP_SHORT_DESCRIPTION:
138 g_value_set_string (value, ldm_layout_get_short_description (self));
140 case PROP_DESCRIPTION:
141 g_value_set_string (value, ldm_layout_get_description (self));
144 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
150 ldm_layout_class_init (LdmLayoutClass *klass)
152 GObjectClass *object_class = G_OBJECT_CLASS (klass);
154 g_type_class_add_private (klass, sizeof (LdmLayoutPrivate));
156 object_class->set_property = ldm_layout_set_property;
157 object_class->get_property = ldm_layout_get_property;
159 g_object_class_install_property(object_class,
161 g_param_spec_string("name",
163 "Name of the layout",
165 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
166 g_object_class_install_property(object_class,
167 PROP_SHORT_DESCRIPTION,
168 g_param_spec_string("short-description",
170 "Short description of the layout",
172 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
173 g_object_class_install_property(object_class,
175 g_param_spec_string("description",
177 "Long description of the layout",
179 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));