pike.git / src / post_modules / GTK2 / source / support.c

version» Context lines:

pike.git/src/post_modules/GTK2/source/support.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: support.c,v 1.17 2007/11/28 13:17:24 per Exp $ + || $Id: support.c,v 1.18 2008/01/23 04:27:46 per Exp $   */      #include <version.h>   #include <bignum.h>   #include <stdarg.h>      #ifndef INIT_VARIABLES   extern struct program *image_color_program;   extern struct program *image_program;   #endif
pike.git/src/post_modules/GTK2/source/support.c:588:   }      static int pgtk2_push_pike_object_param(const GValue *a) {    struct object *o=g_value_get_pointer(a);    if (o)    ref_push_object(o);    return PUSHED_VALUE;   }      static int pgtk2_push_gparamspec_param(const GValue *a) { +  push_int(0); +  return PUSHED_VALUE;   }      static struct push_callback {    int (*callback)(const GValue *);    GType id;    struct push_callback *next;   } push_callbacks[100], *push_cbtable[63];      static int last_used_callback = 0;   
pike.git/src/post_modules/GTK2/source/support.c:716:    return;    }    else if( !strcmp( s, "guint" ) )    {    push_int64(g_value_get_uint(param));    return;    }    break;    }    } -  +  {    char *a="";    if (!s) {    a="Unknown child of ";    s=g_type_name(g_type_parent(t));    if (!s)    s="unknown type";    }    Pike_error("No push callback for type %d (%s%s)\n",t,a,s);    } -  +  }    return;   }      #include <gobject/gvaluecollector.h>      /* This function makes a few assumptions about how signal handlers are    * called in GTK. I could not find any good documentation about that,    * and the source is somewhat obscure (for good reasons, it's a highly    * non-trivial thing to do)    *    * But, the thing that this code asumes that I am most unsure about is that    * params[nparams] should be set to the return value. It does seem to work,    * though.    */   /* This function is implement by the functions in the gobject api */   void pgtk2_signal_func_wrapper(struct signal_data *d,    gpointer go,    guint n_params,    const GValue *param_values,    GValue *return_value) { -  int i; +  unsigned int i;       if (!last_used_callback)    build_push_callbacks();    push_gobject(G_OBJECT(go));    for (i=0; i<n_params; i++) {    pgtk2_push_gvalue_rt(&(param_values[i]));    }    if (n_params)    f_aggregate(n_params);    push_svalue(&d->args);
pike.git/src/post_modules/GTK2/source/support.c:1206:    case G_TYPE_BOOLEAN:    g_value_set_boolean(gv,(gboolean)PGTK_GETINT(sv));    break;    case G_TYPE_FLOAT:    g_value_set_float(gv,(gfloat)pgtk2_get_float(sv));    break;    case G_TYPE_DOUBLE:    g_value_set_double(gv,(gdouble)pgtk2_get_float(sv));    break;    case G_TYPE_STRING: -  if (sv->type==PIKE_T_STRING) { -  g_value_set_string(gv,CGSTR0(sv->u.string)); -  add_ref(sv->u.string); +  if (sv->type==PIKE_T_STRING) +  { +  push_svalue( sv ); +  f_string_to_utf8(1); +  g_value_set_string(gv,CGSTR0(Pike_sp[-1].u.string)); +  pop_stack();    } else    g_value_set_string(gv,"");    break;    case G_TYPE_OBJECT:    if (sv->type==PIKE_T_OBJECT) {    GObject *go=get_gobject(sv->u.object);    if (go && G_IS_OBJECT(go))    g_value_set_object(gv,go);    else    g_value_set_object(gv,NULL);