Integrate with GNOME's Recent Documents menu.

GTK+ provides GtkRecentManager for this purpose since 2.10. Use it in
wxFileHistory if available. Integration is simple, we just add a file to
GtkRecentManager in addition to normal wxFileHistory handling.

A well-behaved GNOME application would use GtkRecentManager as the
primary store for recent files, so that it reflects when the user works
with supported files in another editor(s) too. But for now, this is much
better than no support at all.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-05-07 06:45:48 +00:00
parent 8122745571
commit 690ddfec6e
14 changed files with 260 additions and 142 deletions

View File

@@ -28,10 +28,10 @@ class WXDLLIMPEXP_FWD_BASE wxConfigBase;
// File history management
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileHistory : public wxObject
class WXDLLIMPEXP_CORE wxFileHistoryBase : public wxObject
{
public:
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
wxFileHistoryBase(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
// Operations
virtual void AddFileToHistory(const wxString& file);
@@ -79,17 +79,31 @@ private:
// The ID of the first history menu item (Doesn't have to be wxID_FILE1)
wxWindowID m_idBase;
DECLARE_DYNAMIC_CLASS(wxFileHistory)
wxDECLARE_NO_COPY_CLASS(wxFileHistory);
wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase);
};
#if WXWIN_COMPATIBILITY_2_6
inline size_t wxFileHistory::GetNoHistoryFiles() const
inline size_t wxFileHistoryBase::GetNoHistoryFiles() const
{
return m_fileHistory.GetCount();
}
#endif // WXWIN_COMPATIBILITY_2_6
#if defined(__WXGTK20__)
#include "wx/gtk/filehistory.h"
#else
// no platform-specific implementation of wxFileHistory yet
class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
{
public:
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
: wxFileHistoryBase(maxFiles, idBase) {}
DECLARE_DYNAMIC_CLASS(wxFileHistory)
};
#endif
#endif // wxUSE_FILE_HISTORY
#endif // _WX_FILEHISTORY_H_