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