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