~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to src/gtk-about_dialog.adb

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-08-11 09:46:51 UTC
  • mfrom: (6.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20080811094651-9mjd6acwa98ffw5c
Tags: 2.12.0-2ubuntu1
Add lpia to supported architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-----------------------------------------------------------------------
 
2
--              GtkAda - Ada95 binding for Gtk+/Gnome                --
 
3
--                                                                   --
 
4
--                 Copyright (C) 2006-2008, 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
-----------------------------------------------------------------------
 
22
 
 
23
with Gdk.Pixbuf;            use Gdk.Pixbuf;
 
24
with Gtkada.Bindings;       use Gtkada.Bindings;
 
25
with Gtkada.Types;
 
26
with GNAT.Strings;          use GNAT.Strings;
 
27
with Interfaces.C.Strings;  use Interfaces.C, Interfaces.C.Strings;
 
28
 
 
29
with Glib.Type_Conversion_Hooks;
 
30
 
 
31
package body Gtk.About_Dialog is
 
32
 
 
33
   package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
 
34
     (Get_Type'Access, Gtk_About_Dialog_Record);
 
35
   pragma Warnings (Off, Type_Conversion);
 
36
 
 
37
   -----------------
 
38
   -- Get_Artists --
 
39
   -----------------
 
40
 
 
41
   function Get_Artists
 
42
     (About : access Gtk_About_Dialog_Record) return String_List
 
43
   is
 
44
      function Internal
 
45
        (About : System.Address) return chars_ptr_array_access;
 
46
      pragma Import (C, Internal, "gtk_about_dialog_get_artists");
 
47
   begin
 
48
      --  Returned value owned by gtk+, and must not be freed
 
49
      return To_String_List (Internal (Get_Object (About)).all);
 
50
   end Get_Artists;
 
51
 
 
52
   -----------------
 
53
   -- Get_Authors --
 
54
   -----------------
 
55
 
 
56
   function Get_Authors
 
57
     (About : access Gtk_About_Dialog_Record) return String_List
 
58
   is
 
59
      function Internal
 
60
        (About : System.Address) return chars_ptr_array_access;
 
61
      pragma Import (C, Internal, "gtk_about_dialog_get_authors");
 
62
   begin
 
63
      --  Returned value owned by gtk+
 
64
      return To_String_List (Internal (Get_Object (About)).all);
 
65
   end Get_Authors;
 
66
 
 
67
   ------------------
 
68
   -- Get_Comments --
 
69
   ------------------
 
70
 
 
71
   function Get_Comments
 
72
     (About : access Gtk_About_Dialog_Record) return String
 
73
   is
 
74
      function Internal (About : System.Address) return chars_ptr;
 
75
      pragma Import (C, Internal, "gtk_about_dialog_get_comments");
 
76
   begin
 
77
      --  returned value owned by gtk+
 
78
      return Value (Internal (Get_Object (About)));
 
79
   end Get_Comments;
 
80
 
 
81
   -------------------
 
82
   -- Get_Copyright --
 
83
   -------------------
 
84
 
 
85
   function Get_Copyright
 
86
     (About : access Gtk_About_Dialog_Record) return String
 
87
   is
 
88
      function Internal (About : System.Address) return chars_ptr;
 
89
      pragma Import (C, Internal, "gtk_about_dialog_get_copyright");
 
90
   begin
 
91
      --  returned value owned by gtk+
 
92
      return Value (Internal (Get_Object (About)));
 
93
   end Get_Copyright;
 
94
 
 
95
   ---------------------
 
96
   -- Get_Documenters --
 
97
   ---------------------
 
98
 
 
99
   function Get_Documenters
 
100
     (About : access Gtk_About_Dialog_Record) return String_List
 
101
   is
 
102
      function Internal
 
103
        (About : System.Address) return chars_ptr_array_access;
 
104
      pragma Import (C, Internal, "gtk_about_dialog_get_documenters");
 
105
   begin
 
106
      --  Returned value owned by gtk+
 
107
      return To_String_List (Internal (Get_Object (About)).all);
 
108
   end Get_Documenters;
 
109
 
 
110
   -----------------
 
111
   -- Get_License --
 
112
   -----------------
 
113
 
 
114
   function Get_License
 
115
     (About : access Gtk_About_Dialog_Record) return String
 
116
   is
 
117
      function Internal (About : System.Address) return chars_ptr;
 
118
      pragma Import (C, Internal, "gtk_about_dialog_get_license");
 
119
   begin
 
120
      --  Returned value owned by gtk+
 
121
      return Value (Internal (Get_Object (About)));
 
122
   end Get_License;
 
123
 
 
124
   --------------
 
125
   -- Get_Logo --
 
126
   --------------
 
127
 
 
128
   function Get_Logo
 
129
     (About : access Gtk_About_Dialog_Record)
 
130
      return Gdk_Pixbuf
 
131
   is
 
132
      function Internal (About : System.Address) return Gdk_Pixbuf;
 
133
      pragma Import (C, Internal, "gtk_about_dialog_get_logo");
 
134
   begin
 
135
      return Internal (Get_Object (About));
 
136
   end Get_Logo;
 
137
 
 
138
   ------------------------
 
139
   -- Get_Logo_Icon_Name --
 
140
   ------------------------
 
141
 
 
142
   function Get_Logo_Icon_Name
 
143
     (About : access Gtk_About_Dialog_Record) return String
 
144
   is
 
145
      function Internal (About : System.Address) return chars_ptr;
 
146
      pragma Import (C, Internal, "gtk_about_dialog_get_logo_icon_name");
 
147
   begin
 
148
      --  Returned value owned by gtk+
 
149
      return Value (Internal (Get_Object (About)));
 
150
   end Get_Logo_Icon_Name;
 
151
 
 
152
   --------------
 
153
   -- Get_Name --
 
154
   --------------
 
155
 
 
156
   function Get_Name
 
157
     (About : access Gtk_About_Dialog_Record) return String
 
158
   is
 
159
      function Internal (About : System.Address) return chars_ptr;
 
160
      pragma Import (C, Internal, "gtk_about_dialog_get_name");
 
161
   begin
 
162
      --  Returned value owned by gtk+
 
163
      return Value (Internal (Get_Object (About)));
 
164
   end Get_Name;
 
165
 
 
166
   ----------------------------
 
167
   -- Get_Translator_Credits --
 
168
   ----------------------------
 
169
 
 
170
   function Get_Translator_Credits
 
171
     (About : access Gtk_About_Dialog_Record) return String
 
172
   is
 
173
      function Internal (About : System.Address) return chars_ptr;
 
174
      pragma Import (C, Internal, "gtk_about_dialog_get_translator_credits");
 
175
   begin
 
176
      --  Returned value owned by gtk+
 
177
      return Value (Internal (Get_Object (About)));
 
178
   end Get_Translator_Credits;
 
179
 
 
180
   -----------------
 
181
   -- Get_Version --
 
182
   -----------------
 
183
 
 
184
   function Get_Version
 
185
     (About : access Gtk_About_Dialog_Record) return String
 
186
   is
 
187
      function Internal (About : System.Address) return chars_ptr;
 
188
      pragma Import (C, Internal, "gtk_about_dialog_get_version");
 
189
   begin
 
190
      --  Returned value owned by gtk+
 
191
      return Value (Internal (Get_Object (About)));
 
192
   end Get_Version;
 
193
 
 
194
   -----------------
 
195
   -- Get_Website --
 
196
   -----------------
 
197
 
 
198
   function Get_Website
 
199
     (About : access Gtk_About_Dialog_Record) return String
 
200
   is
 
201
      function Internal (About : System.Address) return chars_ptr;
 
202
      pragma Import (C, Internal, "gtk_about_dialog_get_website");
 
203
   begin
 
204
      --  Returned value owned by gtk+
 
205
      return Value (Internal (Get_Object (About)));
 
206
   end Get_Website;
 
207
 
 
208
   -----------------------
 
209
   -- Get_Website_Label --
 
210
   -----------------------
 
211
 
 
212
   function Get_Website_Label
 
213
     (About : access Gtk_About_Dialog_Record) return String
 
214
   is
 
215
      function Internal (About : System.Address) return chars_ptr;
 
216
      pragma Import (C, Internal, "gtk_about_dialog_get_website_label");
 
217
   begin
 
218
      --  Returned value owned by gtk+
 
219
      return Value (Internal (Get_Object (About)));
 
220
   end Get_Website_Label;
 
221
 
 
222
   ----------------------
 
223
   -- Get_Wrap_License --
 
224
   ----------------------
 
225
 
 
226
   function Get_Wrap_License
 
227
     (About : access Gtk_About_Dialog_Record)
 
228
      return Boolean
 
229
   is
 
230
      function Internal
 
231
        (About : System.Address)
 
232
         return Gboolean;
 
233
      pragma Import (C, Internal, "gtk_about_dialog_get_wrap_license");
 
234
   begin
 
235
      return Boolean'Val (Internal (Get_Object (About)));
 
236
   end Get_Wrap_License;
 
237
 
 
238
   -------------
 
239
   -- Gtk_New --
 
240
   -------------
 
241
 
 
242
   procedure Gtk_New (About : out Gtk_About_Dialog) is
 
243
   begin
 
244
      About := new Gtk_About_Dialog_Record;
 
245
      Gtk.About_Dialog.Initialize (About);
 
246
   end Gtk_New;
 
247
 
 
248
   ----------------
 
249
   -- Initialize --
 
250
   ----------------
 
251
 
 
252
   procedure Initialize
 
253
     (About : access Gtk_About_Dialog_Record'Class)
 
254
   is
 
255
      function Internal return System.Address;
 
256
      pragma Import (C, Internal, "gtk_about_dialog_new");
 
257
   begin
 
258
      Set_Object (About, Internal);
 
259
   end Initialize;
 
260
 
 
261
   -----------------
 
262
   -- Set_Artists --
 
263
   -----------------
 
264
 
 
265
   procedure Set_Artists
 
266
     (About   : access Gtk_About_Dialog_Record;
 
267
      Artists : String_List)
 
268
   is
 
269
      procedure Internal (About : System.Address; Artists : System.Address);
 
270
      pragma Import (C, Internal, "gtk_about_dialog_set_artists");
 
271
      Val : aliased chars_ptr_array := From_String_List (Artists);
 
272
   begin
 
273
      Internal (Get_Object (About), Val (Val'First)'Address);
 
274
      Gtkada.Types.Free (Val);
 
275
   end Set_Artists;
 
276
 
 
277
   -----------------
 
278
   -- Set_Authors --
 
279
   -----------------
 
280
 
 
281
   procedure Set_Authors
 
282
     (About   : access Gtk_About_Dialog_Record;
 
283
      Authors : String_List)
 
284
   is
 
285
      procedure Internal (About : System.Address; Authors : System.Address);
 
286
      pragma Import (C, Internal, "gtk_about_dialog_set_authors");
 
287
      Val : aliased chars_ptr_array := From_String_List (Authors);
 
288
   begin
 
289
      Internal (Get_Object (About), Val (Val'First)'Address);
 
290
      Gtkada.Types.Free (Val);
 
291
   end Set_Authors;
 
292
 
 
293
   ------------------
 
294
   -- Set_Comments --
 
295
   ------------------
 
296
 
 
297
   procedure Set_Comments
 
298
     (About    : access Gtk_About_Dialog_Record;
 
299
      Comments : String)
 
300
   is
 
301
      procedure Internal
 
302
        (About    : System.Address;
 
303
         Comments : String);
 
304
      pragma Import (C, Internal, "gtk_about_dialog_set_comments");
 
305
   begin
 
306
      Internal (Get_Object (About), Comments & ASCII.NUL);
 
307
   end Set_Comments;
 
308
 
 
309
   -------------------
 
310
   -- Set_Copyright --
 
311
   -------------------
 
312
 
 
313
   procedure Set_Copyright
 
314
     (About     : access Gtk_About_Dialog_Record;
 
315
      Copyright : String)
 
316
   is
 
317
      procedure Internal
 
318
        (About     : System.Address;
 
319
         Copyright : String);
 
320
      pragma Import (C, Internal, "gtk_about_dialog_set_copyright");
 
321
   begin
 
322
      Internal (Get_Object (About), Copyright & ASCII.NUL);
 
323
   end Set_Copyright;
 
324
 
 
325
   ---------------------
 
326
   -- Set_Documenters --
 
327
   ---------------------
 
328
 
 
329
   procedure Set_Documenters
 
330
     (About : access Gtk_About_Dialog_Record;
 
331
      Documenters : String_List)
 
332
   is
 
333
      procedure Internal (About, Documenters : System.Address);
 
334
      pragma Import (C, Internal, "gtk_about_dialog_set_documenters");
 
335
      Val : aliased chars_ptr_array := From_String_List (Documenters);
 
336
   begin
 
337
      Internal (Get_Object (About), Val (Val'First)'Address);
 
338
      Gtkada.Types.Free (Val);
 
339
   end Set_Documenters;
 
340
 
 
341
   -----------------
 
342
   -- Set_License --
 
343
   -----------------
 
344
 
 
345
   procedure Set_License
 
346
     (About   : access Gtk_About_Dialog_Record;
 
347
      License : String)
 
348
   is
 
349
      procedure Internal
 
350
        (About   : System.Address;
 
351
         License : String);
 
352
      pragma Import (C, Internal, "gtk_about_dialog_set_license");
 
353
   begin
 
354
      Internal (Get_Object (About), License & ASCII.NUL);
 
355
   end Set_License;
 
356
 
 
357
   --------------
 
358
   -- Set_Logo --
 
359
   --------------
 
360
 
 
361
   procedure Set_Logo
 
362
     (About : access Gtk_About_Dialog_Record;
 
363
      Logo  : Gdk_Pixbuf)
 
364
   is
 
365
      procedure Internal
 
366
        (About : System.Address;
 
367
         Logo  : Gdk_Pixbuf);
 
368
      pragma Import (C, Internal, "gtk_about_dialog_set_logo");
 
369
   begin
 
370
      Internal (Get_Object (About), Logo);
 
371
   end Set_Logo;
 
372
 
 
373
   ------------------------
 
374
   -- Set_Logo_Icon_Name --
 
375
   ------------------------
 
376
 
 
377
   procedure Set_Logo_Icon_Name
 
378
     (About     : access Gtk_About_Dialog_Record;
 
379
      Icon_Name : String := "")
 
380
   is
 
381
      procedure Internal (About : System.Address; Icon_Name : chars_ptr);
 
382
      pragma Import (C, Internal, "gtk_about_dialog_set_logo_icon_name");
 
383
      Str : chars_ptr := String_Or_Null (Icon_Name);
 
384
   begin
 
385
      Internal (Get_Object (About), Str);
 
386
      Free (Str);
 
387
   end Set_Logo_Icon_Name;
 
388
 
 
389
   --------------
 
390
   -- Set_Name --
 
391
   --------------
 
392
 
 
393
   procedure Set_Name
 
394
     (About : access Gtk_About_Dialog_Record;
 
395
      Name  : String)
 
396
   is
 
397
      procedure Internal
 
398
        (About : System.Address;
 
399
         Name  : String);
 
400
      pragma Import (C, Internal, "gtk_about_dialog_set_name");
 
401
   begin
 
402
      Internal (Get_Object (About), Name & ASCII.NUL);
 
403
   end Set_Name;
 
404
 
 
405
   ----------------------------
 
406
   -- Set_Translator_Credits --
 
407
   ----------------------------
 
408
 
 
409
   procedure Set_Translator_Credits
 
410
     (About              : access Gtk_About_Dialog_Record;
 
411
      Translator_Credits : String)
 
412
   is
 
413
      procedure Internal
 
414
        (About              : System.Address;
 
415
         Translator_Credits : String);
 
416
      pragma Import (C, Internal, "gtk_about_dialog_set_translator_credits");
 
417
   begin
 
418
      Internal (Get_Object (About), Translator_Credits & ASCII.NUL);
 
419
   end Set_Translator_Credits;
 
420
 
 
421
   -----------------
 
422
   -- Set_Version --
 
423
   -----------------
 
424
 
 
425
   procedure Set_Version
 
426
     (About   : access Gtk_About_Dialog_Record;
 
427
      Version : String)
 
428
   is
 
429
      procedure Internal
 
430
        (About   : System.Address;
 
431
         Version : String);
 
432
      pragma Import (C, Internal, "gtk_about_dialog_set_version");
 
433
   begin
 
434
      Internal (Get_Object (About), Version & ASCII.NUL);
 
435
   end Set_Version;
 
436
 
 
437
   -----------------
 
438
   -- Set_Website --
 
439
   -----------------
 
440
 
 
441
   procedure Set_Website
 
442
     (About   : access Gtk_About_Dialog_Record;
 
443
      Website : String)
 
444
   is
 
445
      procedure Internal
 
446
        (About   : System.Address;
 
447
         Website : String);
 
448
      pragma Import (C, Internal, "gtk_about_dialog_set_website");
 
449
   begin
 
450
      Internal (Get_Object (About), Website & ASCII.NUL);
 
451
   end Set_Website;
 
452
 
 
453
   -----------------------
 
454
   -- Set_Website_Label --
 
455
   -----------------------
 
456
 
 
457
   procedure Set_Website_Label
 
458
     (About         : access Gtk_About_Dialog_Record;
 
459
      Website_Label : String)
 
460
   is
 
461
      procedure Internal
 
462
        (About         : System.Address;
 
463
         Website_Label : String);
 
464
      pragma Import (C, Internal, "gtk_about_dialog_set_website_label");
 
465
   begin
 
466
      Internal (Get_Object (About), Website_Label & ASCII.NUL);
 
467
   end Set_Website_Label;
 
468
 
 
469
   ----------------------
 
470
   -- Set_Wrap_License --
 
471
   ----------------------
 
472
 
 
473
   procedure Set_Wrap_License
 
474
     (About        : access Gtk_About_Dialog_Record;
 
475
      Wrap_License : Boolean)
 
476
   is
 
477
      procedure Internal
 
478
        (About        : System.Address;
 
479
         Wrap_License : Gboolean);
 
480
      pragma Import (C, Internal, "gtk_about_dialog_set_wrap_license");
 
481
   begin
 
482
      Internal (Get_Object (About), Boolean'Pos (Wrap_License));
 
483
   end Set_Wrap_License;
 
484
 
 
485
end Gtk.About_Dialog;