86 lines
2.5 KiB
C
86 lines
2.5 KiB
C
/*
|
|
* Copyright (C) 2012 - Juan Ferrer Toribio
|
|
*
|
|
* 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 3 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
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "vn-iterator.h"
|
|
|
|
static void vn_iterator_buildable_init (GtkBuildableIface * iface);
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (VnIterator, vn_iterator, DB_TYPE_SIMPLE_ITERATOR,
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
vn_iterator_buildable_init)
|
|
);
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Methods for Glade
|
|
|
|
void vn_iterator_add_param (DbSimpleIterator * self, DbParam * param)
|
|
{
|
|
VnIterator * i = (VnIterator *) self;
|
|
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
|
|
g_return_if_fail (DB_IS_PARAM (param));
|
|
|
|
i->params = g_list_prepend (i->params, param);
|
|
}
|
|
|
|
void vn_iterator_remove_param (DbSimpleIterator * self, DbParam * param)
|
|
{
|
|
VnIterator * i = (VnIterator *) self;
|
|
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
|
|
g_return_if_fail (DB_IS_PARAM (param));
|
|
|
|
i->params = g_list_remove (i->params, param);
|
|
}
|
|
|
|
GList * vn_iterator_get_params (DbSimpleIterator * self)
|
|
{
|
|
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
|
|
|
|
return g_list_copy (((VnIterator *) self)->params);
|
|
}
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GtkBuildable
|
|
|
|
static void vn_iterator_buildable_add_child (GtkBuildable * self,
|
|
GtkBuilder * builder, GObject * child, const gchar * type)
|
|
{
|
|
db_iterator_add_param (DB_ITERATOR (self), DB_PARAM (child));
|
|
}
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
|
|
|
static void vn_iterator_init (VnIterator * self)
|
|
{
|
|
self->params = NULL;
|
|
}
|
|
|
|
static void vn_iterator_finalize (VnIterator * self)
|
|
{
|
|
g_list_free_full (self->params, g_object_unref);
|
|
|
|
G_OBJECT_CLASS (vn_iterator_parent_class)->finalize (G_OBJECT (self));
|
|
}
|
|
|
|
static void vn_iterator_class_init (VnIteratorClass * klass)
|
|
{
|
|
GObjectClass * k = G_OBJECT_CLASS (klass);
|
|
k->finalize = (GObjectFinalizeFunc) vn_iterator_finalize;
|
|
}
|
|
|
|
static void vn_iterator_buildable_init (GtkBuildableIface * iface)
|
|
{
|
|
iface->add_child = vn_iterator_buildable_add_child;
|
|
}
|