2013-04-17 19:27:26 -04:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012,2013 Intel Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "cogl-closure-list-private.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_closure_disconnect (CoglClosure *closure)
|
|
|
|
{
|
2013-06-08 18:03:25 -04:00
|
|
|
_cogl_list_remove (&closure->link);
|
2013-04-17 19:27:26 -04:00
|
|
|
|
|
|
|
if (closure->destroy_cb)
|
|
|
|
closure->destroy_cb (closure->user_data);
|
|
|
|
|
|
|
|
g_slice_free (CoglClosure, closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-06-08 18:03:25 -04:00
|
|
|
_cogl_closure_list_disconnect_all (CoglList *list)
|
2013-04-17 19:27:26 -04:00
|
|
|
{
|
|
|
|
CoglClosure *closure, *next;
|
|
|
|
|
2013-06-08 18:03:25 -04:00
|
|
|
_cogl_list_for_each_safe (closure, next, list, link)
|
2013-04-17 19:27:26 -04:00
|
|
|
_cogl_closure_disconnect (closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
CoglClosure *
|
2013-06-08 18:03:25 -04:00
|
|
|
_cogl_closure_list_add (CoglList *list,
|
2013-04-17 19:27:26 -04:00
|
|
|
void *function,
|
|
|
|
void *user_data,
|
|
|
|
CoglUserDataDestroyCallback destroy_cb)
|
|
|
|
{
|
|
|
|
CoglClosure *closure = g_slice_new (CoglClosure);
|
|
|
|
|
|
|
|
closure->function = function;
|
|
|
|
closure->user_data = user_data;
|
|
|
|
closure->destroy_cb = destroy_cb;
|
|
|
|
|
2013-06-08 18:03:25 -04:00
|
|
|
_cogl_list_insert (list, &closure->link);
|
2013-04-17 19:27:26 -04:00
|
|
|
|
|
|
|
return closure;
|
|
|
|
}
|