]> Pileus Git - ~andy/gtk/blob - gtk/gtkcssinitialvalue.c
styleproperty: Make _gtk_style_property_parse_value() return a CssValue
[~andy/gtk] / gtk / gtkcssinitialvalue.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2011 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "config.h"
19
20 #include "gtkcssinitialvalueprivate.h"
21
22 struct _GtkCssValue {
23   GTK_CSS_VALUE_BASE
24 };
25
26 static void
27 gtk_css_value_initial_free (GtkCssValue *value)
28 {
29   /* Can only happen if the unique value gets unreffed too often */
30   g_assert_not_reached ();
31 }
32
33 static void
34 gtk_css_value_initial_print (const GtkCssValue *value,
35                              GString           *string)
36 {
37   g_string_append (string, "initial");
38 }
39
40 static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
41   gtk_css_value_initial_free,
42   gtk_css_value_initial_print
43 };
44
45 static GtkCssValue initial = { &GTK_CSS_VALUE_INITIAL, 1 };
46
47 GtkCssValue *
48 _gtk_css_initial_value_new (void)
49 {
50   return _gtk_css_value_ref (&initial);
51 }
52
53 gboolean
54 _gtk_css_value_is_initial (const GtkCssValue *value)
55 {
56   g_return_val_if_fail (value != NULL, FALSE);
57
58   return value == &initial;
59 }