| 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 | |
| 36 | // ============================================================================ |
| 37 | // implementation |
| 38 | // ============================================================================ |
| 39 | |
| 40 | void wxFileHistory::AddFileToHistory(const wxString& file) |
| 41 | { |
| 42 | wxFileHistoryBase::AddFileToHistory(file); |
| 43 | |
| 44 | #ifdef __WXGTK210__ |
| 45 | const wxString fullPath = wxFileName(file).GetFullPath(); |
| 46 | if ( !gtk_check_version(2,10,0) ) |
| 47 | { |
| 48 | wxGtkString uri(g_filename_to_uri(fullPath.fn_str(), NULL, NULL)); |
| 49 | |
| 50 | if ( uri ) |
| 51 | gtk_recent_manager_add_item(gtk_recent_manager_get_default(), uri); |
| 52 | } |
| 53 | #endif |
| 54 | } |
| 55 | |
| 56 | #endif // wxUSE_FILE_HISTORY |