~ubuntu-branches/ubuntu/vivid/guayadeque/vivid

« back to all changes in this revision

Viewing changes to src/dbus/.svn/text-base/mpris.cpp.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-25 11:59:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110225115910-13phl46pz0rgqg0a
Tags: 0.2.9-1
* Imported Upstream version 0.2.9
* Drop 02-google_cover_search_engine_crash.patch patch, applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
"    <method name=\"SetRandom\">\n"
139
139
"      <arg type=\"b\" direction=\"in\" />\n"
140
140
"    </method>\n"
 
141
"    <method name=\"AddTracks\">\n"
 
142
"      <arg type=\"as\" direction=\"in\" />\n"
 
143
"      <arg type=\"b\" direction=\"in\" />\n"
 
144
"      <arg type=\"i\" direction=\"out\" />\n"
 
145
"    </method>\n"
141
146
"    <signal name=\"TrackListChange\">\n"
142
147
"      <arg type=\"i\" />\n"
143
148
"    </signal>\n"
227
232
    if( CurTrack->m_Year )
228
233
        FillMetadataDetails( &dict, metadata_names[ 9 ], ( const int ) CurTrack->m_Year );
229
234
 
230
 
//    if( !CurTrack->m_CoverPath.IsEmpty() )
231
 
//        FillMetadataDetails( &dict, metadata_names[ 10 ], ( const char * ) ( wxT( "file://" ) + CurTrack->m_CoverPath ).mb_str( wxConvUTF8 ) );
 
235
    //if( !CurTrack->m_CoverPath.IsEmpty() )
 
236
    //    FillMetadataDetails( &dict, metadata_names[ 10 ], ( const char * ) ( wxT( "file://" ) + CurTrack->m_CoverPath ).mb_str( wxConvUTF8 ) );
232
237
 
233
238
    if( CurTrack->m_Rating )
234
239
        FillMetadataDetails( &dict, metadata_names[ 11 ], ( const int ) CurTrack->m_Bitrate );
462
467
                }
463
468
                else if( !strcmp( Member, "Repeat" ) )
464
469
                {
465
 
                    wxCommandEvent event;
466
 
                    m_PlayerPanel->OnRepeatPlayButtonClick( event );
 
470
                    wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_SETREPEAT );
 
471
                    wxPostEvent( m_PlayerPanel, event );
 
472
 
467
473
                    Send( reply );
468
474
                    Flush();
469
475
                    RetVal = DBUS_HANDLER_RESULT_HANDLED;
537
543
                    }
538
544
                    else
539
545
                    {
540
 
                        m_PlayerPanel->SetVolume( Volume );
 
546
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_SETVOLUME );
 
547
                        event.SetInt( Volume );
 
548
                        wxPostEvent( m_PlayerPanel, event );
541
549
 
542
550
                        Send( reply );
543
551
                        Flush();
675
683
                          DBUS_TYPE_BOOLEAN, &PlayTrack,
676
684
                          DBUS_TYPE_INVALID );
677
685
 
 
686
                    //guLogMessage( wxT( "MPRIS: AddTrack\n%s\n%i" ), wxString( TrackPath, wxConvUTF8 ).c_str(), PlayTrack );
 
687
 
678
688
                    if( dbus_error_is_set( &error ) )
679
689
                    {
680
690
                        printf( "Could not read the AddTrack parameters : %s\n", error.message );
686
696
                        DBusMessageIter args;
687
697
                        dbus_message_iter_init_append( reply->GetMessage(), &args );
688
698
 
689
 
                        //printf( "AddTrack: %s\n", TrackPath );
690
 
 
691
 
                        if( PlayTrack )
692
 
                        {
693
 
                            m_PlayerPanel->ClearPlayList();
694
 
 
695
 
                            if( m_PlayerPanel->GetState() != guMEDIASTATE_STOPPED )
696
 
                            {
697
 
                                wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_STOP );
698
 
                                wxPostEvent( m_PlayerPanel, event );
699
 
                            }
700
 
                        }
701
 
 
702
 
                        m_PlayerPanel->AddToPlayList( wxString( TrackPath, wxConvUTF8 ) );
703
 
 
704
 
                        if( PlayTrack )
705
 
                        {
706
 
                            wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_PLAY );
707
 
                            m_PlayerPanel->OnNextTrackButtonClick( event );
708
 
                            m_PlayerPanel->OnPlayButtonClick( event );
709
 
                        }
 
699
                        wxArrayString * TrackList = new wxArrayString();
 
700
                        TrackList->Add( wxString( TrackPath, wxConvUTF8 ) );
 
701
 
 
702
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_ADDTRACKS );
 
703
                        event.SetInt( PlayTrack );
 
704
                        event.SetClientData( TrackList );
 
705
                        wxPostEvent( m_PlayerPanel, event );
 
706
 
 
707
                        int TrackAdded = 1;
 
708
                        if( !dbus_message_iter_append_basic( &args, DBUS_TYPE_INT32, &TrackAdded ) )
 
709
                        {
 
710
                            guLogError( wxT( "Failed to attach the AddTrack return code" ) );
 
711
                        }
 
712
 
 
713
                        Send( reply );
 
714
                        Flush();
 
715
                        RetVal = DBUS_HANDLER_RESULT_HANDLED;
 
716
                    }
 
717
                }
 
718
                else if( !strcmp( Member, "AddTracks" ) )
 
719
                {
 
720
                    DBusError error;
 
721
                    dbus_error_init( &error );
 
722
 
 
723
                    char **         Tracks;
 
724
                    dbus_int32_t    TracksCount;
 
725
                    dbus_bool_t     PlayTrack;
 
726
 
 
727
                    dbus_message_get_args( msg->GetMessage(), &error,
 
728
                          DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &Tracks, &TracksCount,
 
729
                          DBUS_TYPE_BOOLEAN, &PlayTrack,
 
730
                          DBUS_TYPE_INVALID );
 
731
//
 
732
//                    //guLogMessage( wxT( "MPRIS: AddTrack\n%s\n%i" ), wxString( TrackPath, wxConvUTF8 ).c_str(), PlayTrack );
 
733
//
 
734
                    if( dbus_error_is_set( &error ) )
 
735
                    {
 
736
                        guLogMessage( wxT( "Could not read the AddTracks parameters : '%s'" ), wxString( error.message, wxConvUTF8 ).c_str() );
 
737
                        dbus_error_free( &error );
 
738
                        RetVal =  DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
739
                    }
 
740
                    else
 
741
                    {
 
742
                        DBusMessageIter args;
 
743
                        dbus_message_iter_init_append( reply->GetMessage(), &args );
 
744
 
 
745
                        wxArrayString * TrackList = new wxArrayString();
 
746
                        int Index;
 
747
                        for( Index = 0; Index < TracksCount; Index++ )
 
748
                        {
 
749
                            TrackList->Add( wxString( Tracks[ Index ], wxConvUTF8 ) );
 
750
                        }
 
751
 
 
752
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_ADDTRACKS );
 
753
                        event.SetInt( PlayTrack );
 
754
                        event.SetClientData( TrackList );
 
755
                        wxPostEvent( m_PlayerPanel, event );
710
756
 
711
757
                        int TrackAdded = 1;
712
758
                        if( !dbus_message_iter_append_basic( &args, DBUS_TYPE_INT32, &TrackAdded ) )
736
782
                    }
737
783
                    else
738
784
                    {
739
 
                        m_PlayerPanel->RemoveItem( TrackNum );
 
785
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_REMOVETRACK );
 
786
                        event.SetInt( TrackNum );
 
787
                        wxPostEvent( m_PlayerPanel, event );
 
788
 
740
789
                        //Send( reply );
741
790
                        Flush();
742
791
                        RetVal = DBUS_HANDLER_RESULT_HANDLED;
761
810
                    }
762
811
                    else
763
812
                    {
764
 
                        m_PlayerPanel->SetPlayLoop( PlayLoop );
 
813
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_SETLOOP );
 
814
                        event.SetInt( PlayLoop );
 
815
                        wxPostEvent( m_PlayerPanel, event );
765
816
 
766
817
                        Flush();
767
818
                        RetVal = DBUS_HANDLER_RESULT_HANDLED;
786
837
                    }
787
838
                    else
788
839
                    {
789
 
                        wxCommandEvent event;
790
 
                        m_PlayerPanel->OnRandomPlayButtonClick( event );
 
840
                        wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_PLAYERPANEL_SETRANDOM );
 
841
                        wxPostEvent( m_PlayerPanel, event );
791
842
 
792
843
                        Flush();
793
844
                        RetVal = DBUS_HANDLER_RESULT_HANDLED;