GCC Code Coverage Report


Directory: ./
File: panels/background/bg-source.c
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 31 0.0%
Functions: 0 9 0.0%
Branches: 0 13 0.0%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2010 Intel, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author: Thomas Wood <thomas.wood@intel.com>
18 *
19 */
20
21 #include "bg-source.h"
22 #include "cc-background-item.h"
23
24 #include <cairo-gobject.h>
25
26 typedef struct
27 {
28 GListStore *store;
29 } BgSourcePrivate;
30
31 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (BgSource, bg_source, G_TYPE_OBJECT)
32
33 enum
34 {
35 PROP_0,
36 PROP_LISTSTORE
37 };
38
39 static void
40 bg_source_get_property (GObject *object,
41 guint property_id,
42 GValue *value,
43 GParamSpec *pspec)
44 {
45 BgSource *source = BG_SOURCE (object);
46
47 switch (property_id)
48 {
49 case PROP_LISTSTORE:
50 g_value_set_object (value, bg_source_get_liststore (source));
51 break;
52
53 default:
54 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
55 }
56 }
57
58 static void
59 bg_source_dispose (GObject *object)
60 {
61 BgSource *source = BG_SOURCE (object);
62 BgSourcePrivate *priv = bg_source_get_instance_private (source);
63
64 g_clear_object (&priv->store);
65
66 G_OBJECT_CLASS (bg_source_parent_class)->dispose (object);
67 }
68
69 static void
70 bg_source_class_init (BgSourceClass *klass)
71 {
72 GParamSpec *pspec;
73 GObjectClass *object_class = G_OBJECT_CLASS (klass);
74
75 object_class->get_property = bg_source_get_property;
76 object_class->dispose = bg_source_dispose;
77
78 pspec = g_param_spec_object ("liststore",
79 "Liststore",
80 "Liststore used in the source",
81 G_TYPE_LIST_STORE,
82 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
83 g_object_class_install_property (object_class, PROP_LISTSTORE, pspec);
84 }
85
86 static void
87 bg_source_init (BgSource *self)
88 {
89 BgSourcePrivate *priv = bg_source_get_instance_private (self);
90 priv->store = g_list_store_new (CC_TYPE_BACKGROUND_ITEM);
91 }
92
93 GListStore*
94 bg_source_get_liststore (BgSource *source)
95 {
96 BgSourcePrivate *priv;
97
98 g_return_val_if_fail (BG_IS_SOURCE (source), NULL);
99
100 priv = bg_source_get_instance_private (source);
101 return priv->store;
102 }
103