1 /* embedded.c generated by valac, the Vala compiler
2 * generated from embedded.vala, do not modify */
3
4 /* embedded.vala
5 *
6 * Copyright (C) 2008-2009 Didier Villevalois
7 * Copyright (C) 2008-2012 Florian Brosch
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author:
24 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
25 */
26
27 #include "valadoc.h"
28 #include <stdlib.h>
29 #include <string.h>
30 #include <glib.h>
31 #include <glib/gstdio.h>
32
33 enum {
34 VALADOC_CONTENT_EMBEDDED_0_PROPERTY,
35 VALADOC_CONTENT_EMBEDDED_URL_PROPERTY,
36 VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY,
37 VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY,
38 VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY,
39 VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY,
40 VALADOC_CONTENT_EMBEDDED_NUM_PROPERTIES
41 };
42 static GParamSpec* valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_NUM_PROPERTIES];
43 #define _g_free0(var) (var = (g_free (var), NULL))
44 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
45
46 struct _ValadocContentEmbeddedPrivate {
47 gchar* _url;
48 gchar* _caption;
49 ValadocContentHorizontalAlign _horizontal_align;
50 ValadocContentVerticalAlign _vertical_align;
51 gchar* _style;
52 ValadocResourceLocator* _locator;
53 };
54
55 static gint ValadocContentEmbedded_private_offset;
56 static gpointer valadoc_content_embedded_parent_class = NULL;
57 static ValadocContentInlineIface * valadoc_content_embedded_valadoc_content_inline_parent_iface = NULL;
58 static ValadocContentStyleAttributesIface * valadoc_content_embedded_valadoc_content_style_attributes_parent_iface = NULL;
59
60 G_GNUC_INTERNAL ValadocContentEmbedded* valadoc_content_embedded_new (void);
61 G_GNUC_INTERNAL ValadocContentEmbedded* valadoc_content_embedded_construct (GType object_type);
62 static void valadoc_content_embedded_real_configure (ValadocContentContentElement* base,
63 ValadocSettings* settings,
64 ValadocResourceLocator* locator);
65 static void valadoc_content_embedded_real_check (ValadocContentContentElement* base,
66 ValadocApiTree* api_root,
67 ValadocApiNode* container,
68 const gchar* file_path,
69 ValadocErrorReporter* reporter,
70 ValadocSettings* settings);
71 static void valadoc_content_embedded_real_accept (ValadocContentContentElement* base,
72 ValadocContentContentVisitor* visitor);
73 static gboolean valadoc_content_embedded_real_is_empty (ValadocContentContentElement* base);
74 static ValadocContentContentElement* valadoc_content_embedded_real_copy (ValadocContentContentElement* base,
75 ValadocContentContentElement* new_parent);
76 G_GNUC_INTERNAL void valadoc_content_content_element_set_parent (ValadocContentContentElement* self,
77 ValadocContentContentElement* value);
78 static void valadoc_content_embedded_finalize (GObject * obj);
79 static GType valadoc_content_embedded_get_type_once (void);
80 static void _vala_valadoc_content_embedded_get_property (GObject * object,
81 guint property_id,
82 GValue * value,
83 GParamSpec * pspec);
84 static void _vala_valadoc_content_embedded_set_property (GObject * object,
85 guint property_id,
86 const GValue * value,
87 GParamSpec * pspec);
88
89 static inline gpointer
valadoc_content_embedded_get_instance_private(ValadocContentEmbedded * self)90 valadoc_content_embedded_get_instance_private (ValadocContentEmbedded* self)
91 {
92 return G_STRUCT_MEMBER_P (self, ValadocContentEmbedded_private_offset);
93 }
94
95 const gchar*
valadoc_content_embedded_get_url(ValadocContentEmbedded * self)96 valadoc_content_embedded_get_url (ValadocContentEmbedded* self)
97 {
98 const gchar* result;
99 const gchar* _tmp0_;
100 g_return_val_if_fail (self != NULL, NULL);
101 _tmp0_ = self->priv->_url;
102 result = _tmp0_;
103 return result;
104 }
105
106 void
valadoc_content_embedded_set_url(ValadocContentEmbedded * self,const gchar * value)107 valadoc_content_embedded_set_url (ValadocContentEmbedded* self,
108 const gchar* value)
109 {
110 gchar* old_value;
111 g_return_if_fail (self != NULL);
112 old_value = valadoc_content_embedded_get_url (self);
113 if (g_strcmp0 (value, old_value) != 0) {
114 gchar* _tmp0_;
115 _tmp0_ = g_strdup (value);
116 _g_free0 (self->priv->_url);
117 self->priv->_url = _tmp0_;
118 g_object_notify_by_pspec ((GObject *) self, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_URL_PROPERTY]);
119 }
120 }
121
122 const gchar*
valadoc_content_embedded_get_caption(ValadocContentEmbedded * self)123 valadoc_content_embedded_get_caption (ValadocContentEmbedded* self)
124 {
125 const gchar* result;
126 const gchar* _tmp0_;
127 g_return_val_if_fail (self != NULL, NULL);
128 _tmp0_ = self->priv->_caption;
129 result = _tmp0_;
130 return result;
131 }
132
133 void
valadoc_content_embedded_set_caption(ValadocContentEmbedded * self,const gchar * value)134 valadoc_content_embedded_set_caption (ValadocContentEmbedded* self,
135 const gchar* value)
136 {
137 gchar* old_value;
138 g_return_if_fail (self != NULL);
139 old_value = valadoc_content_embedded_get_caption (self);
140 if (g_strcmp0 (value, old_value) != 0) {
141 gchar* _tmp0_;
142 _tmp0_ = g_strdup (value);
143 _g_free0 (self->priv->_caption);
144 self->priv->_caption = _tmp0_;
145 g_object_notify_by_pspec ((GObject *) self, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY]);
146 }
147 }
148
149 static ValadocContentHorizontalAlign
valadoc_content_embedded_real_get_horizontal_align(ValadocContentStyleAttributes * base)150 valadoc_content_embedded_real_get_horizontal_align (ValadocContentStyleAttributes* base)
151 {
152 ValadocContentHorizontalAlign result;
153 ValadocContentEmbedded* self;
154 ValadocContentHorizontalAlign _tmp0_;
155 self = (ValadocContentEmbedded*) base;
156 _tmp0_ = self->priv->_horizontal_align;
157 result = _tmp0_;
158 return result;
159 }
160
161 static void
valadoc_content_embedded_real_set_horizontal_align(ValadocContentStyleAttributes * base,ValadocContentHorizontalAlign value)162 valadoc_content_embedded_real_set_horizontal_align (ValadocContentStyleAttributes* base,
163 ValadocContentHorizontalAlign value)
164 {
165 ValadocContentEmbedded* self;
166 ValadocContentHorizontalAlign old_value;
167 self = (ValadocContentEmbedded*) base;
168 old_value = valadoc_content_embedded_real_get_horizontal_align (base);
169 if (old_value != value) {
170 self->priv->_horizontal_align = value;
171 g_object_notify_by_pspec ((GObject *) self, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY]);
172 }
173 }
174
175 static ValadocContentVerticalAlign
valadoc_content_embedded_real_get_vertical_align(ValadocContentStyleAttributes * base)176 valadoc_content_embedded_real_get_vertical_align (ValadocContentStyleAttributes* base)
177 {
178 ValadocContentVerticalAlign result;
179 ValadocContentEmbedded* self;
180 ValadocContentVerticalAlign _tmp0_;
181 self = (ValadocContentEmbedded*) base;
182 _tmp0_ = self->priv->_vertical_align;
183 result = _tmp0_;
184 return result;
185 }
186
187 static void
valadoc_content_embedded_real_set_vertical_align(ValadocContentStyleAttributes * base,ValadocContentVerticalAlign value)188 valadoc_content_embedded_real_set_vertical_align (ValadocContentStyleAttributes* base,
189 ValadocContentVerticalAlign value)
190 {
191 ValadocContentEmbedded* self;
192 ValadocContentVerticalAlign old_value;
193 self = (ValadocContentEmbedded*) base;
194 old_value = valadoc_content_embedded_real_get_vertical_align (base);
195 if (old_value != value) {
196 self->priv->_vertical_align = value;
197 g_object_notify_by_pspec ((GObject *) self, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY]);
198 }
199 }
200
201 static const gchar*
valadoc_content_embedded_real_get_style(ValadocContentStyleAttributes * base)202 valadoc_content_embedded_real_get_style (ValadocContentStyleAttributes* base)
203 {
204 const gchar* result;
205 ValadocContentEmbedded* self;
206 const gchar* _tmp0_;
207 self = (ValadocContentEmbedded*) base;
208 _tmp0_ = self->priv->_style;
209 result = _tmp0_;
210 return result;
211 }
212
213 static void
valadoc_content_embedded_real_set_style(ValadocContentStyleAttributes * base,const gchar * value)214 valadoc_content_embedded_real_set_style (ValadocContentStyleAttributes* base,
215 const gchar* value)
216 {
217 ValadocContentEmbedded* self;
218 gchar* old_value;
219 self = (ValadocContentEmbedded*) base;
220 old_value = valadoc_content_embedded_real_get_style (base);
221 if (g_strcmp0 (value, old_value) != 0) {
222 gchar* _tmp0_;
223 _tmp0_ = g_strdup (value);
224 _g_free0 (self->priv->_style);
225 self->priv->_style = _tmp0_;
226 g_object_notify_by_pspec ((GObject *) self, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY]);
227 }
228 }
229
230 G_GNUC_INTERNAL ValadocContentEmbedded*
valadoc_content_embedded_construct(GType object_type)231 valadoc_content_embedded_construct (GType object_type)
232 {
233 ValadocContentEmbedded * self = NULL;
234 self = (ValadocContentEmbedded*) valadoc_content_content_element_construct (object_type);
235 return self;
236 }
237
238 G_GNUC_INTERNAL ValadocContentEmbedded*
valadoc_content_embedded_new(void)239 valadoc_content_embedded_new (void)
240 {
241 return valadoc_content_embedded_construct (VALADOC_CONTENT_TYPE_EMBEDDED);
242 }
243
244 static gpointer
_g_object_ref0(gpointer self)245 _g_object_ref0 (gpointer self)
246 {
247 return self ? g_object_ref (self) : NULL;
248 }
249
250 static void
valadoc_content_embedded_real_configure(ValadocContentContentElement * base,ValadocSettings * settings,ValadocResourceLocator * locator)251 valadoc_content_embedded_real_configure (ValadocContentContentElement* base,
252 ValadocSettings* settings,
253 ValadocResourceLocator* locator)
254 {
255 ValadocContentEmbedded * self;
256 ValadocResourceLocator* _tmp0_;
257 self = (ValadocContentEmbedded*) base;
258 g_return_if_fail (settings != NULL);
259 g_return_if_fail (locator != NULL);
260 _tmp0_ = _g_object_ref0 (locator);
261 _g_object_unref0 (self->priv->_locator);
262 self->priv->_locator = _tmp0_;
263 }
264
265 static void
valadoc_content_embedded_real_check(ValadocContentContentElement * base,ValadocApiTree * api_root,ValadocApiNode * container,const gchar * file_path,ValadocErrorReporter * reporter,ValadocSettings * settings)266 valadoc_content_embedded_real_check (ValadocContentContentElement* base,
267 ValadocApiTree* api_root,
268 ValadocApiNode* container,
269 const gchar* file_path,
270 ValadocErrorReporter* reporter,
271 ValadocSettings* settings)
272 {
273 ValadocContentEmbedded * self;
274 const gchar* _tmp0_;
275 const gchar* _tmp12_;
276 self = (ValadocContentEmbedded*) base;
277 g_return_if_fail (api_root != NULL);
278 g_return_if_fail (container != NULL);
279 g_return_if_fail (file_path != NULL);
280 g_return_if_fail (reporter != NULL);
281 g_return_if_fail (settings != NULL);
282 _tmp0_ = self->priv->_url;
283 if (!g_path_is_absolute (_tmp0_)) {
284 gchar* relative_to_file = NULL;
285 gchar* _tmp1_;
286 gchar* _tmp2_;
287 const gchar* _tmp3_;
288 gchar* _tmp4_;
289 gchar* _tmp5_;
290 const gchar* _tmp6_;
291 _tmp1_ = g_path_get_dirname (file_path);
292 _tmp2_ = _tmp1_;
293 _tmp3_ = self->priv->_url;
294 _tmp4_ = g_build_path (G_DIR_SEPARATOR_S, _tmp2_, _tmp3_, NULL);
295 _tmp5_ = _tmp4_;
296 _g_free0 (_tmp2_);
297 relative_to_file = _tmp5_;
298 _tmp6_ = relative_to_file;
299 if (g_file_test (_tmp6_, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
300 gchar* _tmp7_;
301 gchar* _tmp8_;
302 ValadocApiPackage* _tmp9_;
303 ValadocApiPackage* _tmp10_;
304 ValadocApiPackage* _tmp11_;
305 _tmp7_ = relative_to_file;
306 relative_to_file = NULL;
307 _tmp8_ = _tmp7_;
308 valadoc_content_embedded_set_url (self, _tmp8_);
309 _g_free0 (_tmp8_);
310 _tmp9_ = valadoc_documentation_get_package ((ValadocDocumentation*) container);
311 _tmp10_ = _tmp9_;
312 _tmp11_ = _g_object_ref0 (_tmp10_);
313 _g_object_unref0 (self->package);
314 self->package = _tmp11_;
315 _g_free0 (relative_to_file);
316 return;
317 }
318 _g_free0 (relative_to_file);
319 }
320 _tmp12_ = self->priv->_url;
321 if (!g_file_test (_tmp12_, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
322 gchar* base_name = NULL;
323 const gchar* _tmp13_;
324 gchar* _tmp14_;
325 gchar** _tmp15_;
326 gint _tmp15__length1;
327 gchar* _tmp25_ = NULL;
328 gchar* node_segment = NULL;
329 gchar* _tmp30_;
330 const gchar* _tmp31_;
331 gchar* _tmp32_;
332 gchar* _tmp33_;
333 const gchar* _tmp34_;
334 _tmp13_ = self->priv->_url;
335 _tmp14_ = g_path_get_basename (_tmp13_);
336 base_name = _tmp14_;
337 _tmp15_ = settings->alternative_resource_dirs;
338 _tmp15__length1 = settings->alternative_resource_dirs_length1;
339 {
340 gchar** dir_collection = NULL;
341 gint dir_collection_length1 = 0;
342 gint _dir_collection_size_ = 0;
343 gint dir_it = 0;
344 dir_collection = _tmp15_;
345 dir_collection_length1 = _tmp15__length1;
346 for (dir_it = 0; dir_it < dir_collection_length1; dir_it = dir_it + 1) {
347 const gchar* dir = NULL;
348 dir = dir_collection[dir_it];
349 {
350 gchar* alternative_path = NULL;
351 const gchar* _tmp16_;
352 const gchar* _tmp17_;
353 gchar* _tmp18_;
354 const gchar* _tmp19_;
355 _tmp16_ = dir;
356 _tmp17_ = base_name;
357 _tmp18_ = g_build_path (G_DIR_SEPARATOR_S, _tmp16_, _tmp17_, NULL);
358 alternative_path = _tmp18_;
359 _tmp19_ = alternative_path;
360 if (g_file_test (_tmp19_, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
361 gchar* _tmp20_;
362 gchar* _tmp21_;
363 ValadocApiPackage* _tmp22_;
364 ValadocApiPackage* _tmp23_;
365 ValadocApiPackage* _tmp24_;
366 _tmp20_ = alternative_path;
367 alternative_path = NULL;
368 _tmp21_ = _tmp20_;
369 valadoc_content_embedded_set_url (self, _tmp21_);
370 _g_free0 (_tmp21_);
371 _tmp22_ = valadoc_documentation_get_package ((ValadocDocumentation*) container);
372 _tmp23_ = _tmp22_;
373 _tmp24_ = _g_object_ref0 (_tmp23_);
374 _g_object_unref0 (self->package);
375 self->package = _tmp24_;
376 _g_free0 (alternative_path);
377 _g_free0 (base_name);
378 return;
379 }
380 _g_free0 (alternative_path);
381 }
382 }
383 }
384 if (VALADOC_API_IS_PACKAGE (container)) {
385 gchar* _tmp26_;
386 _tmp26_ = g_strdup ("");
387 _g_free0 (_tmp25_);
388 _tmp25_ = _tmp26_;
389 } else {
390 gchar* _tmp27_;
391 gchar* _tmp28_;
392 gchar* _tmp29_;
393 _tmp27_ = valadoc_api_node_get_full_name (container);
394 _tmp28_ = _tmp27_;
395 _tmp29_ = g_strconcat (_tmp28_, ": ", NULL);
396 _g_free0 (_tmp25_);
397 _tmp25_ = _tmp29_;
398 _g_free0 (_tmp28_);
399 }
400 _tmp30_ = g_strdup (_tmp25_);
401 node_segment = _tmp30_;
402 _tmp31_ = node_segment;
403 _tmp32_ = g_strdup_printf ("%s: %s{{", file_path, _tmp31_);
404 _tmp33_ = _tmp32_;
405 _tmp34_ = self->priv->_url;
406 valadoc_error_reporter_simple_error (reporter, _tmp33_, "'%s' does not exist", _tmp34_);
407 _g_free0 (_tmp33_);
408 _g_free0 (node_segment);
409 _g_free0 (_tmp25_);
410 _g_free0 (base_name);
411 } else {
412 ValadocApiPackage* _tmp35_;
413 ValadocApiPackage* _tmp36_;
414 ValadocApiPackage* _tmp37_;
415 _tmp35_ = valadoc_documentation_get_package ((ValadocDocumentation*) container);
416 _tmp36_ = _tmp35_;
417 _tmp37_ = _g_object_ref0 (_tmp36_);
418 _g_object_unref0 (self->package);
419 self->package = _tmp37_;
420 }
421 }
422
423 static void
valadoc_content_embedded_real_accept(ValadocContentContentElement * base,ValadocContentContentVisitor * visitor)424 valadoc_content_embedded_real_accept (ValadocContentContentElement* base,
425 ValadocContentContentVisitor* visitor)
426 {
427 ValadocContentEmbedded * self;
428 self = (ValadocContentEmbedded*) base;
429 g_return_if_fail (visitor != NULL);
430 valadoc_content_content_visitor_visit_embedded (visitor, self);
431 }
432
433 static gboolean
valadoc_content_embedded_real_is_empty(ValadocContentContentElement * base)434 valadoc_content_embedded_real_is_empty (ValadocContentContentElement* base)
435 {
436 ValadocContentEmbedded * self;
437 gboolean result = FALSE;
438 self = (ValadocContentEmbedded*) base;
439 result = FALSE;
440 return result;
441 }
442
443 static ValadocContentContentElement*
valadoc_content_embedded_real_copy(ValadocContentContentElement * base,ValadocContentContentElement * new_parent)444 valadoc_content_embedded_real_copy (ValadocContentContentElement* base,
445 ValadocContentContentElement* new_parent)
446 {
447 ValadocContentEmbedded * self;
448 ValadocContentEmbedded* embedded = NULL;
449 ValadocContentEmbedded* _tmp0_;
450 ValadocContentHorizontalAlign _tmp1_;
451 ValadocContentHorizontalAlign _tmp2_;
452 ValadocContentVerticalAlign _tmp3_;
453 ValadocContentVerticalAlign _tmp4_;
454 ValadocResourceLocator* _tmp5_;
455 ValadocResourceLocator* _tmp6_;
456 const gchar* _tmp7_;
457 ValadocApiPackage* _tmp8_;
458 ValadocApiPackage* _tmp9_;
459 const gchar* _tmp10_;
460 const gchar* _tmp11_;
461 const gchar* _tmp12_;
462 ValadocContentContentElement* result = NULL;
463 self = (ValadocContentEmbedded*) base;
464 _tmp0_ = valadoc_content_embedded_new ();
465 embedded = _tmp0_;
466 valadoc_content_content_element_set_parent ((ValadocContentContentElement*) embedded, new_parent);
467 _tmp1_ = valadoc_content_style_attributes_get_horizontal_align ((ValadocContentStyleAttributes*) self);
468 _tmp2_ = _tmp1_;
469 valadoc_content_style_attributes_set_horizontal_align ((ValadocContentStyleAttributes*) embedded, _tmp2_);
470 _tmp3_ = valadoc_content_style_attributes_get_vertical_align ((ValadocContentStyleAttributes*) self);
471 _tmp4_ = _tmp3_;
472 valadoc_content_style_attributes_set_vertical_align ((ValadocContentStyleAttributes*) embedded, _tmp4_);
473 _tmp5_ = self->priv->_locator;
474 _tmp6_ = _g_object_ref0 (_tmp5_);
475 _g_object_unref0 (embedded->priv->_locator);
476 embedded->priv->_locator = _tmp6_;
477 _tmp7_ = self->priv->_caption;
478 valadoc_content_embedded_set_caption (embedded, _tmp7_);
479 _tmp8_ = self->package;
480 _tmp9_ = _g_object_ref0 (_tmp8_);
481 _g_object_unref0 (embedded->package);
482 embedded->package = _tmp9_;
483 _tmp10_ = valadoc_content_style_attributes_get_style ((ValadocContentStyleAttributes*) self);
484 _tmp11_ = _tmp10_;
485 valadoc_content_style_attributes_set_style ((ValadocContentStyleAttributes*) embedded, _tmp11_);
486 _tmp12_ = self->priv->_url;
487 valadoc_content_embedded_set_url (embedded, _tmp12_);
488 result = (ValadocContentContentElement*) embedded;
489 return result;
490 }
491
492 static void
valadoc_content_embedded_class_init(ValadocContentEmbeddedClass * klass,gpointer klass_data)493 valadoc_content_embedded_class_init (ValadocContentEmbeddedClass * klass,
494 gpointer klass_data)
495 {
496 valadoc_content_embedded_parent_class = g_type_class_peek_parent (klass);
497 g_type_class_adjust_private_offset (klass, &ValadocContentEmbedded_private_offset);
498 ((ValadocContentContentElementClass *) klass)->configure = (void (*) (ValadocContentContentElement*, ValadocSettings*, ValadocResourceLocator*)) valadoc_content_embedded_real_configure;
499 ((ValadocContentContentElementClass *) klass)->check = (void (*) (ValadocContentContentElement*, ValadocApiTree*, ValadocApiNode*, const gchar*, ValadocErrorReporter*, ValadocSettings*)) valadoc_content_embedded_real_check;
500 ((ValadocContentContentElementClass *) klass)->accept = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_embedded_real_accept;
501 ((ValadocContentContentElementClass *) klass)->is_empty = (gboolean (*) (ValadocContentContentElement*)) valadoc_content_embedded_real_is_empty;
502 ((ValadocContentContentElementClass *) klass)->copy = (ValadocContentContentElement* (*) (ValadocContentContentElement*, ValadocContentContentElement*)) valadoc_content_embedded_real_copy;
503 G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_content_embedded_get_property;
504 G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_content_embedded_set_property;
505 G_OBJECT_CLASS (klass)->finalize = valadoc_content_embedded_finalize;
506 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_EMBEDDED_URL_PROPERTY, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
507 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY] = g_param_spec_string ("caption", "caption", "caption", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
508 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY] = g_param_spec_enum ("horizontal-align", "horizontal-align", "horizontal-align", VALADOC_CONTENT_TYPE_HORIZONTAL_ALIGN, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
509 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY] = g_param_spec_enum ("vertical-align", "vertical-align", "vertical-align", VALADOC_CONTENT_TYPE_VERTICAL_ALIGN, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
510 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY, valadoc_content_embedded_properties[VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY] = g_param_spec_string ("style", "style", "style", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
511 }
512
513 static void
valadoc_content_embedded_valadoc_content_inline_interface_init(ValadocContentInlineIface * iface,gpointer iface_data)514 valadoc_content_embedded_valadoc_content_inline_interface_init (ValadocContentInlineIface * iface,
515 gpointer iface_data)
516 {
517 valadoc_content_embedded_valadoc_content_inline_parent_iface = g_type_interface_peek_parent (iface);
518 }
519
520 static void
valadoc_content_embedded_valadoc_content_style_attributes_interface_init(ValadocContentStyleAttributesIface * iface,gpointer iface_data)521 valadoc_content_embedded_valadoc_content_style_attributes_interface_init (ValadocContentStyleAttributesIface * iface,
522 gpointer iface_data)
523 {
524 valadoc_content_embedded_valadoc_content_style_attributes_parent_iface = g_type_interface_peek_parent (iface);
525 iface->get_horizontal_align = valadoc_content_embedded_real_get_horizontal_align;
526 iface->set_horizontal_align = valadoc_content_embedded_real_set_horizontal_align;
527 iface->get_vertical_align = valadoc_content_embedded_real_get_vertical_align;
528 iface->set_vertical_align = valadoc_content_embedded_real_set_vertical_align;
529 iface->get_style = valadoc_content_embedded_real_get_style;
530 iface->set_style = valadoc_content_embedded_real_set_style;
531 }
532
533 static void
valadoc_content_embedded_instance_init(ValadocContentEmbedded * self,gpointer klass)534 valadoc_content_embedded_instance_init (ValadocContentEmbedded * self,
535 gpointer klass)
536 {
537 self->priv = valadoc_content_embedded_get_instance_private (self);
538 }
539
540 static void
valadoc_content_embedded_finalize(GObject * obj)541 valadoc_content_embedded_finalize (GObject * obj)
542 {
543 ValadocContentEmbedded * self;
544 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_CONTENT_TYPE_EMBEDDED, ValadocContentEmbedded);
545 _g_free0 (self->priv->_url);
546 _g_free0 (self->priv->_caption);
547 _g_free0 (self->priv->_style);
548 _g_object_unref0 (self->package);
549 _g_object_unref0 (self->priv->_locator);
550 G_OBJECT_CLASS (valadoc_content_embedded_parent_class)->finalize (obj);
551 }
552
553 static GType
valadoc_content_embedded_get_type_once(void)554 valadoc_content_embedded_get_type_once (void)
555 {
556 static const GTypeInfo g_define_type_info = { sizeof (ValadocContentEmbeddedClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_content_embedded_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocContentEmbedded), 0, (GInstanceInitFunc) valadoc_content_embedded_instance_init, NULL };
557 static const GInterfaceInfo valadoc_content_inline_info = { (GInterfaceInitFunc) valadoc_content_embedded_valadoc_content_inline_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
558 static const GInterfaceInfo valadoc_content_style_attributes_info = { (GInterfaceInitFunc) valadoc_content_embedded_valadoc_content_style_attributes_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
559 GType valadoc_content_embedded_type_id;
560 valadoc_content_embedded_type_id = g_type_register_static (VALADOC_CONTENT_TYPE_CONTENT_ELEMENT, "ValadocContentEmbedded", &g_define_type_info, 0);
561 g_type_add_interface_static (valadoc_content_embedded_type_id, VALADOC_CONTENT_TYPE_INLINE, &valadoc_content_inline_info);
562 g_type_add_interface_static (valadoc_content_embedded_type_id, VALADOC_CONTENT_TYPE_STYLE_ATTRIBUTES, &valadoc_content_style_attributes_info);
563 ValadocContentEmbedded_private_offset = g_type_add_instance_private (valadoc_content_embedded_type_id, sizeof (ValadocContentEmbeddedPrivate));
564 return valadoc_content_embedded_type_id;
565 }
566
567 GType
valadoc_content_embedded_get_type(void)568 valadoc_content_embedded_get_type (void)
569 {
570 static volatile gsize valadoc_content_embedded_type_id__volatile = 0;
571 if (g_once_init_enter (&valadoc_content_embedded_type_id__volatile)) {
572 GType valadoc_content_embedded_type_id;
573 valadoc_content_embedded_type_id = valadoc_content_embedded_get_type_once ();
574 g_once_init_leave (&valadoc_content_embedded_type_id__volatile, valadoc_content_embedded_type_id);
575 }
576 return valadoc_content_embedded_type_id__volatile;
577 }
578
579 static void
_vala_valadoc_content_embedded_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)580 _vala_valadoc_content_embedded_get_property (GObject * object,
581 guint property_id,
582 GValue * value,
583 GParamSpec * pspec)
584 {
585 ValadocContentEmbedded * self;
586 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_CONTENT_TYPE_EMBEDDED, ValadocContentEmbedded);
587 switch (property_id) {
588 case VALADOC_CONTENT_EMBEDDED_URL_PROPERTY:
589 g_value_set_string (value, valadoc_content_embedded_get_url (self));
590 break;
591 case VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY:
592 g_value_set_string (value, valadoc_content_embedded_get_caption (self));
593 break;
594 case VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY:
595 g_value_set_enum (value, valadoc_content_style_attributes_get_horizontal_align ((ValadocContentStyleAttributes*) self));
596 break;
597 case VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY:
598 g_value_set_enum (value, valadoc_content_style_attributes_get_vertical_align ((ValadocContentStyleAttributes*) self));
599 break;
600 case VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY:
601 g_value_set_string (value, valadoc_content_style_attributes_get_style ((ValadocContentStyleAttributes*) self));
602 break;
603 default:
604 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
605 break;
606 }
607 }
608
609 static void
_vala_valadoc_content_embedded_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)610 _vala_valadoc_content_embedded_set_property (GObject * object,
611 guint property_id,
612 const GValue * value,
613 GParamSpec * pspec)
614 {
615 ValadocContentEmbedded * self;
616 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_CONTENT_TYPE_EMBEDDED, ValadocContentEmbedded);
617 switch (property_id) {
618 case VALADOC_CONTENT_EMBEDDED_URL_PROPERTY:
619 valadoc_content_embedded_set_url (self, g_value_get_string (value));
620 break;
621 case VALADOC_CONTENT_EMBEDDED_CAPTION_PROPERTY:
622 valadoc_content_embedded_set_caption (self, g_value_get_string (value));
623 break;
624 case VALADOC_CONTENT_EMBEDDED_HORIZONTAL_ALIGN_PROPERTY:
625 valadoc_content_style_attributes_set_horizontal_align ((ValadocContentStyleAttributes*) self, g_value_get_enum (value));
626 break;
627 case VALADOC_CONTENT_EMBEDDED_VERTICAL_ALIGN_PROPERTY:
628 valadoc_content_style_attributes_set_vertical_align ((ValadocContentStyleAttributes*) self, g_value_get_enum (value));
629 break;
630 case VALADOC_CONTENT_EMBEDDED_STYLE_PROPERTY:
631 valadoc_content_style_attributes_set_style ((ValadocContentStyleAttributes*) self, g_value_get_string (value));
632 break;
633 default:
634 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
635 break;
636 }
637 }
638
639