]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fswatchercmn.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / common / fswatchercmn.cpp
index dfa8730cf3a7c4e95603690705d17a86c5bc77c3..1de2422183e1ad5ed104952a6864ff8a5ffb4eef 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxMswFileSystemWatcher
 // Author:      Bartosz Bekier
 // Created:     2009-05-26
-// RCS-ID:      $Id$
 // Copyright:   (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -42,6 +41,10 @@ static wxString GetFSWEventChangeTypeName(int type)
         return "ACCESS";
     case wxFSW_EVENT_ATTRIB: // Currently this is wxGTK-only
         return "ATTRIBUTE";
+#ifdef wxHAS_INOTIFY
+    case wxFSW_EVENT_UNMOUNT: // Currently this is wxGTK-only
+        return "UNMOUNT";
+#endif
     case wxFSW_EVENT_WARNING:
         return "WARNING";
     case wxFSW_EVENT_ERROR:
@@ -58,6 +61,8 @@ static wxString GetFSWEventChangeTypeName(int type)
 // wxFileSystemWatcherEvent implementation
 // ============================================================================
 
+IMPLEMENT_DYNAMIC_CLASS(wxFileSystemWatcherEvent, wxEvent);
+
 wxString wxFileSystemWatcherEvent::ToString() const
 {
     return wxString::Format("FSW_EVT type=%d (%s) path='%s'", m_changeType,
@@ -96,7 +101,10 @@ bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events)
     }
     else
     {
-        wxLogError(_("Can't monitor non-existent path \"%s\" for changes."),
+        // Don't overreact to being passed a non-existent item. It may have
+        // only just been deleted, in which case doing nothing is correct
+        wxLogTrace(wxTRACE_FSWATCHER,
+                   "Can't monitor non-existent path \"%s\" for changes.",
                    path.GetFullPath());
         return false;
     }
@@ -126,7 +134,7 @@ wxFileSystemWatcherBase::AddAny(const wxFileName& path,
     if ( it == m_watches.end() )
     {
         wxFSWatchInfoMap::value_type val(canonical, watch);
-        m_watches.insert(val).second;
+        m_watches.insert(val);
     }
     else
     {