PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/library/externals/plugin/c/callbacks.c

http://github.com/tybor/Liberty
C | 62 lines | 27 code | 6 blank | 29 comment | 0 complexity | a1ce200cfd2cf87d9f97d80b52cdcb13 MD5 | raw file
 1/*
 2	Author: Paolo Redaelli, Natalia B. Bidart
 3	Copyright (C) 2006 Paolo Radaelli
 4	Copyright (C) 2006 Soluciones Informaticas Libres S.A. (Except)
 5	
 6	This library is free software; you can redistribute it and/or
 7	modify it under the terms of the GNU Lesser General Public License
 8	as published by the Free Software Foundation; either version 2.1 of
 9	the License, or (at your option) any later version.
10					
11	This library is distributed in the hope that it will be useful, but
12	WITHOUT ANY WARRANTY; without even the implied warranty of
13	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14	Lesser General Public License for more details.
15
16	You should have received a copy of the GNU Lesser General Public
17	License along with this library; if not, write to the Free Software
18	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19	02110-1301 USA
20*/
21#include "callbacks.h"
22
23#include <stdio.h>
24
25CallbackClosure *new_curl_closure (void *C, void *f) {
26    CallbackClosure *result;
27    result = malloc (sizeof(CallbackClosure));
28    result->Current = C;
29    result->function = f;
30    return result;
31}
32
33CallbackClosure *free_closure (CallbackClosure *c) {
34	free (c);
35	c = NULL;
36	return c;
37}
38
39/* gboolean EiffelGtkTreeForeachFunc (GtkTreeModel *model, */
40/* 				    GtkTreePath *path,  */
41/* 				    GtkTreeIter *iter,  */
42/* 				    gpointer data) { */
43/*   return (0); */
44/* }; */
45
46int EiffelGtkTreeSelectionFunc (void *selection,
47				void *model,
48				void *path,
49				int path_currently_selected,
50				CallbackClosure *data) {
51  void *current;
52  int (*function)(void *, void *, void *, void *, int);
53  /* printf ("EiffelGtkTreeSelectionFunc called\n"); */
54  current = data->Current;
55  /* casting data[0], a pointer to function into the function
56     signature*/
57  function = data->function; //((int)(void *, void *, void *, void *, int)) data[0];
58  return function(current,
59		  selection, model, path,
60		  path_currently_selected));
61};
62