1 /***************************************************************************
2 * brasero-layout-object.c
3 *
4 * dim oct 15 17:15:58 2006
5 * Copyright 2006 Philippe Rouquier
6 * bonfire-app@wanadoo.fr
7 ***************************************************************************/
8
9 /*
10 * Brasero is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * Brasero is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to:
22 * The Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor
24 * Boston, MA 02110-1301, USA.
25 */
26
27 #include "brasero-layout-object.h"
28
29 static void brasero_layout_object_base_init (gpointer g_class);
30
31 GType
brasero_layout_object_get_type()32 brasero_layout_object_get_type()
33 {
34 static GType type = 0;
35
36 if(type == 0) {
37 static const GTypeInfo our_info = {
38 sizeof (BraseroLayoutObjectIFace),
39 brasero_layout_object_base_init,
40 NULL,
41 NULL,
42 NULL,
43 NULL,
44 0,
45 0,
46 NULL,
47 };
48
49 type = g_type_register_static (G_TYPE_INTERFACE,
50 "BraseroLayoutObject",
51 &our_info,
52 0);
53
54 g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
55 }
56
57 return type;
58 }
59
60 static void
brasero_layout_object_base_init(gpointer g_class)61 brasero_layout_object_base_init (gpointer g_class)
62 {
63 static gboolean initialized = FALSE;
64
65 if (initialized)
66 return;
67
68 initialized = TRUE;
69 }
70
71 void
brasero_layout_object_get_proportion(BraseroLayoutObject * self,gint * header,gint * center,gint * footer)72 brasero_layout_object_get_proportion (BraseroLayoutObject *self,
73 gint *header,
74 gint *center,
75 gint *footer)
76 {
77 BraseroLayoutObjectIFace *iface;
78
79 g_return_if_fail (BRASERO_IS_LAYOUT_OBJECT (self));
80 g_return_if_fail (header != NULL && center != NULL && footer != NULL);
81
82 iface = BRASERO_LAYOUT_OBJECT_GET_IFACE (self);
83 if (iface->get_proportion)
84 (* iface->get_proportion) (self,
85 header,
86 center,
87 footer);
88 }
89
90 void
brasero_layout_object_set_context(BraseroLayoutObject * self,BraseroLayoutType type)91 brasero_layout_object_set_context (BraseroLayoutObject *self,
92 BraseroLayoutType type)
93 {
94 BraseroLayoutObjectIFace *iface;
95
96 g_return_if_fail (BRASERO_IS_LAYOUT_OBJECT (self));
97
98 iface = BRASERO_LAYOUT_OBJECT_GET_IFACE (self);
99 if (iface->set_context)
100 (* iface->set_context) (self, type);
101 }
102