[vlc-commits] [Git][videolan/vlc][master] medialibrary: Bind folder modifications callbacks

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Feb 25 17:04:31 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
c7a10410 by Hugo Beauzée-Luyssen at 2022-02-25T15:37:01+00:00
medialibrary: Bind folder modifications callbacks

- - - - -


2 changed files:

- include/vlc_media_library.h
- modules/misc/medialibrary/medialibrary.cpp


Changes:

=====================================
include/vlc_media_library.h
=====================================
@@ -644,6 +644,9 @@ enum vlc_ml_event_type
     VLC_ML_EVENT_BOOKMARKS_ADDED,
     VLC_ML_EVENT_BOOKMARKS_UPDATED,
     VLC_ML_EVENT_BOOKMARKS_DELETED,
+    VLC_ML_EVENT_FOLDER_ADDED,
+    VLC_ML_EVENT_FOLDER_UPDATED,
+    VLC_ML_EVENT_FOLDER_DELETED,
     /**
      * A discovery started.
      *
@@ -783,6 +786,7 @@ typedef struct vlc_ml_event_t
             const vlc_ml_playlist_t* p_playlist;
             const vlc_ml_genre_t* p_genre;
             const vlc_ml_bookmark_t* p_bookmark;
+            const vlc_ml_folder_t* p_folder;
         } creation;
         struct
         {


=====================================
modules/misc/medialibrary/medialibrary.cpp
=====================================
@@ -86,6 +86,7 @@ void assignToEvent( vlc_ml_event_t* ev, vlc_ml_genre_t* g )    { ev->creation.p_
 void assignToEvent( vlc_ml_event_t* ev, vlc_ml_group_t* g )    { ev->creation.p_group    = g; }
 void assignToEvent( vlc_ml_event_t* ev, vlc_ml_playlist_t* p ) { ev->creation.p_playlist = p; }
 void assignToEvent( vlc_ml_event_t* ev, vlc_ml_bookmark_t* b ) { ev->creation.p_bookmark = b; }
+void assignToEvent( vlc_ml_event_t* ev, vlc_ml_folder_t* f )   { ev->creation.p_folder = f; }
 
 template <typename To, typename From>
 void wrapEntityCreatedEventCallback( vlc_medialibrary_module_t* ml,
@@ -251,19 +252,22 @@ void MediaLibrary::onBookmarksDeleted( std::set<int64_t> bookmarkIds )
                                     VLC_ML_EVENT_BOOKMARKS_DELETED );
 }
 
-void MediaLibrary::onFoldersAdded( std::vector<medialibrary::FolderPtr> )
+void MediaLibrary::onFoldersAdded( std::vector<medialibrary::FolderPtr> folders )
 {
-
+    wrapEntityCreatedEventCallback<vlc_ml_folder_t>( m_vlc_ml, folders,
+                                                     VLC_ML_EVENT_FOLDER_ADDED );
 }
 
-void MediaLibrary::onFoldersModified( std::set<int64_t> )
+void MediaLibrary::onFoldersModified( std::set<int64_t> folderIds )
 {
-
+    wrapEntityModifiedEventCallback( m_vlc_ml, folderIds,
+                                     VLC_ML_EVENT_FOLDER_UPDATED );
 }
 
-void MediaLibrary::onFoldersDeleted( std::set<int64_t> )
+void MediaLibrary::onFoldersDeleted( std::set<int64_t> folderIds )
 {
-
+    wrapEntityDeletedEventCallback( m_vlc_ml, folderIds,
+                                    VLC_ML_EVENT_FOLDER_DELETED );
 }
 
 void MediaLibrary::onDiscoveryStarted()



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c7a10410acc67cdb06c9079642efc2c66c87989f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c7a10410acc67cdb06c9079642efc2c66c87989f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list