1 /* Fo
2  * fo-property-padding-before-conditionality.c: 'padding-before-conditionality' property
3  *
4  * Copyright (C) 2001 Sun Microsystems
5  * Copyright (C) 2007 Menteith Consulting Ltd
6  *
7  * See COPYING for the status of this software.
8  */
9 
10 #include <string.h>
11 #include "fo-utils.h"
12 #include "fo-context.h"
13 #include "datatype/fo-datatype.h"
14 #include "property/fo-property-type-condity-private.h"
15 #include "property/fo-property-font-size.h"
16 #include "property/fo-property-padding-before-conditionality.h"
17 
18 /* padding-before-condity */
19 /* Inherited: FALSE */
20 /* Shorthand: FALSE */
21 /* discard | retain */
22 /* Initial value: discard */
23 
24 struct _FoPropertyPaddingBeforeCondity
25 {
26   FoPropertyTypeCondity parent_instance;
27 };
28 
29 struct _FoPropertyPaddingBeforeCondityClass
30 {
31   FoPropertyTypeCondityClass parent_class;
32 };
33 
34 static void fo_property_padding_before_condity_class_init   (FoPropertyPaddingBeforeCondityClass *klass);
35 
36 static const gchar class_name[] = "padding-before-condity";
37 
38 /**
39  * fo_property_padding_before_condity_get_type:
40  *
41  * Register the #FoPropertyPaddingBeforeCondity type if not already registered and
42  * return its #GType value.
43  *
44  * Return value: #GType of #FoPropertyPaddingBeforeCondity.
45  **/
46 GType
fo_property_padding_before_condity_get_type(void)47 fo_property_padding_before_condity_get_type (void)
48 {
49   static GType object_type = 0;
50 
51   if (!object_type)
52     {
53       static const GTypeInfo object_info =
54       {
55         sizeof (FoPropertyPaddingBeforeCondityClass),
56         NULL,           /* base_init */
57         NULL,           /* base_finalize */
58         (GClassInitFunc) fo_property_padding_before_condity_class_init,
59         NULL,           /* class_finalize */
60         NULL,           /* class_data */
61         sizeof (FoPropertyPaddingBeforeCondity),
62         0,              /* n_preallocs */
63         (GInstanceInitFunc) fo_property_type_condity_init,
64 	NULL		/* value_table */
65       };
66 
67       object_type = g_type_register_static (FO_TYPE_PROPERTY_TYPE_CONDITY,
68                                             class_name,
69                                             &object_info, 0);
70     }
71 
72   return object_type;
73 }
74 
75 /**
76  * fo_property_padding_before_condity_class_init:
77  * @klass: #FoPropertyPaddingBeforeCondityClass object to initialise.
78  *
79  * Implements #GClassInitFunc for #FoPropertyPaddingBeforeCondityClass.
80  **/
81 void
fo_property_padding_before_condity_class_init(FoPropertyPaddingBeforeCondityClass * klass)82 fo_property_padding_before_condity_class_init (FoPropertyPaddingBeforeCondityClass *klass)
83 {
84   FoPropertyClass *property_class = FO_PROPERTY_CLASS (klass);
85 
86   property_class->get_initial =
87     fo_property_padding_before_condity_get_initial;
88 }
89 
90 /**
91  * fo_property_padding_before_condity_new:
92  *
93  * Creates a new #FoPropertyPaddingBeforeCondity initialized to default value.
94  *
95  * Return value: the new #FoPropertyPaddingBeforeCondity.
96  **/
97 FoProperty*
fo_property_padding_before_condity_new(void)98 fo_property_padding_before_condity_new (void)
99 {
100   FoProperty* padding_before_condity;
101 
102   padding_before_condity =
103     FO_PROPERTY (g_object_new (fo_property_padding_before_condity_get_type (),
104                                NULL));
105 
106   return padding_before_condity;
107 }
108 
109 /**
110  * fo_property_padding_before_condity_get_initial:
111  *
112  * Get an instance of the property with the correct initial value.
113  *
114  * Return value: An instance of the property.
115  **/
116 FoProperty*
fo_property_padding_before_condity_get_initial(void)117 fo_property_padding_before_condity_get_initial (void)
118 {
119   static FoProperty *padding_before_condity = NULL;
120 
121   if (padding_before_condity == NULL)
122     {
123       padding_before_condity =
124 	fo_property_padding_before_condity_new ();
125     }
126 
127   return padding_before_condity;
128 }
129