Tengo instalado el php-gtk2, lo instale con Gnope-1.5.1, el php-gtk2 funciona perfectamente debido a que ya realice algunas aplicaciones de practica.
Tambien tengo el Glade3-3.6.1 instalado.
Lo que e echo es crear una GUI en Glade, guardo el archivo *.glade (hasta aqui todo bien), el problema surge cuando intento utilizar la clase GladeXML
Código PHP:
$glade = new GladeXML(dirname( __FILE__)."/hellowg.glade");
Código:
Yo creo que el XML que esta generando el Glade no es compatible con la clase GladeXML, ya que buscando me encontré un XML de un archivo Glade y con ese si se crea la ventana y un boton, que es lo que trae el XML. La estructura de ambos archivos son diferentes.(apli2_glade.php:2472): libglade-WARNING **: Expected <glade-interface>. Got <GTK-Interface>.
(apli2_glade.php:2472): libglade-WARNING **: did not finish in PARSER_FINISH state
PHP Fatal error: Encaught exception 'PhpGtkConstructException' whith message 'could not construct GladeXML object' in c:\php-gtk2\test\apli2_glade.php:14
Stack trace:
#0 c:\php-gtk2\test\apli2_glade.php(14): GladeXML->_construct('c:\php-gtk2\tes...')
#1 {main}
thrown in c:\php-gtk2\test\apli2_glade.php on line 14
XML encontrado en Internet
Código:
XML generado con el Glade<?xml version="1.0" standalone="no"?><!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkWindow" id="main">
<property name="visible">True</property>
<property name="title" translatable="yes">Hello</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="border_width">15</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Hello libGlade!</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
Código:
No se como hacerlos compatibles o alomejor es otro el problema, Ojala me puedan ayudar.<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>example-gladexml.constructor</name>
<program_name>example-gladexml.constructor</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>False</gnome_support>
<gettext_support>False</gettext_support>
</project>
<widget>
<class>GtkWindow</class>
<name>dlgHellow</name>
<title>Hello World!</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>lblHello</name>
<label>Hello world!
This is the example program
for the GladeXML class</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>btnClose</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>test</handler>
<last_modification_time>Sun, 29 Aug 2004 10:33:10 GMT</last_modification_time>
</signal>
<label>Close this window</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</GTK-Interface>
un saludo.
... 
