Removing playlists

To remove a playlist you only need the reference to the manager and call the method for deletion:

MafwPlaylistManager *manager;
MafwProxyPlaylist *playlist;
GError *error = NULL;

manager = mafw_playlist_manager_get ();

playlist = mafw_playlist_manager_get_playlist(manager, id,
					      &error);
if (error != NULL) {
  /* Playlist does not exist, error management */
}

mafw_playlist_manager_destroy_playlist(manager, playlist,
				       &error);
if (error != NULL) {
  /* Playlist could not be deleted, error management */
}

As one can see, in this case first we request the playlist we are interested in remove by using its id. When we have a reference to the playlist, we are ready to destroy it. As in the case of playlist creation, it is also a good idea to install a signal handler for playlist deletion because they are shared and any other program could delete them (although programs should care about not deleting the playlists not owned by them). Here is a code example:

{
	g_signal_connect(manager, "playlist-destroyed",
			 G_CALLBACK(on_mafw_playlist_destroyed), NULL);
}

static void
on_mafw_playlist_destroyed (MafwPlaylistManager* manager,
			    MafwProxyPlaylist *playlist, gpointer user_data)
{
        /* Remove and unref the playlist proxy from your program
           structures because it is deleted */
}