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 
22 #include "wx/filehistory.h"
23 
24 #if wxUSE_FILE_HISTORY
25 
26 #include "wx/filename.h"
27 
28 #include "wx/gtk/private.h"
29 #include "wx/gtk/private/string.h"
30 
31 // ============================================================================
32 // implementation
33 // ============================================================================
34 
AddFileToHistory(const wxString & file)35 void wxFileHistory::AddFileToHistory(const wxString& file)
36 {
37     wxFileHistoryBase::AddFileToHistory(file);
38 
39 #ifdef __WXGTK210__
40     const wxString fullPath = wxFileName(file).GetFullPath();
41     if ( wx_is_at_least_gtk2(10) )
42     {
43         wxGtkString uri(g_filename_to_uri(wxGTK_CONV_FN(fullPath), NULL, NULL));
44 
45         if ( uri )
46             gtk_recent_manager_add_item(gtk_recent_manager_get_default(), uri);
47     }
48 #endif
49 }
50 
51 #endif // wxUSE_FILE_HISTORY
52