1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/gtk/filehistory.cpp
3 // Purpose:     GTK+ bits for wxFileHistory class
4 // Author:      Vaclav Slavik
5 // Created:     2010-05-06
6 // Copyright:   (c) 2010 Vaclav Slavik
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 // ============================================================================
11 // declarations
12 // ============================================================================
13 
14 // ----------------------------------------------------------------------------
15 // headers
16 // ----------------------------------------------------------------------------
17 
18 // For compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
20 
21 #ifdef __BORLANDC__
22     #pragma hdrstop
23 #endif
24 
25 #include "wx/filehistory.h"
26 
27 #if wxUSE_FILE_HISTORY
28 
29 #include "wx/filename.h"
30 
31 #include <glib.h>
32 #include <gtk/gtk.h>
33 #include "wx/gtk/private/string.h"
34 #include "wx/gtk/private.h"
35 
36 // ============================================================================
37 // implementation
38 // ============================================================================
39 
AddFileToHistory(const wxString & file)40 void wxFileHistory::AddFileToHistory(const wxString& file)
41 {
42     wxFileHistoryBase::AddFileToHistory(file);
43 
44 #ifdef __WXGTK210__
45     const wxString fullPath = wxFileName(file).GetFullPath();
46 #ifndef __WXGTK3__
47     if ( !gtk_check_version(2,10,0) )
48 #endif
49     {
50         wxGtkString uri(g_filename_to_uri(wxGTK_CONV_FN(fullPath), NULL, NULL));
51 
52         if ( uri )
53             gtk_recent_manager_add_item(gtk_recent_manager_get_default(), uri);
54     }
55 #endif
56 }
57 
58 #endif // wxUSE_FILE_HISTORY
59