1-----------------------------------------------------------------------
2--              GtkAda - Ada95 binding for Gtk+/Gnome                --
3--                                                                   --
4--                  Copyright (C) 2001-2013, AdaCore                 --
5--                                                                   --
6-- This library is free software; you can redistribute it and/or     --
7-- modify it under the terms of the GNU General Public               --
8-- License as published by the Free Software Foundation; either      --
9-- version 2 of the License, or (at your option) any later version.  --
10--                                                                   --
11-- This library is distributed in the hope that it will be useful,   --
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
14-- General Public License for more details.                          --
15--                                                                   --
16-- You should have received a copy of the GNU General Public         --
17-- License along with this library; if not, write to the             --
18-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
19-- Boston, MA 02111-1307, USA.                                       --
20--                                                                   --
21-- As a special exception, if other files instantiate generics from  --
22-- this unit, or you link this unit with other files to produce an   --
23-- executable, this  unit  does not  by itself cause  the resulting  --
24-- executable to be covered by the GNU General Public License. This  --
25-- exception does not however invalidate any other reasons why the   --
26-- executable file  might be covered by the  GNU Public License.     --
27-----------------------------------------------------------------------
28
29with Glib; use Glib;
30with Gnome.Dialog;
31with Glib.Object;
32with Gtkada.Types; use Gtkada.Types;
33with Gtk;
34
35package Gnome.Client is
36
37   type Gnome_Client_Record is new Glib.Object.GObject_Record with private;
38   type Gnome_Client is access all Gnome_Client_Record'Class;
39
40   type Gnome_Interact_Style is (
41      Interact_None,
42      Interact_Errors,
43      Interact_Any);
44
45   type Gnome_Dialog_Type is (
46      Dialog_Error,
47      Dialog_Normal);
48
49   type Gnome_Save_Style is (
50      Save_Global,
51      Save_Local,
52      Save_Both);
53
54   type Gnome_Restart_Style is (
55      Restart_If_Running,
56      Restart_Anyway,
57      Restart_Immediately,
58      Restart_Never);
59
60   type Gnome_Client_State is (
61      Idle,
62      Saving_Phase_1,
63      Waiting_For_Phase_2,
64      Saving_Phase_2,
65      Frozen,
66      Disconnected,
67      Registering);
68
69   type Gnome_Client_Flags is mod 2 ** 32;
70   Is_Connected : constant Gnome_Client_Flags := 2 ** 0;
71   Restarted : constant Gnome_Client_Flags := 2 ** 1;
72   Restored : constant Gnome_Client_Flags := 2 ** 2;
73
74   procedure Gnome_New
75     (Widget          : out Gnome_Client;
76      With_Connection : Boolean := True);
77
78   procedure Initialize
79     (Widget          : access Gnome_Client_Record'Class;
80      With_Connection : Boolean);
81   --  Internal initialization function.
82   --  See the section "Creating your own widgets" in the documentation.
83
84   function Get_Type return Gtk.Gtk_Type;
85   --  Return the internal value associated with this widget.
86
87   --  gnome_client_add_static_arg not bound: variable number of arguments
88
89   procedure Connect (Client : access Gnome_Client_Record);
90
91   procedure Disable_Master_Connection;
92
93   procedure Disconnect (Client : access Gnome_Client_Record);
94
95   procedure Flush (Client : access Gnome_Client_Record);
96
97   function Get_Config_Prefix (Client : access Gnome_Client_Record)
98                               return String;
99
100   function Get_Flags (Client : access Gnome_Client_Record)
101                       return Gnome_Client_Flags;
102
103   function Get_Global_Config_Prefix (Client : access Gnome_Client_Record)
104                                      return String;
105
106   function Get_Id (Client : access Gnome_Client_Record)
107                    return String;
108
109   function Get_Previous_Id (Client : access Gnome_Client_Record)
110                             return String;
111
112   procedure Interaction_Key_Return
113     (Key             : Gint;
114      Cancel_Shutdown : Boolean);
115
116   function Master_Client return Gnome_Client;
117
118   type Gnome_Interact_Function is access procedure
119     (Client      : access Gnome_Client_Record'Class;
120      Key         : Gint;
121      Dialog_Type : Gnome_Dialog_Type);
122
123   --  procedure Request_Interaction
124   --    (Client      : access Gnome_Client_Record;
125   --     Dialog      : Gnome_Dialog_Type;
126   --     Func        : Gnome_Interact_Function;
127   --     Client_Data : System.Address);
128
129   procedure Request_Phase_2 (Client : access Gnome_Client_Record);
130
131   procedure Request_Save
132     (Client         : access Gnome_Client_Record;
133      Save_Style     : Gnome_Save_Style;
134      Shutdown       : Boolean;
135      Interact_Style : Gnome_Interact_Style;
136      Fast           : Boolean;
137      Global         : Boolean);
138
139   procedure Save_Any_Dialog
140     (Client : access Gnome_Client_Record;
141      Dialog : access Gnome.Dialog.Gnome_Dialog_Record'Class);
142
143   procedure Save_Error_Dialog
144     (Client : access Gnome_Client_Record;
145      Dialog : access Gnome.Dialog.Gnome_Dialog_Record'Class);
146
147   procedure Set_Clone_Command
148     (Client : access Gnome_Client_Record;
149      Argc   : Gint;
150      Argv   : Chars_Ptr_Array);
151
152   procedure Set_Current_Directory
153     (Client : access Gnome_Client_Record;
154      Dir    : String);
155
156   procedure Set_Discard_Command
157     (Client : access Gnome_Client_Record;
158      Argc   : Gint;
159      Argv   : Chars_Ptr_Array);
160
161   procedure Set_Environment
162     (Client : access Gnome_Client_Record;
163      Name   : String;
164      Value  : String);
165
166   procedure Set_Global_Config_Prefix
167     (Client : access Gnome_Client_Record;
168      Prefix : String);
169
170   procedure Set_Id
171     (Client    : access Gnome_Client_Record;
172      Client_Id : String);
173
174   procedure Set_Priority
175     (Client   : access Gnome_Client_Record;
176      Priority : Guint);
177
178   procedure Set_Process_Id
179     (Client : access Gnome_Client_Record;
180      Pid    : Gint);
181
182   procedure Set_Program
183     (Client  : access Gnome_Client_Record;
184      Program : String);
185
186   procedure Set_Resign_Command
187     (Client : access Gnome_Client_Record;
188      Argc   : Gint;
189      Argv   : Chars_Ptr_Array);
190
191   procedure Set_Restart_Command
192     (Client : access Gnome_Client_Record;
193      Argc   : Gint;
194      Argv   : Chars_Ptr_Array);
195
196   procedure Set_Restart_Style
197     (Client : access Gnome_Client_Record;
198      Style  : Gnome_Restart_Style);
199
200   procedure Set_Shutdown_Command
201     (Client : access Gnome_Client_Record;
202      Argc   : Gint;
203      Argv   : Chars_Ptr_Array);
204
205   procedure Set_User_Id
206     (Client  : access Gnome_Client_Record;
207      User_Id : String);
208
209   -------------
210   -- Signals --
211   -------------
212
213   --  <signals>
214   --  The following new signals are defined for this widget:
215   --
216   --  - "save_yourself"
217   --    function Handler (Widget : access Gnome_Client_Record'Class;
218   --       Phase : Gint;
219   --       Save_Style : Gnome_Save_Style;
220   --       Shutdown : Gint;
221   --       Interact_Style : Gnome_Interact_Style;
222   --       Fast : Gint)
223   --       return Gboolean;
224   --
225   --  - "die"
226   --    procedure Handler (Widget : access Gnome_Client_Record'Class);
227   --
228   --  - "save_complete"
229   --    procedure Handler (Widget : access Gnome_Client_Record'Class);
230   --
231   --  - "shutdown_cancelled"
232   --    procedure Handler (Widget : access Gnome_Client_Record'Class);
233   --
234   --  - "connect"
235   --    procedure Handler (Widget : access Gnome_Client_Record'Class;
236   --       Restarted : Gint);
237   --
238   --  - "disconnect"
239   --    procedure Handler (Widget : access Gnome_Client_Record'Class);
240   --
241   --  </signals>
242
243private
244   type Gnome_Client_Record is new
245     Glib.Object.GObject_Record with null record;
246
247   pragma Import (C, Get_Type, "gnome_client_get_type");
248end Gnome.Client;
249