Remove unused non-object support from KatzeArray

This commit is contained in:
Christian Dywan 2010-11-29 23:09:33 +01:00
parent b7c8ef9c4e
commit 1581c13460

View file

@ -74,15 +74,10 @@ static void
_katze_array_add_item (KatzeArray* array, _katze_array_add_item (KatzeArray* array,
gpointer item) gpointer item)
{ {
if (katze_array_is_a (array, G_TYPE_OBJECT))
{
GType type = G_OBJECT_TYPE (item); GType type = G_OBJECT_TYPE (item);
/* g_return_if_fail (katze_array_is_a (array, type)); */
g_object_ref (item); g_object_ref (item);
if (g_type_is_a (type, KATZE_TYPE_ITEM)) if (g_type_is_a (type, KATZE_TYPE_ITEM))
katze_item_set_parent (item, array); katze_item_set_parent (item, array);
}
array->items = g_list_append (array->items, item); array->items = g_list_append (array->items, item);
} }
@ -93,12 +88,9 @@ _katze_array_remove_item (KatzeArray* array,
{ {
array->items = g_list_remove (array->items, item); array->items = g_list_remove (array->items, item);
if (katze_array_is_a (array, G_TYPE_OBJECT))
{
if (KATZE_IS_ITEM (item)) if (KATZE_IS_ITEM (item))
katze_item_set_parent (item, NULL); katze_item_set_parent (item, NULL);
g_object_unref (item); g_object_unref (item);
}
} }
static void static void
@ -195,7 +187,7 @@ katze_array_class_init (KatzeArrayClass* class)
static void static void
katze_array_init (KatzeArray* array) katze_array_init (KatzeArray* array)
{ {
array->type = G_TYPE_NONE; array->type = G_TYPE_OBJECT;
array->items = NULL; array->items = NULL;
} }
@ -204,16 +196,12 @@ katze_array_finalize (GObject* object)
{ {
KatzeArray* array; KatzeArray* array;
guint i; guint i;
gpointer item;
array = KATZE_ARRAY (object); array = KATZE_ARRAY (object);
if (katze_array_is_a (array, G_TYPE_OBJECT))
{
gpointer item;
i = 0; i = 0;
while ((item = g_list_nth_data (array->items, i++))) while ((item = g_list_nth_data (array->items, i++)))
g_object_unref (item); g_object_unref (item);
}
g_list_free (array->items); g_list_free (array->items);
G_OBJECT_CLASS (katze_array_parent_class)->finalize (object); G_OBJECT_CLASS (katze_array_parent_class)->finalize (object);
@ -225,8 +213,6 @@ katze_array_finalize (GObject* object)
* *
* Creates a new #KatzeArray for @type items. * Creates a new #KatzeArray for @type items.
* *
* You may only add items of the given type or inherited
* from it to this array *if* @type is an #GObject type.
* The array will keep a reference on each object until * The array will keep a reference on each object until
* it is removed from the array. * it is removed from the array.
* *
@ -235,14 +221,17 @@ katze_array_finalize (GObject* object)
KatzeArray* KatzeArray*
katze_array_new (GType type) katze_array_new (GType type)
{ {
KatzeArray* array = g_object_new (KATZE_TYPE_ARRAY, NULL); KatzeArray* array;
g_return_val_if_fail (g_type_is_a (type, G_TYPE_OBJECT), NULL);
array = g_object_new (KATZE_TYPE_ARRAY, NULL);
array->type = type; array->type = type;
return array; return array;
} }
/** /**
*
* katze_array_is_a: * katze_array_is_a:
* @array: a #KatzeArray * @array: a #KatzeArray
* @is_a_type: type to compare with * @is_a_type: type to compare with
@ -371,9 +360,6 @@ katze_array_find_token (KatzeArray* array,
guint i; guint i;
gpointer item; gpointer item;
if (!katze_array_is_a (array, G_TYPE_OBJECT))
return NULL;
i = 0; i = 0;
while ((item = g_list_nth_data (array->items, i++))) while ((item = g_list_nth_data (array->items, i++)))
{ {
@ -410,9 +396,6 @@ katze_array_find_uri (KatzeArray* array,
guint i; guint i;
gpointer item; gpointer item;
if (!katze_array_is_a (array, G_TYPE_OBJECT))
return NULL;
i = 0; i = 0;
while ((item = g_list_nth_data (array->items, i++))) while ((item = g_list_nth_data (array->items, i++)))
{ {