Branch: Tag:

2005-11-03

2005-11-03 13:49:47 by Lance Dillon <riffraff169@yahoo.com>

Updated to latest version 2.17 of the GTK2 module.
Includes gtksourceview, gtkdatabox, and libglade support.

Rev: src/post_modules/GTK2/Makefile.in:1.3
Rev: src/post_modules/GTK2/acconfig.h:1.5
Rev: src/post_modules/GTK2/build_pgtk.pike:1.3
Rev: src/post_modules/GTK2/configure.in:1.11
Rev: src/post_modules/GTK2/options.in:1.3
Rev: src/post_modules/GTK2/pgtk.h:1.5
Rev: src/post_modules/GTK2/source/common_draw.inc:1.2
Rev: src/post_modules/GTK2/source/constants.pre:1.3
Rev: src/post_modules/GTK2/source/encode_truecolor.c:1.2
Rev: src/post_modules/GTK2/source/gdkbitmap.pre:1.2
Rev: src/post_modules/GTK2/source/gdkcolor.pre:1.2
Rev: src/post_modules/GTK2/source/gdkdisplay.pre:1.2
Rev: src/post_modules/GTK2/source/gdkdragcontext.pre:1.2
Rev: src/post_modules/GTK2/source/gdkdrawable.pre:1.2
Rev: src/post_modules/GTK2/source/gdkevent.pre:1.2
Rev: src/post_modules/GTK2/source/gdkgc.pre:1.2
Rev: src/post_modules/GTK2/source/gdkimage.pre:1.2
Rev: src/post_modules/GTK2/source/gdkpixbuf.pre:1.2
Rev: src/post_modules/GTK2/source/gdkpixbufanimation.pre:1.3
Rev: src/post_modules/GTK2/source/gdkpixbufanimationiter.pre:1.3
Rev: src/post_modules/GTK2/source/gdkpixmap.pre:1.2
Rev: src/post_modules/GTK2/source/gdkrectangle.pre:1.2
Rev: src/post_modules/GTK2/source/gdkregion.pre:1.2
Rev: src/post_modules/GTK2/source/gdkwindow.pre:1.2
Rev: src/post_modules/GTK2/source/gladexml.pre:1.2
Rev: src/post_modules/GTK2/source/global.pre:1.2
Rev: src/post_modules/GTK2/source/gnomecanvas.pre:1.2
Rev: src/post_modules/GTK2/source/gnomeclient.pre:1.2
Rev: src/post_modules/GTK2/source/gnomedruidpageedge.pre:1.2
Rev: src/post_modules/GTK2/source/gnomedruidpagestandard.pre:1.2
Rev: src/post_modules/GTK2/source/gobject.pre:1.3
Rev: src/post_modules/GTK2/source/gtkaboutdialog.pre:1.2
Rev: src/post_modules/GTK2/source/gtkaccelgroup.pre:1.2
Rev: src/post_modules/GTK2/source/gtkaccellabel.pre:1.2
Rev: src/post_modules/GTK2/source/gtkaction.pre:1.2
Rev: src/post_modules/GTK2/source/gtkactiongroup.pre:1.2
Rev: src/post_modules/GTK2/source/gtkadjustment.pre:1.2
Rev: src/post_modules/GTK2/source/gtkalignment.pre:1.2
Rev: src/post_modules/GTK2/source/gtkarrow.pre:1.2
Rev: src/post_modules/GTK2/source/gtkaspectframe.pre:1.2
Rev: src/post_modules/GTK2/source/gtkbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcalendar.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellrenderer.pre:1.3
Rev: src/post_modules/GTK2/source/gtkcellrenderercombo.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellrendererpixbuf.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellrendererprogress.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellrenderertext.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellrenderertoggle.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcellview.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcheckbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcheckmenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcolorbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcolorselection.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcolorselectiondialog.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcombobox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcomboboxentry.pre:1.2
Rev: src/post_modules/GTK2/source/gtkcontainer.pre:1.2
Rev: src/post_modules/GTK2/source/gtkdialog.pre:1.2
Rev: src/post_modules/GTK2/source/gtkdrawingarea.pre:1.2
Rev: src/post_modules/GTK2/source/gtkeditable.inc:1.2
Rev: src/post_modules/GTK2/source/gtkentry.pre:1.2
Rev: src/post_modules/GTK2/source/gtkentrycompletion.pre:1.2
Rev: src/post_modules/GTK2/source/gtkeventbox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkexpander.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfilechooser.inc:1.2
Rev: src/post_modules/GTK2/source/gtkfilechooserbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfilechooserdialog.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfilechooserwidget.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfileselection.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfixed.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfontbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfontselection.pre:1.2
Rev: src/post_modules/GTK2/source/gtkfontselectiondialog.pre:1.2
Rev: src/post_modules/GTK2/source/gtkframe.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhandlebox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhbox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhbuttonbox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhpaned.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhscale.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhscrollbar.pre:1.2
Rev: src/post_modules/GTK2/source/gtkhseparator.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconfactory.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconinfo.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconset.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconsize.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconsource.pre:1.2
Rev: src/post_modules/GTK2/source/gtkicontheme.pre:1.2
Rev: src/post_modules/GTK2/source/gtkiconview.pre:1.2
Rev: src/post_modules/GTK2/source/gtkimage.pre:1.2
Rev: src/post_modules/GTK2/source/gtkimagemenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtkinvisible.pre:1.2
Rev: src/post_modules/GTK2/source/gtklabel.pre:1.2
Rev: src/post_modules/GTK2/source/gtklayout.pre:1.2
Rev: src/post_modules/GTK2/source/gtkliststore.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmenu.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmenubar.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmenushell.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmenutoolbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkmisc.pre:1.2
Rev: src/post_modules/GTK2/source/gtknotebook.pre:1.2
Rev: src/post_modules/GTK2/source/gtkplug.pre:1.2
Rev: src/post_modules/GTK2/source/gtkprogressbar.pre:1.2
Rev: src/post_modules/GTK2/source/gtkradioaction.pre:1.2
Rev: src/post_modules/GTK2/source/gtkradiobutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkradiomenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtkradiotoolbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkscrolledwindow.pre:1.2
Rev: src/post_modules/GTK2/source/gtkseparatormenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtkseparatortoolitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtksettings.pre:1.2
Rev: src/post_modules/GTK2/source/gtksizegroup.pre:1.2
Rev: src/post_modules/GTK2/source/gtksocket.pre:1.2
Rev: src/post_modules/GTK2/source/gtkspinbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtkstatusbar.pre:1.2
Rev: src/post_modules/GTK2/source/gtktable.pre:1.2
Rev: src/post_modules/GTK2/source/gtktearoffmenuitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtktextattributes.pre:1.2
Rev: src/post_modules/GTK2/source/gtktextbuffer.pre:1.2
Rev: src/post_modules/GTK2/source/gtktextiter.pre:1.2
Rev: src/post_modules/GTK2/source/gtktextmark.pre:1.2
Rev: src/post_modules/GTK2/source/gtktexttag.pre:1.2
Rev: src/post_modules/GTK2/source/gtktextview.pre:1.2
Rev: src/post_modules/GTK2/source/gtktoggleaction.pre:1.2
Rev: src/post_modules/GTK2/source/gtktogglebutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtktoggletoolbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtktoolbar.pre:1.2
Rev: src/post_modules/GTK2/source/gtktoolbutton.pre:1.2
Rev: src/post_modules/GTK2/source/gtktoolitem.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreeiter.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreemodel.inc:1.2
Rev: src/post_modules/GTK2/source/gtktreepath.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreerowreference.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreeselection.pre:1.5
Rev: src/post_modules/GTK2/source/gtktreesortable.inc:1.2
Rev: src/post_modules/GTK2/source/gtktreestore.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreeview.pre:1.2
Rev: src/post_modules/GTK2/source/gtktreeviewcolumn.pre:1.2
Rev: src/post_modules/GTK2/source/gtkuimanager.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvbox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvbuttonbox.pre:1.2
Rev: src/post_modules/GTK2/source/gtkviewport.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvpaned.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvscale.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvscrollbar.pre:1.2
Rev: src/post_modules/GTK2/source/gtkvseparator.pre:1.2
Rev: src/post_modules/GTK2/source/gtkwidget.pre:1.2
Rev: src/post_modules/GTK2/source/gtkwindow.pre:1.2
Rev: src/post_modules/GTK2/source/pangoattrlist.pre:1.2
Rev: src/post_modules/GTK2/source/pangocontext.pre:1.2
Rev: src/post_modules/GTK2/source/pangofontdescription.pre:1.2
Rev: src/post_modules/GTK2/source/pangolayout.pre:1.2
Rev: src/post_modules/GTK2/source/pangolayoutiter.pre:1.2
Rev: src/post_modules/GTK2/source/pangolayoutline.pre:1.2
Rev: src/post_modules/GTK2/source/support.c:1.2

2:   || 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.1 2005/07/28 15:19:44 nilsson Exp $ + || $Id: support.c,v 1.2 2005/11/03 13:49:47 ldillon Exp $   */      #include <version.h>
13:      void pgtk_verify_setup() {    if (!pigtk_is_setup) -  Pike_error("You must call GTK.setup_gtk( argv ) first\n"); +  Pike_error("You must call GTK2.setup_gtk( argv ) first\n");   }      void pgtk_verify_gnome_setup() {    extern int gnome_is_setup;    if (!gnome_is_setup) -  Pike_error("You must call Gnome.init( app,version,argv[,do_corba] ) first\n"); +  Pike_error("You must call Gnome2.init( app,version,argv ) first\n");   }      void pgtk_verify_inited() {
368:    pop_stack();    return r;    } -  Pike_error("Got non GDK.Atom object to get_gdkatom()\n"); +  Pike_error("Got non GDK2.Atom object to get_gdkatom()\n");   }      
545:    return PUSHED_VALUE;   }    + static int pgtk_push_pike_object_param(GValue *a) { +  struct object *o=g_value_get_pointer(a); +  if (o) +  ref_push_object(o); +  return PUSHED_VALUE; + } +    static int pgtk_push_gparamspec_param(GValue *a) {   }   
604:       CB( G_TYPE_NONE, NULL );    -  CB( G_TYPE_POINTER, NULL ); +  CB( G_TYPE_POINTER, pgtk_push_pike_object_param );       CB( G_TYPE_PARAM, pgtk_push_gparamspec_param );   /*
613:    * This might not be exactly what we want */   }    - static void push_gvalue_r(GValue *param, GType t) { + void push_gvalue_r(GValue *param, GType t) {    int i;    struct push_callback *cb=push_cbtable[t%63];   
676:    continue;    }    push_gvalue_r(&v,opts->param_types[i]); +  j++;    } -  if (opts->n_params) -  f_aggregate(opts->n_params); +  if (j /*opts->n_params*/) +  f_aggregate(j /*opts->n_params*/);    {    GObject *obj=va_arg(ptr,GObject *);    push_gobject(obj);    }    va_end(ptr); -  if (opts->n_params) +  +  if (j /*opts->n_params*/)    stack_swap();    push_svalue(&d->args); -  if (opts->n_params) +  if (j /*opts->n_params*/)    apply_svalue(&d->cb,3);    else    apply_svalue(&d->cb,2);
822:    return;    }   */ -  if (gps->value_type==GDK_TYPE_PIXMAP) { +  if (sv->type==PIKE_T_OBJECT && get_gobject(sv->u.object) && +  G_IS_OBJECT(get_gobject(sv->u.object))) { +  if (gps->value_type==GDK_TYPE_PIXMAP || gps->value_type==GTK_TYPE_WIDGET)    g_object_set(g,prop,get_gobject(sv->u.object),NULL);    return;    }
1031:   }      void pgtk_set_gvalue(GValue *gv, GType gt, struct svalue *sv) { +  g_value_init(gv,gt); +  if (G_TYPE_IS_ENUM(gt)) { +  g_value_set_enum(gv,(gint)PGTK_GETINT(sv)); +  return; +  } + /* if (G_TYPE_IS_OBJECT(gt)) { */ +  if (G_TYPE_IS_OBJECT(gt) || gt==GDK_TYPE_DISPLAY || +  gt==GDK_TYPE_PIXBUF || gt==GDK_TYPE_PIXMAP || gt==GDK_TYPE_IMAGE || +  gt==GDK_TYPE_WINDOW || gt==GDK_TYPE_VISUAL || gt==GDK_TYPE_SCREEN || +  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)); +  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; +  }    switch (gt) {    case G_TYPE_INT: -  g_value_init(gv,G_TYPE_INT); +     g_value_set_int(gv,(gint)PGTK_GETINT(sv));    break;    case G_TYPE_UINT: -  g_value_init(gv,G_TYPE_UINT); +     g_value_set_uint(gv,(guint)PGTK_GETINT(sv));    break;    case G_TYPE_CHAR: -  g_value_init(gv,G_TYPE_CHAR); +     g_value_set_char(gv,(gchar)PGTK_GETINT(sv));    break;    case G_TYPE_UCHAR: -  g_value_init(gv,G_TYPE_UCHAR); +     g_value_set_uchar(gv,(guchar)PGTK_GETINT(sv));    break;    case G_TYPE_LONG: -  g_value_init(gv,G_TYPE_LONG); +     g_value_set_long(gv,(glong)PGTK_GETINT(sv));    break;    case G_TYPE_ULONG: -  g_value_init(gv,G_TYPE_ULONG); +     g_value_set_ulong(gv,(gulong)PGTK_GETINT(sv));    break;    case G_TYPE_INT64: -  g_value_init(gv,G_TYPE_INT64); +     g_value_set_int64(gv,(gint64)PGTK_GETINT(sv));    break;    case G_TYPE_UINT64: -  g_value_init(gv,G_TYPE_UINT64); +     g_value_set_uint64(gv,(guint64)PGTK_GETINT(sv));    break;    case G_TYPE_ENUM: -  g_value_init(gv,G_TYPE_ENUM); +     g_value_set_enum(gv,(gint)PGTK_GETINT(sv));    break;    case G_TYPE_FLAGS: -  g_value_init(gv,G_TYPE_FLAGS); +     g_value_set_flags(gv,(gint)PGTK_GETINT(sv));    break;    case G_TYPE_BOOLEAN: -  g_value_init(gv,G_TYPE_BOOLEAN); +     g_value_set_boolean(gv,(gboolean)PGTK_GETINT(sv));    break;    case G_TYPE_FLOAT: -  g_value_init(gv,G_TYPE_FLOAT); +     g_value_set_float(gv,(gfloat)pgtk_get_float(sv));    break;    case G_TYPE_DOUBLE: -  g_value_init(gv,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_init(gv,G_TYPE_STRING); +     g_value_set_string(gv,s);    PGTK_FREESTR(s);    }    break;    case G_TYPE_OBJECT: -  g_value_init(gv,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));
1101:    g_value_set_object(gv,NULL);    break;    case G_TYPE_POINTER: -  g_value_init(gv,G_TYPE_POINTER); +     if (sv->type==PIKE_T_OBJECT) {    g_value_set_pointer(gv,sv->u.object);    add_ref(sv->u.object);
1109:    g_value_set_pointer(gv,NULL);    break;    default: -  Pike_error("Unable to handle type %d.\n",gt); +  Pike_error("Unable to handle type %d - %s.\n",gt,g_type_name(gt));    }   }   
1120:    push_gobjectclass(a,pgtk_tree_iter_program);    push_gobjectclass(b,pgtk_tree_iter_program);    push_svalue(&d->args); -  apply_svalue(&d->cb,3); +  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) { +  GParamSpec *pspec; +  GObject *obj; +  GObjectClass *class; +  GParameter *params; +  struct keypair *k; +  int e; +  int i=0,j; +  +  class=g_type_class_ref(type); +  if (class==NULL) +  Pike_error("Could not get a reference to type %s.\n",g_type_name(type)); +  params=g_new0(GParameter,m_sizeof(m)); +  NEW_MAPPING_LOOP(m->data) { +  if (k->ind.type==PIKE_T_STRING) { +  gchar *s=PGTK_GETSTR(&k->ind); +  pspec=g_object_class_find_property(class,s); +  if (!pspec) { +  PGTK_FREESTR(s); +  continue; +  } + /* g_value_init(&params[i].value,G_PARAM_SPEC_VALUE_TYPE(pspec)); */ +  pgtk_set_gvalue(&params[i].value,G_PARAM_SPEC_VALUE_TYPE(pspec),&k->val); +  params[i++].name=s; +  } +  } +  obj=g_object_newv(type,i,params); +  for (j=0; j<i; j++) { +  PGTK_FREESTR((gchar *)params[j].name); +  g_value_unset(&params[j].value); +  } +  g_free(params); +  g_type_class_unref(class); +  return obj; + }