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