2010-08-10 17:01:15 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Intel, Inc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 12:57:27 +01:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2010-08-10 17:01:15 +01:00
|
|
|
*
|
|
|
|
* Author: Thomas Wood <thomas.wood@intel.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "bg-source.h"
|
2011-02-10 12:29:29 +00:00
|
|
|
#include "cc-background-item.h"
|
2010-08-10 17:01:15 +01:00
|
|
|
|
2014-06-30 15:47:24 +02:00
|
|
|
#include <cairo-gobject.h>
|
|
|
|
|
2017-09-25 14:16:09 -04:00
|
|
|
typedef struct
|
2010-08-10 17:01:15 +01:00
|
|
|
{
|
2019-05-22 16:06:02 -03:00
|
|
|
GListStore *store;
|
2017-09-25 14:16:09 -04:00
|
|
|
} BgSourcePrivate;
|
|
|
|
|
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (BgSource, bg_source, G_TYPE_OBJECT)
|
2010-08-10 17:01:15 +01:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2023-11-30 03:49:54 +01:00
|
|
|
PROP_0,
|
|
|
|
PROP_LISTSTORE
|
2010-08-10 17:01:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
bg_source_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
BgSource *source = BG_SOURCE (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_LISTSTORE:
|
|
|
|
g_value_set_object (value, bg_source_get_liststore (source));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bg_source_dispose (GObject *object)
|
|
|
|
{
|
2017-09-25 14:16:09 -04:00
|
|
|
BgSource *source = BG_SOURCE (object);
|
|
|
|
BgSourcePrivate *priv = bg_source_get_instance_private (source);
|
2010-08-10 17:01:15 +01:00
|
|
|
|
2013-09-05 21:55:46 -03:00
|
|
|
g_clear_object (&priv->store);
|
2010-08-10 17:01:15 +01:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (bg_source_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bg_source_class_init (BgSourceClass *klass)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->get_property = bg_source_get_property;
|
|
|
|
object_class->dispose = bg_source_dispose;
|
|
|
|
|
|
|
|
pspec = g_param_spec_object ("liststore",
|
|
|
|
"Liststore",
|
|
|
|
"Liststore used in the source",
|
2019-05-22 16:06:02 -03:00
|
|
|
G_TYPE_LIST_STORE,
|
2010-08-10 17:01:15 +01:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
g_object_class_install_property (object_class, PROP_LISTSTORE, pspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bg_source_init (BgSource *self)
|
|
|
|
{
|
2017-09-25 14:16:09 -04:00
|
|
|
BgSourcePrivate *priv = bg_source_get_instance_private (self);
|
2019-05-22 16:06:02 -03:00
|
|
|
priv->store = g_list_store_new (CC_TYPE_BACKGROUND_ITEM);
|
2010-08-10 17:01:15 +01:00
|
|
|
}
|
|
|
|
|
2019-05-22 16:06:02 -03:00
|
|
|
GListStore*
|
2010-08-10 17:01:15 +01:00
|
|
|
bg_source_get_liststore (BgSource *source)
|
|
|
|
{
|
2017-09-25 14:16:09 -04:00
|
|
|
BgSourcePrivate *priv;
|
|
|
|
|
2010-08-10 17:01:15 +01:00
|
|
|
g_return_val_if_fail (BG_IS_SOURCE (source), NULL);
|
|
|
|
|
2017-09-25 14:16:09 -04:00
|
|
|
priv = bg_source_get_instance_private (source);
|
|
|
|
return priv->store;
|
2010-08-10 17:01:15 +01:00
|
|
|
}
|