[gtkada] gtk-entry_completion.adb

Op de Coul, Manuel Manuel.op.de.Coul at eon.com
Thu May 31 17:36:13 CEST 2012


Hello, 

The spec of Gtk.Entry_Completion says:

   procedure Set_Model
     (Completion : access Gtk_Entry_Completion_Record;
      Model      : Gtk.Tree_Model.Gtk_Tree_Model);
   function Get_Model
     (Completion : access Gtk_Entry_Completion_Record)
      return Gtk.Tree_Model.Gtk_Tree_Model;
   --  Returns the model the completion is using as data source.
   --  Returns null if the model is unset (setting it to null unsets the
   --  current model)

But if Set_Model has a null Model then Constraint_Error is raised. 
In the past I found the same problem in Gtk.Tree_View, which was then changed to:

   procedure Set_Model
     (Tree_View : access Gtk_Tree_View_Record;
      Model     : Gtk.Tree_Model.Gtk_Tree_Model)
   is
      procedure Internal
        (Tree_View : System.Address;
         Model     : System.Address);
      pragma Import (C, Internal, "gtk_tree_view_set_model");

   begin
      if Model = null then
         Internal (Get_Object (Tree_View), System.Null_Address);
      else
         Internal (Get_Object (Tree_View), Get_Object (Model));
      end if;
   end Set_Model;

So this implementation should I think be changed in the same way:

   procedure Set_Model
     (Completion : access Gtk_Entry_Completion_Record;
      Model      : Gtk_Tree_Model)
   is
      procedure Internal
        (Completion : System.Address;
         Model      : System.Address);
      pragma Import (C, Internal, "gtk_entry_completion_set_model");
   begin
      Internal (Get_Object (Completion), Get_Object (Model));
   end Set_Model;

Thanks,
Manuel



More information about the gtkada mailing list