Updating branch refs/heads/master to c96da1b170d495e9313206cad4821ee22b213d70 (commit) from 0b59cbffe41e539f763fd05978c54697e875676a (commit)
commit c96da1b170d495e9313206cad4821ee22b213d70 Author: Sean Davis <smd.seanda...@gmail.com> Date: Sat Dec 7 08:49:12 2013 -0500 Handle volume updates from conf src/plugins/mpris2/mpris2-provider.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c index 1fc8a7e..34752ed 100644 --- a/src/plugins/mpris2/mpris2-provider.c +++ b/src/plugins/mpris2/mpris2-provider.c @@ -523,13 +523,20 @@ static GVariant* mpris_Player_get_Metadata (GError **error, Mpris2Provider *prov return g_variant_builder_end(&b); } -static GVariant* mpris_Player_get_Volume (GError **error, Mpris2Provider *provider) +static gdouble handle_get_volume (Mpris2Provider *provider) { - gdouble volume = 0; - - g_object_get (G_OBJECT (provider->conf), "volume", &volume, NULL); + gint volume_int = 0; + gdouble volume_double; + + g_object_get (G_OBJECT (provider->conf), "volume", &volume_int, NULL); + volume_double = (double)volume_int / 100.0; + + return volume_double; +} - return g_variant_new_double(volume / 100.0); +static GVariant* mpris_Player_get_Volume (GError **error, Mpris2Provider *provider) +{ + return g_variant_new_double(handle_get_volume(provider)); } static void mpris_Player_put_Volume (GVariant *value, GError **error, Mpris2Provider *provider) @@ -662,7 +669,7 @@ static void parole_mpris_update_any (Mpris2Provider *provider) provider->saved_playbackstatus = repeat; g_variant_builder_add (&b, "{sv}", "LoopStatus", mpris_Player_get_LoopStatus (NULL, provider)); } - //curr_vol = pragha_backend_get_volume (backend); + curr_vol = handle_get_volume(provider); if(provider->volume != curr_vol) { change_detected = TRUE; @@ -953,6 +960,9 @@ mpris2_provider_set_player (ParoleProviderPlugin *plugin, ParoleProviderPlayer * g_signal_connect ( provider->conf, "notify::repeat", G_CALLBACK (conf_changed_cb), plugin); + g_signal_connect ( provider->conf, "notify::volume", + G_CALLBACK (conf_changed_cb), plugin); + window = parole_provider_player_get_main_window(provider->player); g_signal_connect( G_OBJECT(window), "window-state-event", _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits