1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                    Copyright (C) 2010, 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.  
  24. --  <description> 
  25. --  A Gtk_Recent_Filter can be used to restrict the files being shown in a 
  26. --  Gtk_Recent_Chooser. Files can be filtered based on their name (with 
  27. --  Add_Pattern), on their mime type (with Add_Mime_Type), on the application 
  28. --  that has registered them (with Add_Application), or by a custom filter 
  29. --  function (with Add_Custom). 
  30. -- 
  31. --  Filtering by mime type handles aliasing and subclassing of mime types; 
  32. --  e.g. a filter for text/plain also matches a file with mime type 
  33. --  application/rtf, since application/rtf is a subclass of text/plain. 
  34. --  Note that Gtk_Recent_Filter allows wildcards for the subtype of a mime 
  35. --  type, so you can e.g. filter for image/*. 
  36. -- 
  37. --  Normally, filters are used by adding them to a Gtk_Recent_Chooser, see 
  38. --  Gtk.Recent_Chooser.Add_Filter, but it is also possible to manually use a 
  39. --  filter on a file with Filter. 
  40. --  </description> 
  41. --  <c_version>2.16.6</c_version> 
  42.  
  43. with Glib.GSlist; 
  44. with Gtk.Object; 
  45.  
  46. package Gtk.Recent_Filter is 
  47.  
  48.    type Gtk_Recent_Filter_Record is 
  49.      new Gtk.Object.Gtk_Object_Record with private; 
  50.    type Gtk_Recent_Filter is access all Gtk_Recent_Filter_Record'Class; 
  51.  
  52.    function Get_Type return GType; 
  53.  
  54.    function Convert (Widget : Gtk_Recent_Filter) return System.Address; 
  55.    function Convert (Widget : System.Address) return Gtk_Recent_Filter; 
  56.    package Gtk_Recent_Filter_List is 
  57.      new Glib.GSlist.Generic_SList (Gtk_Recent_Filter); 
  58.    --  Instantiation of a singly-linked list of Gtk_Recent_Filter's. 
  59.  
  60.    procedure Gtk_New (Widget : out Gtk_Recent_Filter); 
  61.    procedure Initialize (Widget : access Gtk_Recent_Filter_Record'Class); 
  62.    --  Creates a new Gtk_Recent_Filter with no rules added to it. 
  63.    --  Such filter does not accept any recently used resources, so is not 
  64.    --  particularly useful until you add rules with Add_Pattern, Add_Mime_Type, 
  65.    --  Add_Application, Add_Age.  To create a filter that accepts any recently 
  66.    --  used resource, use: 
  67.    -- 
  68.    --     declare 
  69.    --        Filter : Gtk_Recent_Filter; 
  70.    --     begin 
  71.    --        Gtk_New (Filter); 
  72.    --        Add_Pattern (Filter, "*"); 
  73.    --     end; 
  74.  
  75.    procedure Add_Age 
  76.      (Filter : access Gtk_Recent_Filter_Record; 
  77.       Days   : Gint); 
  78.    --  Adds a rule that allows resources based on their age - that is, the 
  79.    --  number of days elapsed since they were last modified. 
  80.  
  81.    procedure Add_Application 
  82.      (Filter      : access Gtk_Recent_Filter_Record; 
  83.       Application : UTF8_String); 
  84.    --  Adds a rule that allows resources based on the name of the application 
  85.    --  that has registered them. 
  86.  
  87.    procedure Add_Group 
  88.      (Filter : access Gtk_Recent_Filter_Record; 
  89.       Group  : UTF8_String); 
  90.    --  Adds a rule that allows resources based on the name of the group 
  91.    --  to which they belong 
  92.  
  93.    procedure Add_Mime_Type 
  94.      (Filter    : access Gtk_Recent_Filter_Record; 
  95.       Mime_Type : UTF8_String); 
  96.    --  Adds a rule that allows resources based on their registered MIME type. 
  97.  
  98.    procedure Add_Pattern 
  99.      (Filter  : access Gtk_Recent_Filter_Record; 
  100.       Pattern : UTF8_String); 
  101.    --  Adds a rule that allows resources based on a pattern matching their 
  102.    --  display name. 
  103.  
  104.    procedure Add_Pixbuf_Formats (Filter : access Gtk_Recent_Filter_Record); 
  105.    --  Adds a rule allowing image files in the formats supported 
  106.    --  by Gdk_Pixbuf. 
  107.  
  108.    function Get_Name 
  109.      (Filter : access Gtk_Recent_Filter_Record) return UTF8_String; 
  110.    procedure Set_Name 
  111.      (Filter : access Gtk_Recent_Filter_Record; 
  112.       Name   : UTF8_String); 
  113.    --  Gets/Sets the human-readable name of the filter; this is the string 
  114.    --  that will be displayed in the recently used resources selector 
  115.    --  user interface if there is a selectable list of filters. 
  116.  
  117. private 
  118.  
  119.    type Gtk_Recent_Filter_Record is 
  120.      new Gtk.Object.Gtk_Object_Record with null record; 
  121.  
  122.    pragma Import (C, Get_Type, "gtk_recent_filter_get_type"); 
  123.  
  124. end Gtk.Recent_Filter;