1------------------------------------------------------------------------------
2--                                                                          --
3--      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       --
4--                     Copyright (C) 2000-2015, AdaCore                     --
5--                                                                          --
6-- This library is free software;  you can redistribute it and/or modify it --
7-- under terms of the  GNU General Public License  as published by the Free --
8-- Software  Foundation;  either version 3,  or (at your  option) any later --
9-- version. This library is distributed in the hope that it will be useful, --
10-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
12--                                                                          --
13-- As a special exception under Section 7 of GPL version 3, you are granted --
14-- additional permissions described in the GCC Runtime Library Exception,   --
15-- version 3.1, as published by the Free Software Foundation.               --
16--                                                                          --
17-- You should have received a copy of the GNU General Public License and    --
18-- a copy of the GCC Runtime Library Exception along with this program;     --
19-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
20-- <http://www.gnu.org/licenses/>.                                          --
21--                                                                          --
22------------------------------------------------------------------------------
23
24pragma Style_Checks (Off);
25pragma Warnings (Off, "*is already use-visible*");
26with Ada.Unchecked_Conversion;
27with Glib.Object;
28with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks;
29with Gtkada.Bindings;            use Gtkada.Bindings;
30pragma Warnings(Off);  --  might be unused
31with Interfaces.C.Strings;       use Interfaces.C.Strings;
32pragma Warnings(On);
33
34package body Gtk.Recent_Chooser_Menu is
35
36   procedure C_Gtk_Recent_Chooser_Set_Sort_Func
37      (Chooser      : System.Address;
38       Sort_Func    : System.Address;
39       Sort_Data    : System.Address;
40       Data_Destroy : Glib.G_Destroy_Notify_Address);
41   pragma Import (C, C_Gtk_Recent_Chooser_Set_Sort_Func, "gtk_recent_chooser_set_sort_func");
42   --  Sets the comparison function used when sorting to be Sort_Func. If the
43   --  Chooser has the sort type set to GTK_RECENT_SORT_CUSTOM then the chooser
44   --  will sort using this function.
45   --  To the comparison function will be passed two
46   --  Gtk.Recent_Info.Gtk_Recent_Info structs and Sort_Data; Sort_Func should
47   --  return a positive integer if the first item comes before the second,
48   --  zero if the two items are equal and a negative integer if the first item
49   --  comes after the second.
50   --  Since: gtk+ 2.10
51   --  "sort_func": the comparison function
52   --  "sort_data": user data to pass to Sort_Func, or null
53   --  "data_destroy": destroy notifier for Sort_Data, or null
54
55   function To_Gtk_Recent_Sort_Func is new Ada.Unchecked_Conversion
56     (System.Address, Gtk_Recent_Sort_Func);
57
58   function To_Address is new Ada.Unchecked_Conversion
59     (Gtk_Recent_Sort_Func, System.Address);
60
61   function Internal_Gtk_Recent_Sort_Func
62      (A         : System.Address;
63       B         : System.Address;
64       User_Data : System.Address) return Gint;
65   pragma Convention (C, Internal_Gtk_Recent_Sort_Func);
66
67   -----------------------------------
68   -- Internal_Gtk_Recent_Sort_Func --
69   -----------------------------------
70
71   function Internal_Gtk_Recent_Sort_Func
72      (A         : System.Address;
73       B         : System.Address;
74       User_Data : System.Address) return Gint
75   is
76      Func : constant Gtk_Recent_Sort_Func := To_Gtk_Recent_Sort_Func (User_Data);
77   begin
78      return Func (From_Object (A), From_Object (B));
79   end Internal_Gtk_Recent_Sort_Func;
80
81   package Type_Conversion_Gtk_Recent_Chooser_Menu is new Glib.Type_Conversion_Hooks.Hook_Registrator
82     (Get_Type'Access, Gtk_Recent_Chooser_Menu_Record);
83   pragma Unreferenced (Type_Conversion_Gtk_Recent_Chooser_Menu);
84
85   -------------
86   -- Gtk_New --
87   -------------
88
89   procedure Gtk_New (Self : out Gtk_Recent_Chooser_Menu) is
90   begin
91      Self := new Gtk_Recent_Chooser_Menu_Record;
92      Gtk.Recent_Chooser_Menu.Initialize (Self);
93   end Gtk_New;
94
95   -------------------------
96   -- Gtk_New_For_Manager --
97   -------------------------
98
99   procedure Gtk_New_For_Manager
100      (Self    : out Gtk_Recent_Chooser_Menu;
101       Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class)
102   is
103   begin
104      Self := new Gtk_Recent_Chooser_Menu_Record;
105      Gtk.Recent_Chooser_Menu.Initialize_For_Manager (Self, Manager);
106   end Gtk_New_For_Manager;
107
108   ---------------------------------
109   -- Gtk_Recent_Chooser_Menu_New --
110   ---------------------------------
111
112   function Gtk_Recent_Chooser_Menu_New return Gtk_Recent_Chooser_Menu is
113      Self : constant Gtk_Recent_Chooser_Menu := new Gtk_Recent_Chooser_Menu_Record;
114   begin
115      Gtk.Recent_Chooser_Menu.Initialize (Self);
116      return Self;
117   end Gtk_Recent_Chooser_Menu_New;
118
119   ---------------------------------------------
120   -- Gtk_Recent_Chooser_Menu_New_For_Manager --
121   ---------------------------------------------
122
123   function Gtk_Recent_Chooser_Menu_New_For_Manager
124      (Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class)
125       return Gtk_Recent_Chooser_Menu
126   is
127      Self : constant Gtk_Recent_Chooser_Menu := new Gtk_Recent_Chooser_Menu_Record;
128   begin
129      Gtk.Recent_Chooser_Menu.Initialize_For_Manager (Self, Manager);
130      return Self;
131   end Gtk_Recent_Chooser_Menu_New_For_Manager;
132
133   ----------------
134   -- Initialize --
135   ----------------
136
137   procedure Initialize
138      (Self : not null access Gtk_Recent_Chooser_Menu_Record'Class)
139   is
140      function Internal return System.Address;
141      pragma Import (C, Internal, "gtk_recent_chooser_menu_new");
142   begin
143      if not Self.Is_Created then
144         Set_Object (Self, Internal);
145      end if;
146   end Initialize;
147
148   ----------------------------
149   -- Initialize_For_Manager --
150   ----------------------------
151
152   procedure Initialize_For_Manager
153      (Self    : not null access Gtk_Recent_Chooser_Menu_Record'Class;
154       Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class)
155   is
156      function Internal (Manager : System.Address) return System.Address;
157      pragma Import (C, Internal, "gtk_recent_chooser_menu_new_for_manager");
158   begin
159      if not Self.Is_Created then
160         Set_Object (Self, Internal (Get_Object (Manager)));
161      end if;
162   end Initialize_For_Manager;
163
164   ----------------------
165   -- Get_Show_Numbers --
166   ----------------------
167
168   function Get_Show_Numbers
169      (Self : not null access Gtk_Recent_Chooser_Menu_Record) return Boolean
170   is
171      function Internal (Self : System.Address) return Glib.Gboolean;
172      pragma Import (C, Internal, "gtk_recent_chooser_menu_get_show_numbers");
173   begin
174      return Internal (Get_Object (Self)) /= 0;
175   end Get_Show_Numbers;
176
177   ----------------------
178   -- Set_Show_Numbers --
179   ----------------------
180
181   procedure Set_Show_Numbers
182      (Self         : not null access Gtk_Recent_Chooser_Menu_Record;
183       Show_Numbers : Boolean)
184   is
185      procedure Internal
186         (Self         : System.Address;
187          Show_Numbers : Glib.Gboolean);
188      pragma Import (C, Internal, "gtk_recent_chooser_menu_set_show_numbers");
189   begin
190      Internal (Get_Object (Self), Boolean'Pos (Show_Numbers));
191   end Set_Show_Numbers;
192
193   -------------------
194   -- Set_Sort_Func --
195   -------------------
196
197   procedure Set_Sort_Func
198      (Chooser      : not null access Gtk_Recent_Chooser_Menu_Record;
199       Sort_Func    : Gtk_Recent_Sort_Func;
200       Data_Destroy : Glib.G_Destroy_Notify_Address)
201   is
202   begin
203      if Sort_Func = null then
204         C_Gtk_Recent_Chooser_Set_Sort_Func (Get_Object (Chooser), System.Null_Address, System.Null_Address, Data_Destroy);
205      else
206         C_Gtk_Recent_Chooser_Set_Sort_Func (Get_Object (Chooser), Internal_Gtk_Recent_Sort_Func'Address, To_Address (Sort_Func), Data_Destroy);
207      end if;
208   end Set_Sort_Func;
209
210   package body Set_Sort_Func_User_Data is
211
212      package Users is new Glib.Object.User_Data_Closure
213        (User_Data_Type, Destroy);
214
215      function To_Gtk_Recent_Sort_Func is new Ada.Unchecked_Conversion
216        (System.Address, Gtk_Recent_Sort_Func);
217
218      function To_Address is new Ada.Unchecked_Conversion
219        (Gtk_Recent_Sort_Func, System.Address);
220
221      function Internal_Cb
222         (A         : System.Address;
223          B         : System.Address;
224          User_Data : System.Address) return Gint;
225      pragma Convention (C, Internal_Cb);
226
227      -----------------
228      -- Internal_Cb --
229      -----------------
230
231      function Internal_Cb
232         (A         : System.Address;
233          B         : System.Address;
234          User_Data : System.Address) return Gint
235      is
236         D : constant Users.Internal_Data_Access := Users.Convert (User_Data);
237      begin
238         return To_Gtk_Recent_Sort_Func (D.Func) (From_Object (A), From_Object (B), D.Data.all);
239      end Internal_Cb;
240
241      -------------------
242      -- Set_Sort_Func --
243      -------------------
244
245      procedure Set_Sort_Func
246         (Chooser      : not null access Gtk.Recent_Chooser_Menu.Gtk_Recent_Chooser_Menu_Record'Class;
247          Sort_Func    : Gtk_Recent_Sort_Func;
248          Sort_Data    : User_Data_Type;
249          Data_Destroy : Glib.G_Destroy_Notify_Address)
250      is
251      begin
252         if Sort_Func = null then
253            C_Gtk_Recent_Chooser_Set_Sort_Func (Get_Object (Chooser), System.Null_Address, System.Null_Address, Data_Destroy);
254         else
255            C_Gtk_Recent_Chooser_Set_Sort_Func (Get_Object (Chooser), Internal_Cb'Address, Users.Build (To_Address (Sort_Func), Sort_Data), Data_Destroy);
256         end if;
257      end Set_Sort_Func;
258
259   end Set_Sort_Func_User_Data;
260
261   ----------------
262   -- Add_Filter --
263   ----------------
264
265   procedure Add_Filter
266      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
267       Filter  : not null access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class)
268   is
269      procedure Internal (Chooser : System.Address; Filter : System.Address);
270      pragma Import (C, Internal, "gtk_recent_chooser_add_filter");
271   begin
272      Internal (Get_Object (Chooser), Get_Object (Filter));
273   end Add_Filter;
274
275   ---------------------------
276   -- Do_Set_Related_Action --
277   ---------------------------
278
279   procedure Do_Set_Related_Action
280      (Self   : not null access Gtk_Recent_Chooser_Menu_Record;
281       Action : not null access Gtk.Action.Gtk_Action_Record'Class)
282   is
283      procedure Internal (Self : System.Address; Action : System.Address);
284      pragma Import (C, Internal, "gtk_activatable_do_set_related_action");
285   begin
286      Internal (Get_Object (Self), Get_Object (Action));
287   end Do_Set_Related_Action;
288
289   ----------------------
290   -- Get_Current_Item --
291   ----------------------
292
293   function Get_Current_Item
294      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
295       return Gtk.Recent_Info.Gtk_Recent_Info
296   is
297      function Internal (Chooser : System.Address) return System.Address;
298      pragma Import (C, Internal, "gtk_recent_chooser_get_current_item");
299   begin
300      return From_Object (Internal (Get_Object (Chooser)));
301   end Get_Current_Item;
302
303   ---------------------
304   -- Get_Current_Uri --
305   ---------------------
306
307   function Get_Current_Uri
308      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
309       return UTF8_String
310   is
311      function Internal
312         (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr;
313      pragma Import (C, Internal, "gtk_recent_chooser_get_current_uri");
314   begin
315      return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser)));
316   end Get_Current_Uri;
317
318   ----------------
319   -- Get_Filter --
320   ----------------
321
322   function Get_Filter
323      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
324       return Gtk.Recent_Filter.Gtk_Recent_Filter
325   is
326      function Internal (Chooser : System.Address) return System.Address;
327      pragma Import (C, Internal, "gtk_recent_chooser_get_filter");
328      Stub_Gtk_Recent_Filter : Gtk.Recent_Filter.Gtk_Recent_Filter_Record;
329   begin
330      return Gtk.Recent_Filter.Gtk_Recent_Filter (Get_User_Data (Internal (Get_Object (Chooser)), Stub_Gtk_Recent_Filter));
331   end Get_Filter;
332
333   ---------------
334   -- Get_Items --
335   ---------------
336
337   function Get_Items
338      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
339       return Gtk.Recent_Manager.Gtk_Recent_Info_List.Glist
340   is
341      function Internal (Chooser : System.Address) return System.Address;
342      pragma Import (C, Internal, "gtk_recent_chooser_get_items");
343      Tmp_Return : Gtk.Recent_Manager.Gtk_Recent_Info_List.Glist;
344   begin
345      Gtk.Recent_Manager.Gtk_Recent_Info_List.Set_Object (Tmp_Return, Internal (Get_Object (Chooser)));
346      return Tmp_Return;
347   end Get_Items;
348
349   ---------------
350   -- Get_Limit --
351   ---------------
352
353   function Get_Limit
354      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record) return Gint
355   is
356      function Internal (Chooser : System.Address) return Gint;
357      pragma Import (C, Internal, "gtk_recent_chooser_get_limit");
358   begin
359      return Internal (Get_Object (Chooser));
360   end Get_Limit;
361
362   --------------------
363   -- Get_Local_Only --
364   --------------------
365
366   function Get_Local_Only
367      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
368       return Boolean
369   is
370      function Internal (Chooser : System.Address) return Glib.Gboolean;
371      pragma Import (C, Internal, "gtk_recent_chooser_get_local_only");
372   begin
373      return Internal (Get_Object (Chooser)) /= 0;
374   end Get_Local_Only;
375
376   ------------------------
377   -- Get_Related_Action --
378   ------------------------
379
380   function Get_Related_Action
381      (Self : not null access Gtk_Recent_Chooser_Menu_Record)
382       return Gtk.Action.Gtk_Action
383   is
384      function Internal (Self : System.Address) return System.Address;
385      pragma Import (C, Internal, "gtk_activatable_get_related_action");
386      Stub_Gtk_Action : Gtk.Action.Gtk_Action_Record;
387   begin
388      return Gtk.Action.Gtk_Action (Get_User_Data (Internal (Get_Object (Self)), Stub_Gtk_Action));
389   end Get_Related_Action;
390
391   -------------------------
392   -- Get_Select_Multiple --
393   -------------------------
394
395   function Get_Select_Multiple
396      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
397       return Boolean
398   is
399      function Internal (Chooser : System.Address) return Glib.Gboolean;
400      pragma Import (C, Internal, "gtk_recent_chooser_get_select_multiple");
401   begin
402      return Internal (Get_Object (Chooser)) /= 0;
403   end Get_Select_Multiple;
404
405   --------------------
406   -- Get_Show_Icons --
407   --------------------
408
409   function Get_Show_Icons
410      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
411       return Boolean
412   is
413      function Internal (Chooser : System.Address) return Glib.Gboolean;
414      pragma Import (C, Internal, "gtk_recent_chooser_get_show_icons");
415   begin
416      return Internal (Get_Object (Chooser)) /= 0;
417   end Get_Show_Icons;
418
419   ------------------------
420   -- Get_Show_Not_Found --
421   ------------------------
422
423   function Get_Show_Not_Found
424      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
425       return Boolean
426   is
427      function Internal (Chooser : System.Address) return Glib.Gboolean;
428      pragma Import (C, Internal, "gtk_recent_chooser_get_show_not_found");
429   begin
430      return Internal (Get_Object (Chooser)) /= 0;
431   end Get_Show_Not_Found;
432
433   ----------------------
434   -- Get_Show_Private --
435   ----------------------
436
437   function Get_Show_Private
438      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
439       return Boolean
440   is
441      function Internal (Chooser : System.Address) return Glib.Gboolean;
442      pragma Import (C, Internal, "gtk_recent_chooser_get_show_private");
443   begin
444      return Internal (Get_Object (Chooser)) /= 0;
445   end Get_Show_Private;
446
447   -------------------
448   -- Get_Show_Tips --
449   -------------------
450
451   function Get_Show_Tips
452      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
453       return Boolean
454   is
455      function Internal (Chooser : System.Address) return Glib.Gboolean;
456      pragma Import (C, Internal, "gtk_recent_chooser_get_show_tips");
457   begin
458      return Internal (Get_Object (Chooser)) /= 0;
459   end Get_Show_Tips;
460
461   -------------------
462   -- Get_Sort_Type --
463   -------------------
464
465   function Get_Sort_Type
466      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
467       return Gtk.Recent_Chooser.Gtk_Recent_Sort_Type
468   is
469      function Internal
470         (Chooser : System.Address)
471          return Gtk.Recent_Chooser.Gtk_Recent_Sort_Type;
472      pragma Import (C, Internal, "gtk_recent_chooser_get_sort_type");
473   begin
474      return Internal (Get_Object (Chooser));
475   end Get_Sort_Type;
476
477   -------------------------------
478   -- Get_Use_Action_Appearance --
479   -------------------------------
480
481   function Get_Use_Action_Appearance
482      (Self : not null access Gtk_Recent_Chooser_Menu_Record) return Boolean
483   is
484      function Internal (Self : System.Address) return Glib.Gboolean;
485      pragma Import (C, Internal, "gtk_activatable_get_use_action_appearance");
486   begin
487      return Internal (Get_Object (Self)) /= 0;
488   end Get_Use_Action_Appearance;
489
490   ------------------
491   -- List_Filters --
492   ------------------
493
494   function List_Filters
495      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
496       return Gtk.Recent_Filter.Gtk_Recent_Filter_List.GSlist
497   is
498      function Internal (Chooser : System.Address) return System.Address;
499      pragma Import (C, Internal, "gtk_recent_chooser_list_filters");
500      Tmp_Return : Gtk.Recent_Filter.Gtk_Recent_Filter_List.GSlist;
501   begin
502      Gtk.Recent_Filter.Gtk_Recent_Filter_List.Set_Object (Tmp_Return, Internal (Get_Object (Chooser)));
503      return Tmp_Return;
504   end List_Filters;
505
506   -------------------
507   -- Remove_Filter --
508   -------------------
509
510   procedure Remove_Filter
511      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
512       Filter  : not null access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class)
513   is
514      procedure Internal (Chooser : System.Address; Filter : System.Address);
515      pragma Import (C, Internal, "gtk_recent_chooser_remove_filter");
516   begin
517      Internal (Get_Object (Chooser), Get_Object (Filter));
518   end Remove_Filter;
519
520   ----------------
521   -- Select_All --
522   ----------------
523
524   procedure Select_All
525      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
526   is
527      procedure Internal (Chooser : System.Address);
528      pragma Import (C, Internal, "gtk_recent_chooser_select_all");
529   begin
530      Internal (Get_Object (Chooser));
531   end Select_All;
532
533   ----------------
534   -- Select_Uri --
535   ----------------
536
537   function Select_Uri
538      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
539       URI     : UTF8_String) return Boolean
540   is
541      function Internal
542         (Chooser : System.Address;
543          URI     : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean;
544      pragma Import (C, Internal, "gtk_recent_chooser_select_uri");
545      Tmp_URI    : Interfaces.C.Strings.chars_ptr := New_String (URI);
546      Tmp_Return : Glib.Gboolean;
547   begin
548      Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI);
549      Free (Tmp_URI);
550      return Tmp_Return /= 0;
551   end Select_Uri;
552
553   ---------------------
554   -- Set_Current_Uri --
555   ---------------------
556
557   function Set_Current_Uri
558      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
559       URI     : UTF8_String) return Boolean
560   is
561      function Internal
562         (Chooser : System.Address;
563          URI     : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean;
564      pragma Import (C, Internal, "gtk_recent_chooser_set_current_uri");
565      Tmp_URI    : Interfaces.C.Strings.chars_ptr := New_String (URI);
566      Tmp_Return : Glib.Gboolean;
567   begin
568      Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI);
569      Free (Tmp_URI);
570      return Tmp_Return /= 0;
571   end Set_Current_Uri;
572
573   ----------------
574   -- Set_Filter --
575   ----------------
576
577   procedure Set_Filter
578      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
579       Filter  : access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class)
580   is
581      procedure Internal (Chooser : System.Address; Filter : System.Address);
582      pragma Import (C, Internal, "gtk_recent_chooser_set_filter");
583   begin
584      Internal (Get_Object (Chooser), Get_Object_Or_Null (GObject (Filter)));
585   end Set_Filter;
586
587   ---------------
588   -- Set_Limit --
589   ---------------
590
591   procedure Set_Limit
592      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
593       Limit   : Gint)
594   is
595      procedure Internal (Chooser : System.Address; Limit : Gint);
596      pragma Import (C, Internal, "gtk_recent_chooser_set_limit");
597   begin
598      Internal (Get_Object (Chooser), Limit);
599   end Set_Limit;
600
601   --------------------
602   -- Set_Local_Only --
603   --------------------
604
605   procedure Set_Local_Only
606      (Chooser    : not null access Gtk_Recent_Chooser_Menu_Record;
607       Local_Only : Boolean)
608   is
609      procedure Internal
610         (Chooser    : System.Address;
611          Local_Only : Glib.Gboolean);
612      pragma Import (C, Internal, "gtk_recent_chooser_set_local_only");
613   begin
614      Internal (Get_Object (Chooser), Boolean'Pos (Local_Only));
615   end Set_Local_Only;
616
617   ------------------------
618   -- Set_Related_Action --
619   ------------------------
620
621   procedure Set_Related_Action
622      (Self   : not null access Gtk_Recent_Chooser_Menu_Record;
623       Action : not null access Gtk.Action.Gtk_Action_Record'Class)
624   is
625      procedure Internal (Self : System.Address; Action : System.Address);
626      pragma Import (C, Internal, "gtk_activatable_set_related_action");
627   begin
628      Internal (Get_Object (Self), Get_Object (Action));
629   end Set_Related_Action;
630
631   -------------------------
632   -- Set_Select_Multiple --
633   -------------------------
634
635   procedure Set_Select_Multiple
636      (Chooser         : not null access Gtk_Recent_Chooser_Menu_Record;
637       Select_Multiple : Boolean)
638   is
639      procedure Internal
640         (Chooser         : System.Address;
641          Select_Multiple : Glib.Gboolean);
642      pragma Import (C, Internal, "gtk_recent_chooser_set_select_multiple");
643   begin
644      Internal (Get_Object (Chooser), Boolean'Pos (Select_Multiple));
645   end Set_Select_Multiple;
646
647   --------------------
648   -- Set_Show_Icons --
649   --------------------
650
651   procedure Set_Show_Icons
652      (Chooser    : not null access Gtk_Recent_Chooser_Menu_Record;
653       Show_Icons : Boolean)
654   is
655      procedure Internal
656         (Chooser    : System.Address;
657          Show_Icons : Glib.Gboolean);
658      pragma Import (C, Internal, "gtk_recent_chooser_set_show_icons");
659   begin
660      Internal (Get_Object (Chooser), Boolean'Pos (Show_Icons));
661   end Set_Show_Icons;
662
663   ------------------------
664   -- Set_Show_Not_Found --
665   ------------------------
666
667   procedure Set_Show_Not_Found
668      (Chooser        : not null access Gtk_Recent_Chooser_Menu_Record;
669       Show_Not_Found : Boolean)
670   is
671      procedure Internal
672         (Chooser        : System.Address;
673          Show_Not_Found : Glib.Gboolean);
674      pragma Import (C, Internal, "gtk_recent_chooser_set_show_not_found");
675   begin
676      Internal (Get_Object (Chooser), Boolean'Pos (Show_Not_Found));
677   end Set_Show_Not_Found;
678
679   ----------------------
680   -- Set_Show_Private --
681   ----------------------
682
683   procedure Set_Show_Private
684      (Chooser      : not null access Gtk_Recent_Chooser_Menu_Record;
685       Show_Private : Boolean)
686   is
687      procedure Internal
688         (Chooser      : System.Address;
689          Show_Private : Glib.Gboolean);
690      pragma Import (C, Internal, "gtk_recent_chooser_set_show_private");
691   begin
692      Internal (Get_Object (Chooser), Boolean'Pos (Show_Private));
693   end Set_Show_Private;
694
695   -------------------
696   -- Set_Show_Tips --
697   -------------------
698
699   procedure Set_Show_Tips
700      (Chooser   : not null access Gtk_Recent_Chooser_Menu_Record;
701       Show_Tips : Boolean)
702   is
703      procedure Internal
704         (Chooser   : System.Address;
705          Show_Tips : Glib.Gboolean);
706      pragma Import (C, Internal, "gtk_recent_chooser_set_show_tips");
707   begin
708      Internal (Get_Object (Chooser), Boolean'Pos (Show_Tips));
709   end Set_Show_Tips;
710
711   -------------------
712   -- Set_Sort_Type --
713   -------------------
714
715   procedure Set_Sort_Type
716      (Chooser   : not null access Gtk_Recent_Chooser_Menu_Record;
717       Sort_Type : Gtk.Recent_Chooser.Gtk_Recent_Sort_Type)
718   is
719      procedure Internal
720         (Chooser   : System.Address;
721          Sort_Type : Gtk.Recent_Chooser.Gtk_Recent_Sort_Type);
722      pragma Import (C, Internal, "gtk_recent_chooser_set_sort_type");
723   begin
724      Internal (Get_Object (Chooser), Sort_Type);
725   end Set_Sort_Type;
726
727   -------------------------------
728   -- Set_Use_Action_Appearance --
729   -------------------------------
730
731   procedure Set_Use_Action_Appearance
732      (Self           : not null access Gtk_Recent_Chooser_Menu_Record;
733       Use_Appearance : Boolean)
734   is
735      procedure Internal
736         (Self           : System.Address;
737          Use_Appearance : Glib.Gboolean);
738      pragma Import (C, Internal, "gtk_activatable_set_use_action_appearance");
739   begin
740      Internal (Get_Object (Self), Boolean'Pos (Use_Appearance));
741   end Set_Use_Action_Appearance;
742
743   ----------------------------
744   -- Sync_Action_Properties --
745   ----------------------------
746
747   procedure Sync_Action_Properties
748      (Self   : not null access Gtk_Recent_Chooser_Menu_Record;
749       Action : access Gtk.Action.Gtk_Action_Record'Class)
750   is
751      procedure Internal (Self : System.Address; Action : System.Address);
752      pragma Import (C, Internal, "gtk_activatable_sync_action_properties");
753   begin
754      Internal (Get_Object (Self), Get_Object_Or_Null (GObject (Action)));
755   end Sync_Action_Properties;
756
757   ------------------
758   -- Unselect_All --
759   ------------------
760
761   procedure Unselect_All
762      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record)
763   is
764      procedure Internal (Chooser : System.Address);
765      pragma Import (C, Internal, "gtk_recent_chooser_unselect_all");
766   begin
767      Internal (Get_Object (Chooser));
768   end Unselect_All;
769
770   ------------------
771   -- Unselect_Uri --
772   ------------------
773
774   procedure Unselect_Uri
775      (Chooser : not null access Gtk_Recent_Chooser_Menu_Record;
776       URI     : UTF8_String)
777   is
778      procedure Internal
779         (Chooser : System.Address;
780          URI     : Interfaces.C.Strings.chars_ptr);
781      pragma Import (C, Internal, "gtk_recent_chooser_unselect_uri");
782      Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI);
783   begin
784      Internal (Get_Object (Chooser), Tmp_URI);
785      Free (Tmp_URI);
786   end Unselect_Uri;
787
788end Gtk.Recent_Chooser_Menu;
789