This repository has been archived on 2024-07-15. You can view files and clone it, but cannot push or open issues or pull requests.
hedera/vn/glade/vn-iterator.c

86 lines
2.5 KiB
C
Raw Normal View History

/*
* 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_ITERATOR,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
vn_iterator_buildable_init)
);
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Methods for Glade
void vn_iterator_add_param (DbIterator * obj, DbParam * param)
{
VnIterator * i = (VnIterator *) obj;
g_return_if_fail (DB_IS_ITERATOR (obj));
g_return_if_fail (DB_IS_PARAM (param));
i->params = g_list_prepend (i->params, param);
}
void vn_iterator_remove_param (DbIterator * obj, DbParam * param)
{
VnIterator * i = (VnIterator *) obj;
g_return_if_fail (DB_IS_ITERATOR (obj));
g_return_if_fail (DB_IS_PARAM (param));
i->params = g_list_remove (i->params, param);
}
GList * vn_iterator_get_params (DbIterator * obj)
{
g_return_if_fail (DB_IS_ITERATOR (obj));
return g_list_copy (((VnIterator *) obj)->params);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GtkBuildable
static void vn_iterator_buildable_add_child (GtkBuildable * obj,
GtkBuilder * builder, GObject * child, const gchar * type)
{
db_iterator_add_param ((DbIterator *) obj, (DbParam *) child);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_iterator_init (VnIterator * obj)
{
obj->params = NULL;
}
static void vn_iterator_finalize (VnIterator * obj)
{
g_list_free_full (obj->params, g_object_unref);
G_OBJECT_CLASS (vn_iterator_parent_class)->finalize (G_OBJECT (obj));
}
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;
}