GPS confusing GTKAda.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GPS confusing GTKAda.

Pascal-68
Hello,

With some GTKAda programs built with XAdaLib on MacOS, setting environment variables as GDK_PIXBUF_MODULEDIR may puzzle execution, for instance issuing errors as:
"Couldn't recognize the image file format for file"

Now GPS sets many of them in execution script, so execution of GTKAda program from GPS may produce these kind of errors.

The workaround is to execute the program from Terminal, same for debugging with GDB.

HTH, Pascal.
http://blady.pagesperso-orange.fr


_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Reply | Threaded
Open this post in threaded view
|

Re: GPS confusing GTKAda.

Pascal-68
Hello,

I discover that before executing GPS executable, the gps script saves GTK env var in GPS_STARTUP env var.
So came up the idea to restore the original values before doing Gtk.Main.Init as:

<...>
with Ada.Environment_Variables;
with Ada.Strings.Fixed;

procedure Restore_GPS_Startup_Values is
   procedure Internal_RGSV (Saved_Var_Name, Saved_Var_Value : String) is
      GPS_STARTUP : constant String  := "GPS_STARTUP_";
      Ind         : constant Natural :=
        Ada.Strings.Fixed.Index (Saved_Var_Name, GPS_STARTUP);
      Oringinal_Var_Name : constant String :=
        Saved_Var_Name (Ind + GPS_STARTUP'Length .. Saved_Var_Name'Last);
   begin
      if Ind > 0
        and then Ada.Environment_Variables.Exists (Oringinal_Var_Name)
      then
         if Saved_Var_Value /= "" then
            Ada.Environment_Variables.Set
              (Oringinal_Var_Name,
               Saved_Var_Value);
         else
            Ada.Environment_Variables.Clear (Oringinal_Var_Name);
         end if;
      end if;
   end Internal_RGSV;
begin
   Ada.Environment_Variables.Iterate (Internal_RGSV'Access);
end Restore_GPS_Startup_Values;

procedure Testgtk is
   Win     : Main_Windows.Main_Window;
begin
   Restore_GPS_Startup_Values;
   Gtk.Main.Init;
<...>

Now I can launch and debug my GTKAda programs from GPS 8-)

Shouldn't GPS do that directly?

Season greetings, Pascal.
http://blady.pagesperso-orange.fr


> Le 6 avr. 2015 à 17:36, Pascal <[hidden email]> a écrit :
>
> Hello,
>
> With some GTKAda programs built with XAdaLib on MacOS, setting environment variables as GDK_PIXBUF_MODULEDIR may puzzle execution, for instance issuing errors as:
> "Couldn't recognize the image file format for file"
>
> Now GPS sets many of them in execution script, so execution of GTKAda program from GPS may produce these kind of errors.
>
> The workaround is to execute the program from Terminal, same for debugging with GDB.
>
> HTH, Pascal.
> http://blady.pagesperso-orange.fr
>
>

_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Reply | Threaded
Open this post in threaded view
|

Re: GPS confusing GTKAda.

Nicolas Setton

Hello Pascal,

[snip]

> Now I can launch and debug my GTKAda programs from GPS 8-)
>
> Shouldn't GPS do that directly?


Absolutely! We'll have a look and probably do something similar in GPS.
_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada