[zoomable] Fix Introspection data generation
[clutter-gtk] / clutter-gtk / gtk-clutter-zoomable.c
1 #if HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #include "gtk-clutter-zoomable.h"
6
7 #define I_(str) (g_intern_static_string ((str)))
8
9 /**
10  * SECTION:gtk-clutter-zoomable
11  * @short_description: Interface for zoomable actors
12  *
13  * FIXME
14  *
15  * #GtkClutterZoomable is available since Clutter-GTK 1.0
16  */
17
18 static void
19 gtk_clutter_zoomable_base_init (gpointer g_iface)
20 {
21   static gboolean is_initialized = FALSE;
22
23   if (G_UNLIKELY (!is_initialized))
24     {
25       GParamSpec *pspec;
26
27       /**
28        * GtkClutterZoomable:zadjustment:
29        *
30        * The #GtkAdjustment that determines the value of
31        * the zoom factor for this zoomable actor
32        *
33        * Since: 1.0
34        */
35       pspec = g_param_spec_object ("zadjustment",
36                                    "Zoom Adjustment",
37                                    "The GtkAdjustment that determines "
38                                    "the zoom factor",
39                                    GTK_TYPE_ADJUSTMENT,
40                                    G_PARAM_READWRITE |
41                                    G_PARAM_CONSTRUCT);
42       g_object_interface_install_property (g_iface, pspec);
43
44       is_initialized = TRUE;
45     }
46 }
47
48 GType
49 gtk_clutter_zoomable_get_type (void)
50 {
51   static GType zoomable_type = 0;
52
53   if (G_UNLIKELY (!zoomable_type))
54     {
55       const GTypeInfo zoomable_info =
56       {
57         sizeof (GtkClutterZoomableIface),
58         (GBaseInitFunc)     gtk_clutter_zoomable_base_init,
59         (GBaseFinalizeFunc) NULL,
60       };
61
62       zoomable_type = g_type_register_static (G_TYPE_INTERFACE,
63                                               I_("GtkClutterZoomable"),
64                                               &zoomable_info, 0);
65     }
66
67   return zoomable_type;
68 }
69
70 /**
71  * gtk_clutter_zoomable_set_adjustment:
72  * @zoomable: a #GtkClutterZoomable
73  * @z_adjust: (null-ok): a #GtkAdjustment, or %NULL
74  *
75  * Sets the adjustment used to determine the zoom factor of
76  * the zoomable actor
77  *
78  * Since: 1.0
79  */
80 void
81 gtk_clutter_zoomable_set_adjustment (GtkClutterZoomable *zoomable,
82                                      GtkAdjustment      *z_adjust)
83 {
84   GtkClutterZoomableIface *iface;
85
86   g_return_if_fail (GTK_CLUTTER_IS_ZOOMABLE (zoomable));
87   g_return_if_fail (z_adjust == NULL || GTK_IS_ADJUSTMENT (z_adjust));
88
89   iface = GTK_CLUTTER_ZOOMABLE_GET_IFACE (zoomable);
90   if (iface->set_adjustment)
91     iface->set_adjustment (zoomable, z_adjust);
92 }
93
94 /**
95  * gtk_clutter_zoomable_get_adjustment:
96  * @zoomable: a #GtkClutterZoomable
97  *
98  * Retrieves the adjustment used to determine the zoom factor of
99  * the zoomable actor
100  *
101  * Return value: (transfer none): a #GtkAdjustment
102  *
103  * Since: 1.0
104  */
105 GtkAdjustment *
106 gtk_clutter_zoomable_get_adjustment (GtkClutterZoomable *zoomable)
107 {
108   GtkClutterZoomableIface *iface;
109
110   g_return_val_if_fail (GTK_CLUTTER_IS_ZOOMABLE (zoomable), NULL);
111
112   iface = GTK_CLUTTER_ZOOMABLE_GET_IFACE (zoomable);
113   if (iface->get_adjustment)
114     return iface->get_adjustment (zoomable);
115
116   return NULL;
117 }