* 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
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
shorthand->query (shorthand, value, query_func, query_data);
}
+static void
+gtk_css_shorthand_property_unset_value (gpointer value)
+{
+ if (G_IS_VALUE (value))
+ g_value_unset (value);
+}
+
static gboolean
gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
GValue *value,
GFile *base)
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
- GValueArray *array;
+ GArray *array;
guint i;
- array = g_value_array_new (shorthand->subproperties->len);
- for (i = 0; i < shorthand->subproperties->len; i++)
- g_value_array_append (array, NULL);
+ array = g_array_new (FALSE, TRUE, sizeof (GValue));
+ g_array_set_clear_func (array, gtk_css_shorthand_property_unset_value);
+ g_array_set_size (array, shorthand->subproperties->len);
if (_gtk_css_parser_try (parser, "initial", TRUE))
{
*/
for (i = 0; i < shorthand->subproperties->len; i++)
{
- GValue *val = g_value_array_get_nth (array, i);
+ GValue *val = &g_array_index (array, GValue, i);
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INITIAL);
}
*/
for (i = 0; i < shorthand->subproperties->len; i++)
{
- GValue *val = g_value_array_get_nth (array, i);
+ GValue *val = &g_array_index (array, GValue, i);
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INHERIT);
}
}
- else if (!shorthand->parse (shorthand, array->values, parser, base))
+ else if (!shorthand->parse (shorthand, (GValue *) array->data, parser, base))
{
- g_value_array_free (array);
+ g_array_free (array, TRUE);
return FALSE;
}
* XXX: Is the default always initial or can it be inherit? */
for (i = 0; i < shorthand->subproperties->len; i++)
{
- GValue *val = g_value_array_get_nth (array, i);
+ GValue *val = &g_array_index (array, GValue, i);
if (G_IS_VALUE (val))
continue;
g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
g_value_set_enum (val, GTK_CSS_INITIAL);
}
- g_value_init (value, G_TYPE_VALUE_ARRAY);
- g_value_set_boxed (value, array);
+ g_value_init (value, G_TYPE_ARRAY);
+ g_value_take_boxed (value, array);
return TRUE;
}