with Gtk.Menu_Item; use Gtk.Menu_Item; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Glib.Error; use Glib.Error; with Gtk.Widget; use Gtk.Widget; with Gtk.Dialog; use Gtk.Dialog; with Gtk.Button; use Gtk.Button; with Gtk.About_Dialog; use Gtk.About_Dialog; with Gtk.Label; use Gtk.Label; with Ada.Text_IO; use Ada.Text_IO; with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; --with open_file_selection_pkg; use open_file_selection_pkg; with Gtk.File_Chooser; use Gtk.File_Chooser; with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Translate; use Translate; with Framework_Config; use Framework_Config; with Project; use Project; with Xml_generic_Parsers; use Xml_generic_Parsers; with Xml_generic_Parsers.architecture; use Xml_generic_Parsers.architecture; with graphical_editor.user_message; use graphical_editor.user_message; with Glib; use Glib; with Glib.Object; use Glib.Object; package body graphical_editor.save_xmls_callbacks is procedure save_xml_file (Object : access Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); Save_File_Chooser : GObject; begin begin Save_File_Chooser :=Get_Object(Object, "filechooserdialog1"); Xml_Project_File_Name := To_Unbounded_String (Get_Filename (+(Gtk_File_Chooser_Dialog(Save_File_Chooser)))); Systems.Write_To_Xml_File (Sys, Xml_Project_File_Name); Is_Saved := True; Is_New := False; exception when Ada.IO_Exceptions.Name_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Name_Error")); when Ada.IO_Exceptions.Status_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Status_Error")); when Ada.IO_Exceptions.Mode_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Mode_Error")); when Ada.IO_Exceptions.Use_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Use_Error")); when Ada.IO_Exceptions.Device_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Device_Error")); when Ada.IO_Exceptions.End_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", End_Error")); when Ada.IO_Exceptions.Data_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Data_Error")); when Ada.IO_Exceptions.Layout_Error => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & To_Unbounded_String (", Layout_Error")); when others => Show_Message_Box (Lb_Can_Not_Save_File (Current_Language) & " ; Exception name : " & Exception_Name & " ; " & "Exception message : " & Exception_Message); end; Unref(Save_File_Chooser); Hide(Gtk_Widget(Save_File_Chooser)); end save_xml_file; procedure cancel (Object : access Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); Save_File_Chooser : GObject; begin Save_File_Chooser :=Get_Object(Object, "filechooserdialog1"); Unref(Save_File_Chooser); Hide(Gtk_Widget(Save_File_Chooser)); end cancel; end graphical_editor.save_xmls_callbacks;