[gtkada] Bug in generation of source from glade

Preben Randhol randhol at pvv.org
Thu Nov 1 19:41:16 CET 2001


If I pack an element in a box and choose it to be packed from the end,
the code that is generated is wrong.

Example: [glade file is attached]

Packing two labels in a Vbox. The first is Pact_Start the second
Pack_End, but the code generated is:

   Gtk_New (Window1.Label1, "label1");
   Set_Alignment (Window1.Label1, 0.5, 0.5);
   Set_Padding (Window1.Label1, 0, 0);
   Set_Justify (Window1.Label1, Justify_Center);
   Set_Line_Wrap (Window1.Label1, False);
   Pack_Start (Window1.Vbox1, Window1.Label1, False, False, 0);

   Gtk_New (Window1.Label2, "label2");
   Set_Alignment (Window1.Label2, 0.5, 0.5);
   Set_Padding (Window1.Label2, 0, 0);
   Set_Justify (Window1.Label2, Justify_Center);
   Set_Line_Wrap (Window1.Label2, False);
   Add (Window1.Vbox1, Window1.Label2);

The last line should be:

   Pack_End (Window1.Vbox1, Window1.Label2, False, False, 0);
not
   Add (Window1.Vbox1, Window1.Label2);

as this gives a wrong result in the packing.

I tried to find where the error is in the source code of gate, but I'm
uncertain where to do the corrections so unfortunately I cannot give a
patch :-(

I use GtkAda 1.2.12-3 on Linux and Glade is 0.6.2-9.

-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»
-------------- next part --------------
<?xml version="1.0"?>
<GTK-Interface>

<project>
  <name>Wrong_Add</name>
  <program_name>wrong_add</program_name>
  <directory></directory>
  <source_directory>src</source_directory>
  <pixmaps_directory>pixmaps</pixmaps_directory>
  <language>Ada 95</language>
  <gnome_support>False</gnome_support>
  <gettext_support>False</gettext_support>
</project>

<widget>
  <class>GtkWindow</class>
  <name>window1</name>
  <title>window1</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>label1</name>
      <label>label1</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>False</expand>
	<fill>False</fill>
      </child>
    </widget>

    <widget>
      <class>GtkLabel</class>
      <name>label2</name>
      <label>label2</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>False</expand>
	<fill>False</fill>
	<pack>GTK_PACK_END</pack>
      </child>
    </widget>
  </widget>
</widget>

</GTK-Interface>


More information about the gtkada mailing list