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.9 2006/01/04 23:57:33 marcus Exp $ + || $Id: support.c,v 1.10 2006/02/04 22:06:55 ldillon 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:850:   /*    if (gps->value_type==PANGO_TYPE_STYLE ||    gps->value_type==GTK_TYPE_WRAP_MODE ||    gps->value_type==GTK_TYPE_JUSTIFICATION ||    gps->value_type==PANGO_TYPE_UNDERLINE ||    gps->value_type==GTK_TYPE_TEXT_DIRECTION) {    g_object_set(g,prop,PGTK_GETINT(sv),NULL);    return;    }   */ -  if (sv->type==PIKE_T_OBJECT && get_gobject(sv->u.object) && -  G_IS_OBJECT(get_gobject(sv->u.object))) { +  if (sv->type==PIKE_T_OBJECT) { +  GObject *go=get_gobject(sv->u.object); +  if (go && G_IS_OBJECT(go)) {    if (gps->value_type==GDK_TYPE_PIXMAP || gps->value_type==GTK_TYPE_WIDGET) -  g_object_set(g,prop,get_gobject(sv->u.object),NULL); +  g_object_set(g,prop,go,NULL);    return;    } -  +  }   #define do_type(X) do { X i=PGTK_GETINT(sv); g_object_set(g,prop,i,NULL); } while(0)    switch (gps->value_type) {    case G_TYPE_INT:    case G_TYPE_FLAGS:    case G_TYPE_ENUM:    do_type(gint);    break;    case G_TYPE_UINT:    do_type(guint);    break;
pike.git/src/post_modules/GTK2/source/support.c:1074:    return;    }   /* if (G_TYPE_IS_OBJECT(gt)) { */    if (G_TYPE_IS_OBJECT(gt) ||   #ifdef HAVE_GTK22    gt==GDK_TYPE_DISPLAY || gt==GDK_TYPE_SCREEN ||   #endif    gt==GDK_TYPE_PIXBUF || gt==GDK_TYPE_PIXMAP || gt==GDK_TYPE_IMAGE ||    gt==GDK_TYPE_WINDOW || gt==GDK_TYPE_VISUAL ||    gt==GDK_TYPE_DRAWABLE || gt==GDK_TYPE_GC) { -  if (sv->type==PIKE_T_OBJECT && get_gobject(sv->u.object) && -  G_IS_OBJECT(get_gobject(sv->u.object))) -  g_value_set_object(gv,get_gobject(sv->u.object)); +  if (sv->type==PIKE_T_OBJECT) { +  GObject *go; +  go=get_gobject(sv->u.object); +  if (go && G_IS_OBJECT(go)) +  g_value_set_object(gv,go);    return;    } -  +  }    if (gt==GDK_TYPE_COLOR) {    if (sv->type==PIKE_T_OBJECT && get_gdkobject(sv->u.object,color))    g_value_set_boxed(gv,get_gdkobject(sv->u.object,color));    return;    }    if (gt==GDK_TYPE_RECTANGLE) {    if (sv->type==PIKE_T_OBJECT && get_gdkobject(sv->u.object,rectangle))    g_value_set_boxed(gv,get_gdkobject(sv->u.object,rectangle));    return;    }
pike.git/src/post_modules/GTK2/source/support.c:1130:    case G_TYPE_BOOLEAN:    g_value_set_boolean(gv,(gboolean)PGTK_GETINT(sv));    break;    case G_TYPE_FLOAT:    g_value_set_float(gv,(gfloat)pgtk_get_float(sv));    break;    case G_TYPE_DOUBLE:    g_value_set_double(gv,(gdouble)pgtk_get_float(sv));    break;    case G_TYPE_STRING: -  { -  char *s=PGTK_GETSTR(sv); -  g_value_set_string(gv,s); -  PGTK_FREESTR(s); -  } +  if (sv->type==PIKE_T_STRING) +  g_value_set_string(gv,GSTR0(sv->u.string)); +  else +  g_value_set_string(gv,"");    break;    case G_TYPE_OBJECT: -  if (sv->type==PIKE_T_OBJECT && get_gobject(sv->u.object) && -  G_IS_OBJECT(get_gobject(sv->u.object))) -  g_value_set_object(gv,get_gobject(sv->u.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); -  +  } else +  g_value_set_object(gv,NULL);    break;    case G_TYPE_POINTER:    if (sv->type==PIKE_T_OBJECT) {    g_value_set_pointer(gv,sv->u.object);    add_ref(sv->u.object);    } else    g_value_set_pointer(gv,NULL);    break;    default:    Pike_error("Unable to handle type %d - %s.\n",gt,g_type_name(gt));    }   }      int pgtk_tree_sortable_callback(GtkTreeModel *model, GtkTreeIter *a,    GtkTreeIter *b, struct signal_data *d) {    int res; -  push_gobjectclass(model,pgtk_tree_model_program); + /* push_gobjectclass(model,pgtk_tree_model_program); */ +  push_gobject(model);    push_gobjectclass(a,pgtk_tree_iter_program);    push_gobjectclass(b,pgtk_tree_iter_program);    push_svalue(&d->args);    apply_svalue(&d->cb,4);    res=Pike_sp[-1].u.integer;    pop_stack();    return res;   }      GObject *pgtk_create_new_obj_with_properties(GType type, struct mapping *m) {