[Xfce4-commits] <parole:master> Fixed Volume scaling

Hakan Erduman noreply at xfce.org
Thu Dec 12 00:18:12 CET 2013


Updating branch refs/heads/master
         to 38f53010485fc03c737ffd0b0144a2538bd5a7c8 (commit)
       from b473e35870a2ada2c3c1baa9d3aa496eea7e3e81 (commit)

commit 38f53010485fc03c737ffd0b0144a2538bd5a7c8
Author: Hakan Erduman <smultimeter at gmail.com>
Date:   Sun Nov 10 22:14:05 2013 +0100

    Fixed Volume scaling

 src/plugins/mpris2/mpris2-provider.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/plugins/mpris2/mpris2-provider.c b/src/plugins/mpris2/mpris2-provider.c
index ab14db5..612193f 100644
--- a/src/plugins/mpris2/mpris2-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -144,7 +144,7 @@ static void mpris_Root_Raise (GDBusMethodInvocation *invocation, GVariant* param
 
 static void mpris_Root_Quit (GDBusMethodInvocation *invocation, GVariant* parameters, Mpris2Provider *provider)
 {
-    /* TODO: optionally get a real close API */
+    /* TODO: optionally get a real close API since this won't work always */
     gtk_main_quit();
     g_dbus_method_invocation_return_value (invocation, NULL);
 }
@@ -462,14 +462,19 @@ static GVariant* mpris_Player_get_Volume (GError **error, Mpris2Provider *provid
 
     g_object_get (G_OBJECT (provider->conf), "volume", &volume, NULL);
 
-    return g_variant_new_double(volume);
+    return g_variant_new_double(volume / 100.0);
 }
 
 static void mpris_Player_put_Volume (GVariant *value, GError **error, Mpris2Provider *provider)
 {
    gdouble volume = g_variant_get_double(value);
 
-   g_object_set(G_OBJECT(provider->conf), "volume", volume, NULL);
+   if(volume < 0.0)
+      volume = 0.0;
+   if(volume > 1.0)
+      volume = 1.0;
+
+   g_object_set(G_OBJECT(provider->conf), "volume", (gint) volume * 100.0, NULL);
 
 }
 
@@ -480,6 +485,11 @@ static GVariant* mpris_Player_get_Position (GError **error, Mpris2Provider *prov
     /* TODO: How get position?
     gdouble position = parole_gst_get_stream_position (PAROLE_GST (player->priv->gst))*/
 
+    /* Possibly:
+    ParoleStream *stream = parole_provider_player_get_stream(provider);
+    g_object_get_property(G_OBJECT(stream), "position", &position);
+    */
+
     return g_variant_new_int64(position);
 }
 


More information about the Xfce4-commits mailing list