2
* Copyright (C) 2010 Intel, Inc
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.
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.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
* Author: Thomas Wood <thomas.wood@intel.com>
22
#include "bg-source.h"
23
#include "cc-background-item.h"
25
G_DEFINE_ABSTRACT_TYPE (BgSource, bg_source, G_TYPE_OBJECT)
27
#define SOURCE_PRIVATE(o) \
28
(G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_SOURCE, BgSourcePrivate))
30
struct _BgSourcePrivate
42
bg_source_get_property (GObject *object,
47
BgSource *source = BG_SOURCE (object);
52
g_value_set_object (value, bg_source_get_liststore (source));
56
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
61
bg_source_set_property (GObject *object,
69
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
74
bg_source_dispose (GObject *object)
76
BgSourcePrivate *priv = BG_SOURCE (object)->priv;
80
g_object_unref (priv->store);
84
G_OBJECT_CLASS (bg_source_parent_class)->dispose (object);
88
bg_source_finalize (GObject *object)
90
G_OBJECT_CLASS (bg_source_parent_class)->finalize (object);
94
bg_source_class_init (BgSourceClass *klass)
97
GObjectClass *object_class = G_OBJECT_CLASS (klass);
99
g_type_class_add_private (klass, sizeof (BgSourcePrivate));
101
object_class->get_property = bg_source_get_property;
102
object_class->set_property = bg_source_set_property;
103
object_class->dispose = bg_source_dispose;
104
object_class->finalize = bg_source_finalize;
106
pspec = g_param_spec_object ("liststore",
108
"Liststore used in the source",
110
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
111
g_object_class_install_property (object_class, PROP_LISTSTORE, pspec);
115
bg_source_init (BgSource *self)
117
BgSourcePrivate *priv;
119
priv = self->priv = SOURCE_PRIVATE (self);
121
priv->store = gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_OBJECT);
125
bg_source_get_liststore (BgSource *source)
127
g_return_val_if_fail (BG_IS_SOURCE (source), NULL);
129
return source->priv->store;