~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

Viewing changes to musicPlayer/src/applet-mpris.c

Tags: upstream-3.0.0.0beta1
ImportĀ upstreamĀ versionĀ 3.0.0.0beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
                G_TYPE_INVALID);
263
263
}
264
264
 
 
265
int cd_mpris_get_volume (void)
 
266
{
 
267
        GError *erreur = NULL;
 
268
        int iVolume;
 
269
        dbus_g_proxy_call (myData.dbus_proxy_player, "VolumeGet", &erreur,
 
270
                G_TYPE_INVALID,
 
271
                G_TYPE_INT, &iVolume,
 
272
                G_TYPE_INVALID);
 
273
        return iVolume;
 
274
}
 
275
 
 
276
void cd_mpris_set_volume (int iVolume)
 
277
{
 
278
        dbus_g_proxy_call_no_reply (myData.dbus_proxy_player, "VolumeSet",
 
279
                G_TYPE_INT, iVolume,
 
280
                G_TYPE_INVALID,
 
281
                G_TYPE_INVALID);
 
282
}
 
283
 
265
284
/* Teste si MP joue de la musique ou non
266
285
 */
267
286
void cd_mpris_getPlaying (void)  // sync version, used by Audacious.
448
467
        {
449
468
                cCoverPath = g_value_get_string(value);
450
469
        }
451
 
        cd_musicplayer_get_cover_path (cCoverPath, TRUE);
 
470
        cd_musicplayer_set_cover_path (cCoverPath);
452
471
}
453
472
 
454
473
static void _on_got_song_infos (DBusGProxy *proxy, DBusGProxyCall *call_id, CairoDockModuleInstance *myApplet)
495
514
                myData.cover_exist = FALSE;
496
515
        }
497
516
        
498
 
        cd_musicplayer_update_icon (TRUE);
 
517
        cd_musicplayer_update_icon ();
499
518
        cd_musicplayer_relaunch_handler ();
500
519
        
501
520
        CD_APPLET_LEAVE ();
545
564
                myData.iTrackNumber = 0;
546
565
                myData.cover_exist = FALSE;
547
566
        }
548
 
        cd_musicplayer_update_icon (TRUE);
 
567
        cd_musicplayer_update_icon ();
549
568
        CD_APPLET_LEAVE ();
550
569
}
551
570
 
568
587
        
569
588
        if(! myData.cover_exist/** && (myData.cPlayingUri != NULL || myData.cTitle != NULL)*/)
570
589
        {
571
 
                cd_musicplayer_set_surface (myData.iPlayingStatus);
 
590
                cd_musicplayer_apply_status_surface (myData.iPlayingStatus);
572
591
        }
573
592
        else
574
593
        {
687
706
                                G_TYPE_INVALID);
688
707
                break;
689
708
                
 
709
                case PLAYER_VOLUME :
 
710
                {
 
711
                        int iVolume = cd_mpris_get_volume ();  // [0, 100]
 
712
                        if (song && strcmp (song, "up") == 0)
 
713
                                iVolume += 5;
 
714
                        else
 
715
                                iVolume -= 5;
 
716
                        
 
717
                        if (iVolume > 100)
 
718
                                iVolume = 100;
 
719
                        else if (iVolume < 0)
 
720
                        iVolume = 0;
 
721
                        
 
722
                        cd_mpris_set_volume (iVolume);
 
723
                }
 
724
                
690
725
                default :
691
726
                break;
692
727
        }
746
781
        cd_mpris_getPlaying_async ();  // will get song infos after playing status.
747
782
        /**cd_mpris_getPlaying ();
748
783
        cd_mpris_getSongInfos ();
749
 
        cd_musicplayer_update_icon (TRUE);
 
784
        cd_musicplayer_update_icon ();
750
785
        cd_musicplayer_relaunch_handler ();*/
751
786
}
752
787
 
757
792
        pHandler->stop = cd_mpris_stop;
758
793
        pHandler->start = cd_mpris_start;
759
794
        pHandler->control = cd_mpris_control;
760
 
        pHandler->iPlayerControls = PLAYER_PREVIOUS | PLAYER_PLAY_PAUSE | PLAYER_NEXT | PLAYER_STOP | PLAYER_SHUFFLE | PLAYER_REPEAT | PLAYER_ENQUEUE;
 
795
        pHandler->iPlayerControls = PLAYER_PREVIOUS | PLAYER_PLAY_PAUSE | PLAYER_NEXT | PLAYER_STOP | PLAYER_SHUFFLE | PLAYER_REPEAT | PLAYER_ENQUEUE | PLAYER_VOLUME;
761
796
        pHandler->bSeparateAcquisition = FALSE;
762
797
        pHandler->iLevel = PLAYER_GOOD;
763
798