Branch data Line data Source code
1 : : // SPDX-License-Identifier: GPL-3.0-or-later
2 : : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
3 : :
4 : : #define G_LOG_DOMAIN "valent-resource"
5 : :
6 : : #include "config.h"
7 : :
8 : : #include <gio/gio.h>
9 : :
10 : : #include "valent-object.h"
11 : :
12 : : #include "valent-resource.h"
13 : :
14 : : /**
15 : : * ValentResource:
16 : : *
17 : : * `ValentResource` is an interface that represents a resource.
18 : : *
19 : : * It is based on the properties in the elements namespace of the Dublin Core
20 : : * DCMI Metadata Terms, primarily to represent SPARQL resources and runtime
21 : : * objects with similar semantics.
22 : : *
23 : : * See: https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#section-3
24 : : *
25 : : * Since: 1.0
26 : : */
27 : :
28 : : typedef struct
29 : : {
30 : : GStrv contributor;
31 : : char *coverage;
32 : : char *creator;
33 : : GDateTime *date;
34 : : char *description;
35 : : char *format;
36 : : char *identifier;
37 : : char *iri;
38 : : char *language;
39 : : char *publisher;
40 : : GStrv relation;
41 : : char *rights;
42 : : ValentResource *source;
43 : : char *subject;
44 : : char *title;
45 : : char *type_hint;
46 : : } ValentResourcePrivate;
47 : :
48 [ + + + - ]: 7842 : G_DEFINE_TYPE_WITH_PRIVATE (ValentResource, valent_resource, VALENT_TYPE_OBJECT)
49 : :
50 : : typedef enum
51 : : {
52 : : PROP_CONTRIBUTOR = 1,
53 : : PROP_COVERAGE,
54 : : PROP_CREATOR,
55 : : PROP_DATE,
56 : : PROP_DESCRIPTION,
57 : : PROP_FORMAT,
58 : : PROP_IDENTIFIER,
59 : : PROP_IRI,
60 : : PROP_LANGUAGE,
61 : : PROP_PUBLISHER,
62 : : PROP_RELATION,
63 : : PROP_RIGHTS,
64 : : PROP_SOURCE,
65 : : PROP_SUBJECT,
66 : : PROP_TITLE,
67 : : PROP_TYPE_HINT,
68 : : } ValentResourceProperty;
69 : :
70 : : static GParamSpec *properties[PROP_TYPE_HINT + 1] = { NULL, };
71 : :
72 : : static void
73 : 250 : on_source_destroyed (ValentObject *object,
74 : : ValentResource *self)
75 : : {
76 : 250 : valent_resource_set_source (VALENT_RESOURCE (self), NULL);
77 : 250 : }
78 : :
79 : : /*
80 : : * ValentResource
81 : : */
82 : : static void
83 : 1 : valent_resource_real_update (ValentResource *resource,
84 : : ValentResource *update)
85 : : {
86 [ + - ]: 1 : g_assert (VALENT_IS_RESOURCE (resource));
87 [ - + ]: 1 : g_assert (VALENT_IS_RESOURCE (update));
88 : 1 : }
89 : :
90 : : /*
91 : : * GObject
92 : : */
93 : : static void
94 : 581 : valent_resource_finalize (GObject *object)
95 : : {
96 : 581 : ValentResource *self = VALENT_RESOURCE (object);
97 : 581 : ValentResourcePrivate *priv = valent_resource_get_instance_private (self);
98 : :
99 [ - + ]: 581 : g_clear_pointer (&priv->contributor, g_strfreev);
100 [ + + ]: 581 : g_clear_pointer (&priv->coverage, g_free);
101 [ + + ]: 581 : g_clear_pointer (&priv->creator, g_free);
102 [ + + ]: 581 : g_clear_pointer (&priv->date, g_date_time_unref);
103 [ + + ]: 581 : g_clear_pointer (&priv->description, g_free);
104 [ + + ]: 581 : g_clear_pointer (&priv->format, g_free);
105 [ + + ]: 581 : g_clear_pointer (&priv->identifier, g_free);
106 [ + + ]: 581 : g_clear_pointer (&priv->iri, g_free);
107 [ + + ]: 581 : g_clear_pointer (&priv->language, g_free);
108 [ + + ]: 581 : g_clear_pointer (&priv->publisher, g_free);
109 [ - + ]: 581 : g_clear_pointer (&priv->relation, g_strfreev);
110 [ + + ]: 581 : g_clear_pointer (&priv->rights, g_free);
111 [ + + ]: 581 : g_clear_pointer (&priv->subject, g_free);
112 [ + + ]: 581 : g_clear_pointer (&priv->title, g_free);
113 [ + + ]: 581 : g_clear_pointer (&priv->type_hint, g_free);
114 : :
115 : 581 : G_OBJECT_CLASS (valent_resource_parent_class)->finalize (object);
116 : 581 : }
117 : :
118 : : static void
119 : 62 : valent_resource_get_property (GObject *object,
120 : : guint prop_id,
121 : : GValue *value,
122 : : GParamSpec *pspec)
123 : : {
124 : 62 : ValentResource *self = VALENT_RESOURCE (object);
125 : 62 : ValentResourcePrivate *priv = valent_resource_get_instance_private (self);
126 : :
127 [ + + + + : 62 : switch ((ValentResourceProperty)prop_id)
+ + + + +
+ + + + +
+ + - ]
128 : : {
129 : 1 : case PROP_CONTRIBUTOR:
130 : 1 : g_value_set_boxed (value, priv->contributor);
131 : 1 : break;
132 : :
133 : 1 : case PROP_COVERAGE:
134 : 1 : g_value_set_string (value, priv->coverage);
135 : 1 : break;
136 : :
137 : 1 : case PROP_CREATOR:
138 : 1 : g_value_set_string (value, priv->creator);
139 : 1 : break;
140 : :
141 : 1 : case PROP_DATE:
142 : 1 : g_value_set_boxed (value, priv->date);
143 : 1 : break;
144 : :
145 : 1 : case PROP_DESCRIPTION:
146 : 1 : g_value_set_string (value, priv->description);
147 : 1 : break;
148 : :
149 : 1 : case PROP_FORMAT:
150 : 1 : g_value_set_string (value, priv->format);
151 : 1 : break;
152 : :
153 : 1 : case PROP_IDENTIFIER:
154 : 1 : g_value_set_string (value, priv->identifier);
155 : 1 : break;
156 : :
157 : 35 : case PROP_IRI:
158 : 35 : g_value_set_string (value, priv->iri);
159 : 35 : break;
160 : :
161 : 1 : case PROP_LANGUAGE:
162 : 1 : g_value_set_string (value, priv->language);
163 : 1 : break;
164 : :
165 : 1 : case PROP_PUBLISHER:
166 : 1 : g_value_set_string (value, priv->publisher);
167 : 1 : break;
168 : :
169 : 1 : case PROP_RELATION:
170 : 1 : g_value_set_boxed (value, priv->relation);
171 : 1 : break;
172 : :
173 : 1 : case PROP_RIGHTS:
174 : 1 : g_value_set_string (value, priv->rights);
175 : 1 : break;
176 : :
177 : 10 : case PROP_SOURCE:
178 : 10 : g_value_set_object (value, priv->source);
179 : 10 : break;
180 : :
181 : 1 : case PROP_SUBJECT:
182 : 1 : g_value_set_string (value, priv->subject);
183 : 1 : break;
184 : :
185 : 4 : case PROP_TITLE:
186 : 4 : g_value_set_string (value, priv->title);
187 : 4 : break;
188 : :
189 : 1 : case PROP_TYPE_HINT:
190 : 1 : g_value_set_string (value, priv->type_hint);
191 : 1 : break;
192 : :
193 : 0 : default:
194 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
195 : : }
196 : 62 : }
197 : :
198 : : static void
199 : 1850 : valent_resource_set_property (GObject *object,
200 : : guint prop_id,
201 : : const GValue *value,
202 : : GParamSpec *pspec)
203 : : {
204 : 1850 : ValentResource *self = VALENT_RESOURCE (object);
205 : 1850 : ValentResourcePrivate *priv = valent_resource_get_instance_private (self);
206 : :
207 [ + + + + : 1850 : switch (prop_id)
+ + + + +
+ + + + +
+ + - ]
208 : : {
209 : 1 : case PROP_CONTRIBUTOR:
210 : 1 : valent_resource_set_contributor (self, g_value_get_boxed (value));
211 : 1 : break;
212 : :
213 : 1 : case PROP_COVERAGE:
214 : 1 : valent_resource_set_coverage (self, g_value_get_string (value));
215 : 1 : break;
216 : :
217 : 1 : case PROP_CREATOR:
218 : 1 : valent_resource_set_creator (self, g_value_get_string (value));
219 : 1 : break;
220 : :
221 : 1 : case PROP_DATE:
222 : 1 : valent_resource_set_date (self, g_value_get_boxed (value));
223 : 1 : break;
224 : :
225 : 279 : case PROP_DESCRIPTION:
226 : 279 : valent_resource_set_description (self, g_value_get_string (value));
227 : 279 : break;
228 : :
229 : 1 : case PROP_FORMAT:
230 : 1 : valent_resource_set_format (self, g_value_get_string (value));
231 : 1 : break;
232 : :
233 : 1 : case PROP_IDENTIFIER:
234 : 1 : valent_resource_set_identifier (self, g_value_get_string (value));
235 : 1 : break;
236 : :
237 : 629 : case PROP_IRI:
238 [ + - ]: 629 : g_assert (priv->iri == NULL);
239 : 629 : priv->iri = g_value_dup_string (value);
240 : 629 : break;
241 : :
242 : 1 : case PROP_LANGUAGE:
243 : 1 : valent_resource_set_language (self, g_value_get_string (value));
244 : 1 : break;
245 : :
246 : 1 : case PROP_PUBLISHER:
247 : 1 : valent_resource_set_publisher (self, g_value_get_string (value));
248 : 1 : break;
249 : :
250 : 1 : case PROP_RELATION:
251 : 1 : valent_resource_set_relation (self, g_value_get_boxed (value));
252 : 1 : break;
253 : :
254 : 1 : case PROP_RIGHTS:
255 : 1 : valent_resource_set_rights (self, g_value_get_string (value));
256 : 1 : break;
257 : :
258 : 629 : case PROP_SOURCE:
259 : 629 : valent_resource_set_source (self, g_value_get_object (value));
260 : 629 : break;
261 : :
262 : 1 : case PROP_SUBJECT:
263 : 1 : valent_resource_set_subject (self, g_value_get_string (value));
264 : 1 : break;
265 : :
266 : 301 : case PROP_TITLE:
267 : 301 : valent_resource_set_title (self, g_value_get_string (value));
268 : 301 : break;
269 : :
270 : 1 : case PROP_TYPE_HINT:
271 : 1 : valent_resource_set_type_hint (self, g_value_get_string (value));
272 : 1 : break;
273 : :
274 : 0 : default:
275 : 0 : G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
276 : : }
277 : 1850 : }
278 : :
279 : : static void
280 : 60 : valent_resource_class_init (ValentResourceClass *klass)
281 : : {
282 : 60 : GObjectClass *object_class = G_OBJECT_CLASS (klass);
283 : :
284 : 60 : object_class->finalize = valent_resource_finalize;
285 : 60 : object_class->get_property = valent_resource_get_property;
286 : 60 : object_class->set_property = valent_resource_set_property;
287 : :
288 : 60 : klass->update = valent_resource_real_update;
289 : :
290 : : /**
291 : : * ValentResource:contributor: (getter get_contributor) (setter set_contributor)
292 : : *
293 : : * An entity responsible for making contributions to the resource.
294 : : *
295 : : * The guidelines for using names of persons or organizations as creators also
296 : : * apply to contributors. Typically, the name of a Contributor should be used
297 : : * to indicate the entity.
298 : : *
299 : : * Since: 1.0
300 : : */
301 : 120 : properties[PROP_CONTRIBUTOR] =
302 : 60 : g_param_spec_boxed ("contributor", NULL, NULL,
303 : : G_TYPE_STRV,
304 : : (G_PARAM_READWRITE |
305 : : G_PARAM_EXPLICIT_NOTIFY |
306 : : G_PARAM_STATIC_STRINGS));
307 : :
308 : : /**
309 : : * ValentResource:coverage: (getter get_coverage) (setter set_coverage)
310 : : *
311 : : * The spatial or temporal topic of the resource, spatial applicability of
312 : : * the resource, or jurisdiction under which the resource is relevant.
313 : : *
314 : : * Spatial topic and spatial applicability may be a named place or a location
315 : : * specified by its geographic coordinates. Temporal topic may be a named
316 : : * period, date, or date range. A jurisdiction may be a named administrative
317 : : * entity or a geographic place to which the resource applies. Recommended
318 : : * practice is to use a controlled vocabulary such as the Getty Thesaurus of
319 : : * Geographic Names [TGN]. Where appropriate, named places or time periods
320 : : * may be used in preference to numeric identifiers such as sets of
321 : : * coordinates or date ranges.
322 : : *
323 : : * Since: 1.0
324 : : */
325 : 120 : properties[PROP_COVERAGE] =
326 : 60 : g_param_spec_string ("coverage", NULL, NULL,
327 : : NULL,
328 : : (G_PARAM_READWRITE |
329 : : G_PARAM_EXPLICIT_NOTIFY |
330 : : G_PARAM_STATIC_STRINGS));
331 : :
332 : : /**
333 : : * ValentResource:creator: (getter get_creator) (setter set_creator)
334 : : *
335 : : * An entity primarily responsible for making the resource.
336 : : *
337 : : * Examples of a Creator include a person, an organization, or a service.
338 : : * Typically, the name of a Creator should be used to indicate the entity.
339 : : *
340 : : * Since: 1.0
341 : : */
342 : 120 : properties[PROP_CREATOR] =
343 : 60 : g_param_spec_string ("creator", NULL, NULL,
344 : : NULL,
345 : : (G_PARAM_READWRITE |
346 : : G_PARAM_EXPLICIT_NOTIFY |
347 : : G_PARAM_STATIC_STRINGS));
348 : :
349 : : /**
350 : : * ValentResource:date: (getter get_date) (setter set_date)
351 : : *
352 : : * A point or period of time associated with an event in the lifecycle of
353 : : * the resource.
354 : : *
355 : : * Date may be used to express temporal information at any level of
356 : : * granularity. Recommended practice is to express the date, date/time, or
357 : : * period of time according to ISO 8601-1 [ISO 8601-1] or a published profile
358 : : * of the ISO standard, such as the W3C Note on Date and Time Formats [W3CDTF]
359 : : * or the Extended Date/Time Format Specification [EDTF]. If the full date is
360 : : * unknown, month and year (YYYY-MM) or just year (YYYY) may be used. Date
361 : : * ranges may be specified using ISO 8601 period of time specification in
362 : : * which start and end dates are separated by a '/' (slash) character. Either
363 : : * the start or end date may be missing.
364 : : *
365 : : * Since: 1.0
366 : : */
367 : 120 : properties[PROP_DATE] =
368 : 60 : g_param_spec_boxed ("date", NULL, NULL,
369 : : G_TYPE_DATE_TIME,
370 : : (G_PARAM_READWRITE |
371 : : G_PARAM_EXPLICIT_NOTIFY |
372 : : G_PARAM_STATIC_STRINGS));
373 : :
374 : : /**
375 : : * ValentResource:description: (getter get_description) (setter set_description)
376 : : *
377 : : * An account of the resource.
378 : : *
379 : : * Description may include but is not limited to: an abstract, a table of
380 : : * contents, a graphical representation, or a free-text account of the
381 : : * resource.
382 : : *
383 : : * Since: 1.0
384 : : */
385 : 120 : properties[PROP_DESCRIPTION] =
386 : 60 : g_param_spec_string ("description", NULL, NULL,
387 : : NULL,
388 : : (G_PARAM_READWRITE |
389 : : G_PARAM_EXPLICIT_NOTIFY |
390 : : G_PARAM_STATIC_STRINGS));
391 : :
392 : : /**
393 : : * ValentResource:format: (getter get_format) (setter set_format)
394 : : *
395 : : * The file format, physical medium, or dimensions of the resource.
396 : : *
397 : : * Recommended practice is to use a controlled vocabulary where available. For
398 : : * example, for file formats one could use the list of Internet Media Types
399 : : * [MIME](https://www.iana.org/assignments/media-types/media-types.xhtml).
400 : : *
401 : : * Since: 1.0
402 : : */
403 : 120 : properties[PROP_FORMAT] =
404 : 60 : g_param_spec_string ("format", NULL, NULL,
405 : : NULL,
406 : : (G_PARAM_READWRITE |
407 : : G_PARAM_EXPLICIT_NOTIFY |
408 : : G_PARAM_STATIC_STRINGS));
409 : :
410 : : /**
411 : : * ValentResource:identifier: (getter get_identifier) (setter set_identifier)
412 : : *
413 : : * An unambiguous reference to the resource within a given context.
414 : : *
415 : : * Recommended practice is to identify the resource by means of a string
416 : : * conforming to an identification system.
417 : : *
418 : : * Since: 1.0
419 : : */
420 : 120 : properties[PROP_IDENTIFIER] =
421 : 60 : g_param_spec_string ("identifier", NULL, NULL,
422 : : NULL,
423 : : (G_PARAM_READWRITE |
424 : : G_PARAM_EXPLICIT_NOTIFY |
425 : : G_PARAM_STATIC_STRINGS));
426 : :
427 : : /**
428 : : * ValentResource:iri: (getter get_iri)
429 : : *
430 : : * The resource IRI (Internationalized Resource Identifier).
431 : : *
432 : : * Since: 1.0
433 : : */
434 : 120 : properties[PROP_IRI] =
435 : 60 : g_param_spec_string ("iri", NULL, NULL,
436 : : NULL,
437 : : (G_PARAM_READWRITE |
438 : : G_PARAM_CONSTRUCT_ONLY |
439 : : G_PARAM_STATIC_STRINGS));
440 : :
441 : : /**
442 : : * ValentResource:language: (getter get_language) (setter set_language)
443 : : *
444 : : * A list of related resources from which the described resource is derived.
445 : : *
446 : : * Recommended practice is to use either a non-literal value representing a
447 : : * language from a controlled vocabulary such as ISO 639-2 or ISO 639-3, or a
448 : : * literal value consisting of an IETF Best Current Practice 47 [IETF-BCP47]
449 : : * language tag.
450 : : *
451 : : * Since: 1.0
452 : : */
453 : 120 : properties[PROP_LANGUAGE] =
454 : 60 : g_param_spec_string ("language", NULL, NULL,
455 : : NULL,
456 : : (G_PARAM_READWRITE |
457 : : G_PARAM_EXPLICIT_NOTIFY |
458 : : G_PARAM_STATIC_STRINGS));
459 : :
460 : : /**
461 : : * ValentResource:publisher: (getter get_publisher) (setter set_publisher)
462 : : *
463 : : * An entity responsible for making the resource available.
464 : : *
465 : : * Examples of a Publisher include a person, an organization, or a service.
466 : : * Typically, the name of a Publisher should be used to indicate the entity.
467 : : *
468 : : * Since: 1.0
469 : : */
470 : 120 : properties[PROP_PUBLISHER] =
471 : 60 : g_param_spec_string ("publisher", NULL, NULL,
472 : : NULL,
473 : : (G_PARAM_READWRITE |
474 : : G_PARAM_EXPLICIT_NOTIFY |
475 : : G_PARAM_STATIC_STRINGS));
476 : :
477 : : /**
478 : : * ValentResource:relation: (getter get_relation) (setter set_relation)
479 : : *
480 : : * A related resource.
481 : : *
482 : : * Recommended practice is to identify the related resource by means of a
483 : : * URI. If this is not possible or feasible, a string conforming to a formal
484 : : * identification system may be provided.
485 : : *
486 : : * Since: 1.0
487 : : */
488 : 120 : properties[PROP_RELATION] =
489 : 60 : g_param_spec_boxed ("relation", NULL, NULL,
490 : : G_TYPE_STRV,
491 : : (G_PARAM_READWRITE |
492 : : G_PARAM_EXPLICIT_NOTIFY |
493 : : G_PARAM_STATIC_STRINGS));
494 : :
495 : : /**
496 : : * ValentResource:rights: (getter get_rights) (setter set_rights)
497 : : *
498 : : * Information about rights held in and over the resource.
499 : : *
500 : : * Typically, rights information includes a statement about various property
501 : : * rights associated with the resource, including intellectual property
502 : : * rights.
503 : : *
504 : : * Since: 1.0
505 : : */
506 : 120 : properties[PROP_RIGHTS] =
507 : 60 : g_param_spec_string ("rights", NULL, NULL,
508 : : NULL,
509 : : (G_PARAM_READWRITE |
510 : : G_PARAM_EXPLICIT_NOTIFY |
511 : : G_PARAM_STATIC_STRINGS));
512 : :
513 : : /**
514 : : * ValentResource:source: (getter get_source) (setter set_source)
515 : : *
516 : : * A related resource from which the described resource is derived.
517 : : *
518 : : * The described resource may be derived from the related resource in whole
519 : : * or in part. Recommended best practice is to identify the related resource
520 : : * by means of a string conforming to a formal identification system.
521 : : *
522 : : * Since: 1.0
523 : : */
524 : 120 : properties[PROP_SOURCE] =
525 : 60 : g_param_spec_object ("source", NULL, NULL,
526 : : VALENT_TYPE_RESOURCE,
527 : : (G_PARAM_READWRITE |
528 : : G_PARAM_CONSTRUCT |
529 : : G_PARAM_EXPLICIT_NOTIFY |
530 : : G_PARAM_STATIC_STRINGS));
531 : :
532 : : /**
533 : : * ValentResource:subject: (getter get_subject) (setter set_subject)
534 : : *
535 : : * The topic of the resource.
536 : : *
537 : : * Typically, the subject will be represented using keywords, key phrases, or
538 : : * classification codes. Recommended best practice is to use a controlled
539 : : * vocabulary.
540 : : *
541 : : * Since: 1.0
542 : : */
543 : 120 : properties[PROP_SUBJECT] =
544 : 60 : g_param_spec_string ("subject", NULL, NULL,
545 : : NULL,
546 : : (G_PARAM_READWRITE |
547 : : G_PARAM_EXPLICIT_NOTIFY |
548 : : G_PARAM_STATIC_STRINGS));
549 : :
550 : : /**
551 : : * ValentResource:title: (getter get_title) (setter set_title)
552 : : *
553 : : * A name given to the resource.
554 : : *
555 : : * Since: 1.0
556 : : */
557 : 120 : properties[PROP_TITLE] =
558 : 60 : g_param_spec_string ("title", NULL, NULL,
559 : : NULL,
560 : : (G_PARAM_READWRITE |
561 : : G_PARAM_EXPLICIT_NOTIFY |
562 : : G_PARAM_STATIC_STRINGS));
563 : :
564 : : /**
565 : : * ValentResource:type-hint: (getter get_type_hint) (setter set_type_hint)
566 : : *
567 : : * The nature or genre of the resource.
568 : : *
569 : : * Recommended practice is to use a controlled vocabulary such as the DCMI
570 : : * Type Vocabulary [DCMI-TYPE]. To describe the file format, physical medium,
571 : : * or dimensions of the resource, use [property@Valent.Resource:format].
572 : : *
573 : : * Since: 1.0
574 : : */
575 : 120 : properties[PROP_TYPE_HINT] =
576 : 60 : g_param_spec_string ("type-hint", NULL, NULL,
577 : : NULL,
578 : : (G_PARAM_READWRITE |
579 : : G_PARAM_EXPLICIT_NOTIFY |
580 : : G_PARAM_STATIC_STRINGS));
581 : :
582 : 60 : g_object_class_install_properties (object_class, G_N_ELEMENTS (properties), properties);
583 : 60 : }
584 : :
585 : : static void
586 : 629 : valent_resource_init (ValentResource *self)
587 : : {
588 : 629 : }
589 : :
590 : : /**
591 : : * valent_resource_get_contributor: (get-property contributor)
592 : : * @resource: a `ValentResource`
593 : : *
594 : : * Gets the contributor of @resource.
595 : : *
596 : : * Returns: (transfer none) (nullable): the contributor of @resource
597 : : *
598 : : * Since: 1.0
599 : : */
600 : : GStrv
601 : 1 : valent_resource_get_contributor (ValentResource *resource)
602 : : {
603 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
604 : :
605 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
606 : :
607 : 1 : return priv->contributor;
608 : : }
609 : :
610 : : /**
611 : : * valent_resource_set_contributor: (set-property contributor)
612 : : * @resource: a `ValentResource`
613 : : * @contributor: (nullable): the new contributor
614 : : *
615 : : * Gets the title of @resource.
616 : : *
617 : : * Since: 1.0
618 : : */
619 : : void
620 : 1 : valent_resource_set_contributor (ValentResource *resource,
621 : : GStrv contributor)
622 : : {
623 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
624 : :
625 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
626 : :
627 [ - + ]: 1 : if (priv->contributor != contributor)
628 : : {
629 [ # # ]: 0 : g_clear_pointer (&priv->contributor, g_strfreev);
630 : 0 : priv->contributor = g_strdupv (contributor);
631 : 0 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_CONTRIBUTOR]);
632 : : }
633 : : }
634 : :
635 : : /**
636 : : * valent_resource_get_coverage: (get-property coverage)
637 : : * @resource: a `ValentResource`
638 : : *
639 : : * Gets the coverage of @resource.
640 : : *
641 : : * Returns: (transfer none) (nullable): the coverage of @resource
642 : : *
643 : : * Since: 1.0
644 : : */
645 : : const char *
646 : 1 : valent_resource_get_coverage (ValentResource *resource)
647 : : {
648 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
649 : :
650 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
651 : :
652 : 1 : return priv->coverage;
653 : : }
654 : :
655 : : /**
656 : : * valent_resource_set_coverage: (set-property coverage)
657 : : * @resource: a `ValentResource`
658 : : * @coverage: (nullable): the new coverage
659 : : *
660 : : * Set the coverage of @resource to @coverage.
661 : : *
662 : : * Since: 1.0
663 : : */
664 : : void
665 : 1 : valent_resource_set_coverage (ValentResource *resource,
666 : : const char *coverage)
667 : : {
668 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
669 : :
670 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
671 : :
672 [ + - ]: 1 : if (g_set_str (&priv->coverage, coverage))
673 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_COVERAGE]);
674 : : }
675 : :
676 : : /**
677 : : * valent_resource_get_creator: (get-property creator)
678 : : * @resource: a `ValentResource`
679 : : *
680 : : * Gets the creator of @resource.
681 : : *
682 : : * Returns: (transfer none) (nullable): the creator of @resource
683 : : *
684 : : * Since: 1.0
685 : : */
686 : : const char *
687 : 1 : valent_resource_get_creator (ValentResource *resource)
688 : : {
689 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
690 : :
691 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
692 : :
693 : 1 : return priv->creator;
694 : : }
695 : :
696 : : /**
697 : : * valent_resource_set_creator: (set-property creator)
698 : : * @resource: a `ValentResource`
699 : : * @creator: (nullable): the new creator
700 : : *
701 : : * Set the creator of @resource to @creator.
702 : : *
703 : : * Since: 1.0
704 : : */
705 : : void
706 : 1 : valent_resource_set_creator (ValentResource *resource,
707 : : const char *creator)
708 : : {
709 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
710 : :
711 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
712 : :
713 [ + - ]: 1 : if (g_set_str (&priv->creator, creator))
714 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_CREATOR]);
715 : : }
716 : :
717 : : /**
718 : : * valent_resource_get_date: (get-property date)
719 : : * @resource: a `ValentResource`
720 : : *
721 : : * Gets the date of @resource.
722 : : *
723 : : * Returns: (transfer none) (nullable): the date of @resource
724 : : *
725 : : * Since: 1.0
726 : : */
727 : : GDateTime *
728 : 1 : valent_resource_get_date (ValentResource *resource)
729 : : {
730 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
731 : :
732 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
733 : :
734 : 1 : return priv->date;
735 : : }
736 : :
737 : : /**
738 : : * valent_resource_set_date: (set-property date)
739 : : * @resource: a `ValentResource`
740 : : * @date: (nullable): the new date
741 : : *
742 : : * Set the date of @resource to @date.
743 : : *
744 : : * Since: 1.0
745 : : */
746 : : void
747 : 1 : valent_resource_set_date (ValentResource *resource,
748 : : GDateTime *date)
749 : : {
750 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
751 : :
752 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
753 : :
754 [ + - ]: 1 : if (priv->date == date)
755 : : return;
756 : :
757 [ - + - - : 1 : if (priv->date && date && g_date_time_equal (priv->date, date))
- - ]
758 : : return;
759 : :
760 [ - + ]: 1 : g_clear_pointer (&priv->date, g_date_time_unref);
761 [ + - ]: 1 : if (date != NULL)
762 : 1 : priv->date = g_date_time_ref (date);
763 : :
764 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_DATE]);
765 : : }
766 : :
767 : : /**
768 : : * valent_resource_get_description: (get-property description)
769 : : * @resource: a `ValentResource`
770 : : *
771 : : * Gets the description of @resource.
772 : : *
773 : : * Returns: (transfer none) (nullable): the description of @resource
774 : : *
775 : : * Since: 1.0
776 : : */
777 : : const char *
778 : 1 : valent_resource_get_description (ValentResource *resource)
779 : : {
780 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
781 : :
782 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
783 : :
784 : 1 : return priv->description;
785 : : }
786 : :
787 : : /**
788 : : * valent_resource_set_description: (set-property description)
789 : : * @resource: a `ValentResource`
790 : : * @description: (nullable): the new description
791 : : *
792 : : * Set the description of @resource to @description.
793 : : *
794 : : * Since: 1.0
795 : : */
796 : : void
797 : 279 : valent_resource_set_description (ValentResource *resource,
798 : : const char *description)
799 : : {
800 : 279 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
801 : :
802 [ + - ]: 279 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
803 : :
804 [ + - ]: 279 : if (g_set_str (&priv->description, description))
805 : 279 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_DESCRIPTION]);
806 : : }
807 : :
808 : : /**
809 : : * valent_resource_get_format: (get-property format)
810 : : * @resource: a `ValentResource`
811 : : *
812 : : * Gets the format of @resource.
813 : : *
814 : : * Returns: (transfer none) (nullable): the format of @resource
815 : : *
816 : : * Since: 1.0
817 : : */
818 : : const char *
819 : 1 : valent_resource_get_format (ValentResource *resource)
820 : : {
821 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
822 : :
823 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
824 : :
825 : 1 : return priv->format;
826 : : }
827 : :
828 : : /**
829 : : * valent_resource_set_format: (set-property format)
830 : : * @resource: a `ValentResource`
831 : : * @format: (nullable): the new format
832 : : *
833 : : * Set the format of @resource to @format.
834 : : *
835 : : * Since: 1.0
836 : : */
837 : : void
838 : 1 : valent_resource_set_format (ValentResource *resource,
839 : : const char *format)
840 : : {
841 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
842 : :
843 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
844 : :
845 [ + - ]: 1 : if (g_set_str (&priv->format, format))
846 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_FORMAT]);
847 : : }
848 : :
849 : : /**
850 : : * valent_resource_get_identifier: (get-property identifier)
851 : : * @resource: a `ValentResource`
852 : : *
853 : : * Gets the identifier of @resource.
854 : : *
855 : : * Returns: (transfer none) (nullable): the identifier of @resource
856 : : *
857 : : * Since: 1.0
858 : : */
859 : : const char *
860 : 1 : valent_resource_get_identifier (ValentResource *resource)
861 : : {
862 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
863 : :
864 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
865 : :
866 : 1 : return priv->identifier;
867 : : }
868 : :
869 : : /**
870 : : * valent_resource_set_identifier: (set-property identifier)
871 : : * @resource: a `ValentResource`
872 : : * @identifier: (nullable): the new identifier
873 : : *
874 : : * Set the identifier of @resource to @identifier.
875 : : *
876 : : * Since: 1.0
877 : : */
878 : : void
879 : 1 : valent_resource_set_identifier (ValentResource *resource,
880 : : const char *identifier)
881 : : {
882 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
883 : :
884 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
885 : :
886 [ + - ]: 1 : if (g_set_str (&priv->identifier, identifier))
887 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_IDENTIFIER]);
888 : : }
889 : :
890 : : /**
891 : : * valent_resource_get_iri: (get-property iri)
892 : : * @resource: a `ValentResource`
893 : : *
894 : : * Gets the IRI of @resource.
895 : : *
896 : : * Returns: (transfer none) (nullable): the IRI of @resource
897 : : *
898 : : * Since: 1.0
899 : : */
900 : : const char *
901 : 45 : valent_resource_get_iri (ValentResource *resource)
902 : : {
903 : 45 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
904 : :
905 [ + - ]: 45 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
906 : :
907 : 45 : return priv->iri;
908 : : }
909 : :
910 : : /**
911 : : * valent_resource_get_language: (get-property language)
912 : : * @resource: a `ValentResource`
913 : : *
914 : : * Gets the language of @resource.
915 : : *
916 : : * Returns: (transfer none) (nullable): the language of @resource
917 : : *
918 : : * Since: 1.0
919 : : */
920 : : const char *
921 : 1 : valent_resource_get_language (ValentResource *resource)
922 : : {
923 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
924 : :
925 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
926 : :
927 : 1 : return priv->language;
928 : : }
929 : :
930 : : /**
931 : : * valent_resource_set_language: (set-property language)
932 : : * @resource: a `ValentResource`
933 : : * @language: (nullable): the new language
934 : : *
935 : : * Set the language of @resource to @language.
936 : : *
937 : : * Since: 1.0
938 : : */
939 : : void
940 : 1 : valent_resource_set_language (ValentResource *resource,
941 : : const char *language)
942 : : {
943 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
944 : :
945 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
946 : :
947 [ + - ]: 1 : if (g_set_str (&priv->language, language))
948 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_LANGUAGE]);
949 : : }
950 : :
951 : : /**
952 : : * valent_resource_get_publisher: (get-property publisher)
953 : : * @resource: a `ValentResource`
954 : : *
955 : : * Gets the publisher of @resource.
956 : : *
957 : : * Returns: (transfer none) (nullable): the publisher of @resource
958 : : *
959 : : * Since: 1.0
960 : : */
961 : : const char *
962 : 1 : valent_resource_get_publisher (ValentResource *resource)
963 : : {
964 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
965 : :
966 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
967 : :
968 : 1 : return priv->publisher;
969 : : }
970 : :
971 : : /**
972 : : * valent_resource_set_publisher: (set-property publisher)
973 : : * @resource: a `ValentResource`
974 : : * @publisher: (nullable): the new publisher
975 : : *
976 : : * Set the publisher of @resource to @publisher.
977 : : *
978 : : * Since: 1.0
979 : : */
980 : : void
981 : 1 : valent_resource_set_publisher (ValentResource *resource,
982 : : const char *publisher)
983 : : {
984 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
985 : :
986 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
987 : :
988 [ + - ]: 1 : if (g_set_str (&priv->publisher, publisher))
989 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_PUBLISHER]);
990 : : }
991 : :
992 : : /**
993 : : * valent_resource_get_relation: (get-property relation)
994 : : * @resource: a `ValentResource`
995 : : *
996 : : * Gets the relation of @resource.
997 : : *
998 : : * Returns: (transfer none) (nullable): the relation of @resource
999 : : *
1000 : : * Since: 1.0
1001 : : */
1002 : : GStrv
1003 : 1 : valent_resource_get_relation (ValentResource *resource)
1004 : : {
1005 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1006 : :
1007 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1008 : :
1009 : 1 : return priv->relation;
1010 : : }
1011 : :
1012 : : /**
1013 : : * valent_resource_set_relation: (set-property relation)
1014 : : * @resource: a `ValentResource`
1015 : : * @relation: (nullable): the new relation
1016 : : *
1017 : : * Gets the title of @resource.
1018 : : *
1019 : : * Since: 1.0
1020 : : */
1021 : : void
1022 : 1 : valent_resource_set_relation (ValentResource *resource,
1023 : : GStrv relation)
1024 : : {
1025 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1026 : :
1027 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1028 : :
1029 [ - + ]: 1 : if (priv->relation != relation)
1030 : : {
1031 [ # # ]: 0 : g_clear_pointer (&priv->relation, g_strfreev);
1032 : 0 : priv->contributor = g_strdupv (relation);
1033 : 0 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_RELATION]);
1034 : : }
1035 : : }
1036 : :
1037 : : /**
1038 : : * valent_resource_get_rights: (get-property rights)
1039 : : * @resource: a `ValentResource`
1040 : : *
1041 : : * Gets the rights of @resource.
1042 : : *
1043 : : * Returns: (transfer none) (nullable): the rights of @resource
1044 : : *
1045 : : * Since: 1.0
1046 : : */
1047 : : const char *
1048 : 1 : valent_resource_get_rights (ValentResource *resource)
1049 : : {
1050 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1051 : :
1052 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1053 : :
1054 : 1 : return priv->rights;
1055 : : }
1056 : :
1057 : : /**
1058 : : * valent_resource_set_rights: (set-property rights)
1059 : : * @resource: a `ValentResource`
1060 : : * @rights: (nullable): the new rights
1061 : : *
1062 : : * Set the rights of @resource to @rights.
1063 : : *
1064 : : * Since: 1.0
1065 : : */
1066 : : void
1067 : 1 : valent_resource_set_rights (ValentResource *resource,
1068 : : const char *rights)
1069 : : {
1070 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1071 : :
1072 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1073 : :
1074 [ + - ]: 1 : if (g_set_str (&priv->rights, rights))
1075 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_RIGHTS]);
1076 : : }
1077 : :
1078 : : /**
1079 : : * valent_resource_get_source: (get-property source)
1080 : : * @resource: a `ValentResource`
1081 : : *
1082 : : * Gets the source of @resource.
1083 : : *
1084 : : * Returns: (type Valent.Resource) (transfer none) (nullable): the source
1085 : : * of @resource
1086 : : *
1087 : : * Since: 1.0
1088 : : */
1089 : : gpointer
1090 : 604 : valent_resource_get_source (ValentResource *resource)
1091 : : {
1092 : 604 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1093 : :
1094 [ + - ]: 604 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1095 : :
1096 : 604 : return priv->source;
1097 : : }
1098 : :
1099 : : /**
1100 : : * valent_resource_set_source: (set-property source)
1101 : : * @resource: a `ValentResource`
1102 : : * @source: (nullable): the new source
1103 : : *
1104 : : * Set the source of @resource to @source.
1105 : : *
1106 : : * Since: 1.0
1107 : : */
1108 : : void
1109 : 879 : valent_resource_set_source (ValentResource *resource,
1110 : : ValentResource *source)
1111 : : {
1112 : 879 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1113 : :
1114 [ + - ]: 879 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1115 [ + + - + ]: 879 : g_return_if_fail (source == NULL || VALENT_IS_RESOURCE (source));
1116 : :
1117 [ + + ]: 879 : if (priv->source == source)
1118 : : return;
1119 : :
1120 [ + + ]: 557 : if (priv->source != NULL)
1121 : : {
1122 : 250 : g_signal_handlers_disconnect_by_func (priv->source,
1123 : : on_source_destroyed,
1124 : : resource);
1125 : 250 : priv->source = NULL;
1126 : : }
1127 : :
1128 [ + + ]: 557 : if (source != NULL)
1129 : : {
1130 : 307 : priv->source = source;
1131 : 307 : g_signal_connect_object (priv->source,
1132 : : "destroy",
1133 : : G_CALLBACK (on_source_destroyed),
1134 : : resource,
1135 : : G_CONNECT_DEFAULT);
1136 : 307 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_SOURCE]);
1137 : : }
1138 : : }
1139 : :
1140 : : /**
1141 : : * valent_resource_get_subject: (get-property subject)
1142 : : * @resource: a `ValentResource`
1143 : : *
1144 : : * Gets the subject of @resource.
1145 : : *
1146 : : * Returns: (transfer none) (nullable): the subject of @resource
1147 : : *
1148 : : * Since: 1.0
1149 : : */
1150 : : const char *
1151 : 1 : valent_resource_get_subject (ValentResource *resource)
1152 : : {
1153 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1154 : :
1155 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1156 : :
1157 : 1 : return priv->subject;
1158 : : }
1159 : :
1160 : : /**
1161 : : * valent_resource_set_subject: (set-property subject)
1162 : : * @resource: a `ValentResource`
1163 : : * @subject: (nullable): the new subject
1164 : : *
1165 : : * Set the subject of @resource to @subject.
1166 : : *
1167 : : * Since: 1.0
1168 : : */
1169 : : void
1170 : 1 : valent_resource_set_subject (ValentResource *resource,
1171 : : const char *subject)
1172 : : {
1173 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1174 : :
1175 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1176 : :
1177 [ + - ]: 1 : if (g_set_str (&priv->subject, subject))
1178 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_SUBJECT]);
1179 : : }
1180 : :
1181 : : /**
1182 : : * valent_resource_get_title: (get-property title)
1183 : : * @resource: a `ValentResource`
1184 : : *
1185 : : * Gets the title of @resource.
1186 : : *
1187 : : * Returns: (transfer none) (nullable): the title of @resource
1188 : : *
1189 : : * Since: 1.0
1190 : : */
1191 : : const char *
1192 : 9 : valent_resource_get_title (ValentResource *resource)
1193 : : {
1194 : 9 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1195 : :
1196 [ + - ]: 9 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1197 : :
1198 : 9 : return priv->title;
1199 : : }
1200 : :
1201 : : /**
1202 : : * valent_resource_set_title: (set-property title)
1203 : : * @resource: a `ValentResource`
1204 : : * @title: (nullable): the new title
1205 : : *
1206 : : * Set the title of @resource to @title.
1207 : : *
1208 : : * Since: 1.0
1209 : : */
1210 : : void
1211 : 306 : valent_resource_set_title (ValentResource *resource,
1212 : : const char *title)
1213 : : {
1214 : 306 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1215 : :
1216 [ + - ]: 306 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1217 : :
1218 [ + + ]: 306 : if (g_set_str (&priv->title, title))
1219 : 305 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_TITLE]);
1220 : : }
1221 : :
1222 : : /**
1223 : : * valent_resource_get_type_hint: (get-property type-hint)
1224 : : * @resource: a `ValentResource`
1225 : : *
1226 : : * Gets the type hint of @resource.
1227 : : *
1228 : : * Returns: (transfer none) (nullable): the nature or genre of @resource
1229 : : *
1230 : : * Since: 1.0
1231 : : */
1232 : : const char *
1233 : 1 : valent_resource_get_type_hint (ValentResource *resource)
1234 : : {
1235 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1236 : :
1237 [ + - ]: 1 : g_return_val_if_fail (VALENT_IS_RESOURCE (resource), NULL);
1238 : :
1239 : 1 : return priv->type_hint;
1240 : : }
1241 : :
1242 : : /**
1243 : : * valent_resource_set_type_hint: (set-property type-hint)
1244 : : * @resource: a `ValentResource`
1245 : : * @type_hint: (nullable): the new type_hint
1246 : : *
1247 : : * Set the nature or genre of @resource to @type_hint.
1248 : : *
1249 : : * Since: 1.0
1250 : : */
1251 : : void
1252 : 1 : valent_resource_set_type_hint (ValentResource *resource,
1253 : : const char *type_hint)
1254 : : {
1255 : 1 : ValentResourcePrivate *priv = valent_resource_get_instance_private (resource);
1256 : :
1257 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1258 : :
1259 [ + - ]: 1 : if (g_set_str (&priv->type_hint, type_hint))
1260 : 1 : g_object_notify_by_pspec (G_OBJECT (resource), properties[PROP_TYPE_HINT]);
1261 : : }
1262 : :
1263 : : /**
1264 : : * valent_resource_update: (virtual update)
1265 : : * @resource: a `ValentResource`
1266 : : * @update: the resource update
1267 : : *
1268 : : * Update @resource from @update.
1269 : : *
1270 : : * Since: 1.0
1271 : : */
1272 : : void
1273 : 1 : valent_resource_update (ValentResource *resource,
1274 : : ValentResource *update)
1275 : : {
1276 [ + - ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (resource));
1277 [ - + ]: 1 : g_return_if_fail (VALENT_IS_RESOURCE (update));
1278 : :
1279 : 1 : VALENT_RESOURCE_GET_CLASS (resource)->update (resource, update);
1280 : : }
1281 : :
|