[Xfce4-commits] [apps/xfce4-volumed-pulse] 37/62: check error codes

noreply at xfce.org noreply at xfce.org
Thu Sep 8 10:32:59 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-volumed-pulse.

commit 00cf078290bd4ddba302e03620f602141abb3dd6
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date:   Thu May 24 20:55:30 2012 +0200

    check error codes
    
    Ensure that a mute/volchange operation succeeded before displaying a
    notification.
---
 TODO            |  1 -
 src/xvd_pulse.c | 18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index 8f3ba1a..d3db363 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
 * rename to xfce4-volumed-pulse, so that both can coexist (but not run at the same time, obviously)
 * fix ugly & duplicate clamp code
 * reinstate /step prop read from xfconf
-* actually check that a mute/volchange operation succeeded before displaying the notification
diff --git a/src/xvd_pulse.c b/src/xvd_pulse.c
index b593748..3c09e62 100644
--- a/src/xvd_pulse.c
+++ b/src/xvd_pulse.c
@@ -238,12 +238,19 @@ xvd_notify_volume_update (pa_context *c,
 {
   XvdInstance  *i = (XvdInstance *) userdata;
 
-  if (!userdata)
+  if (!c || !userdata)
     {
       g_warning ("xvd_notify_volume_update: invalid argument");
       return;
     }
 
+  if (!success)
+    {
+      g_warning ("xvd_notify_volume_update: operation failed, %s",
+                 pa_strerror (pa_context_errno (c)));
+      return;
+    }
+
   if (i->current_vol >= 100 && i->new_vol >= i->current_vol)
     {
       i->current_vol = i->new_vol;
@@ -271,12 +278,19 @@ xvd_notify_volume_mute (pa_context *c,
 {
   XvdInstance  *i = (XvdInstance *) userdata;
 
-  if (!userdata)
+  if (!c || !userdata)
     {
       g_warning ("xvd_notify_volume_mute: invalid argument");
       return;
     }
 
+  if (!success)
+    {
+      g_warning ("xvd_notify_volume_mute: operation failed, %s",
+                 pa_strerror (pa_context_errno (c)));
+      return;
+    }
+
   if (i->mute)
     xvd_notify_notification (i, "audio-volume-muted", i->current_vol);
   else

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list