/** * @brief Callback for input item preparser to directory monitor */ static void PreparseComplete( const vlc_event_t * p_event, void *p_data ) { int i_ret = VLC_SUCCESS; preparsed_item_t* p_itemobject = (preparsed_item_t*) p_data; monitoring_thread_t *p_mon = p_itemobject->p_mon; media_library_t *p_ml = (media_library_t *)p_mon->p_ml; input_item_t *p_input = (input_item_t*) p_event->p_obj; if( input_item_IsPreparsed( p_input ) ) { if( p_itemobject->b_update ) { //TODO: Perhaps we don't have to load everything? ml_media_t* p_media = GetMedia( p_ml, p_itemobject->i_update_id, ML_MEDIA_SPARSE, true ); CopyInputItemToMedia( p_media, p_input ); i_ret = UpdateMedia( p_ml, p_media ); ml_gc_decref( p_media ); } else i_ret = AddInputItem( p_ml, p_input ); } if( i_ret != VLC_SUCCESS ) msg_Dbg( p_mon, "Item could not be correctly added" " or updated during scan: %s", p_input->psz_uri ); QuerySimple( p_ml, "UPDATE media SET directory_id=%d, timestamp=%d " "WHERE id=%d", p_itemobject->i_dir_id, p_itemobject->i_mtime, GetMediaIdOfURI( p_ml, p_input->psz_uri ) ); vlc_event_detach( &p_input->event_manager, vlc_InputItemPreparsedChanged, PreparseComplete, p_itemobject ); vlc_gc_decref( p_input ); free( p_itemobject->psz_uri ); }
void CMusicListItemUI::DoEvent(TEventUI& event) { if( event.Type == UIEVENT_MOUSEENTER ) { if( IsEnabled() ) { m_uButtonState |= UISTATE_HOT; Hot(); Invalidate(); } if (m_pMusicInfoDlg == NULL) { m_pMusicInfoDlg = new CMusicInfoDialog; m_pMusicInfoDlg->Init(_T("xmls\\MusicList\\MusicInfoWnd.xml"),m_pManager->GetPaintWindow(), 357); m_pMusicInfoDlg->ResetWindow(GetPos().top - 10, GetMedia()); } // CMusicInfoDialog *pMusicInfoDlg = (static_cast<CMusicListGroupUI*>(GetParentNode()))->GetMusicList()->GetMusicInfoDialog(); // if (pMusicInfoDlg != NULL) // { // pMusicInfoDlg->ResetWindow(GetPos().top - 10, GetMedia()); // pMusicInfoDlg->ShowWindow(); // } return; } else if( event.Type == UIEVENT_MOUSELEAVE ) { if( (m_uButtonState & UISTATE_HOT) != 0 ) { m_uButtonState &= ~UISTATE_HOT; Hot(false); Invalidate(); } if (m_pMusicInfoDlg != NULL) { m_pMusicInfoDlg->Close(); m_pMusicInfoDlg = NULL; } // CMusicInfoDialog *pMusicInfoDlg = (static_cast<CMusicListGroupUI*>(GetParentNode()))->GetMusicList()->GetMusicInfoDialog(); // if (pMusicInfoDlg != NULL) // { // pMusicInfoDlg->ShowWindow(false); // } return; } else if( event.Type == UIEVENT_CONTEXTMENU ) { if( IsContextMenuUsed() ) { m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, event.wParam, event.lParam); } } else CTreeNodeUI::DoEvent(event); }