[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 03/04: Added a volume_max xfconf property

noreply at xfce.org noreply at xfce.org
Tue Apr 7 02:06:12 CEST 2015


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

andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-pulseaudio-plugin.

commit e3f8abfe67d830faa7be28a83c4bd36ca3a4b111
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Tue Apr 7 01:03:51 2015 +0100

    Added a volume_max xfconf property
    
    Defaults to 153% (pavucontrol reports 11.08dB)
---
 panel-plugin/pulseaudio-config.c |   42 ++++++++++++++++++++++++++++++++++++++
 panel-plugin/pulseaudio-config.h |    3 ++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/panel-plugin/pulseaudio-config.c b/panel-plugin/pulseaudio-config.c
index a20cc2f..253426d 100644
--- a/panel-plugin/pulseaudio-config.c
+++ b/panel-plugin/pulseaudio-config.c
@@ -47,6 +47,7 @@
 
 #define DEFAULT_ENABLE_KEYBOARD_SHORTCUTS         TRUE
 #define DEFAULT_VOLUME_STEP                       6
+#define DEFAULT_VOLUME_MAX                        153
 
 
 
@@ -73,6 +74,7 @@ struct _PulseaudioConfig
 
   gboolean         enable_keyboard_shortcuts;
   guint            volume_step;
+  guint            volume_max;
   gchar           *mixer_command;
 };
 
@@ -83,6 +85,7 @@ enum
     PROP_0,
     PROP_ENABLE_KEYBOARD_SHORTCUTS,
     PROP_VOLUME_STEP,
+    PROP_VOLUME_MAX,
     PROP_MIXER_COMMAND,
     N_PROPERTIES,
   };
@@ -129,6 +132,15 @@ pulseaudio_config_class_init (PulseaudioConfigClass *klass)
 
 
   g_object_class_install_property (gobject_class,
+                                   PROP_VOLUME_MAX,
+                                   g_param_spec_uint ("volume-max", NULL, NULL,
+                                                      1, 300, DEFAULT_VOLUME_MAX,
+                                                      G_PARAM_READWRITE |
+                                                      G_PARAM_STATIC_STRINGS));
+
+
+
+  g_object_class_install_property (gobject_class,
                                    PROP_MIXER_COMMAND,
                                    g_param_spec_string ("mixer-command",
                                                         NULL, NULL,
@@ -153,6 +165,7 @@ pulseaudio_config_init (PulseaudioConfig *config)
 {
   config->enable_keyboard_shortcuts = DEFAULT_ENABLE_KEYBOARD_SHORTCUTS;
   config->volume_step               = DEFAULT_VOLUME_STEP;
+  config->volume_max                = DEFAULT_VOLUME_MAX;
   config->mixer_command             = g_strdup (DEFAULT_MIXER_COMMAND);
 }
 
@@ -189,6 +202,10 @@ pulseaudio_config_get_property (GObject    *object,
       g_value_set_uint (value, config->volume_step);
       break;
 
+    case PROP_VOLUME_MAX:
+      g_value_set_uint (value, config->volume_max);
+      break;
+
     case PROP_MIXER_COMMAND:
       g_value_set_string (value, config->mixer_command);
       break;
@@ -233,6 +250,16 @@ pulseaudio_config_set_property (GObject      *object,
         }
       break;
 
+    case PROP_VOLUME_MAX:
+      val_uint = g_value_get_uint (value);
+      if (config->volume_max != val_uint)
+        {
+          config->volume_max = val_uint;
+          g_object_notify (G_OBJECT (config), "volume-max");
+          g_signal_emit (G_OBJECT (config), pulseaudio_config_signals [CONFIGURATION_CHANGED], 0);
+        }
+      break;
+
     case PROP_MIXER_COMMAND:
       g_free (config->mixer_command);
       config->mixer_command = g_value_dup_string (value);
@@ -269,6 +296,17 @@ pulseaudio_config_get_volume_step (PulseaudioConfig *config)
 
 
 
+guint
+pulseaudio_config_get_volume_max (PulseaudioConfig *config)
+{
+  g_return_val_if_fail (IS_PULSEAUDIO_CONFIG (config), DEFAULT_VOLUME_MAX);
+
+  return config->volume_max;
+}
+
+
+
+
 const gchar *
 pulseaudio_config_get_mixer_command (PulseaudioConfig *config)
 {
@@ -301,6 +339,10 @@ pulseaudio_config_new (const gchar     *property_base)
       xfconf_g_property_bind (channel, property, G_TYPE_UINT, config, "volume-step");
       g_free (property);
 
+      property = g_strconcat (property_base, "/volume-max", NULL);
+      xfconf_g_property_bind (channel, property, G_TYPE_UINT, config, "volume-max");
+      g_free (property);
+
       property = g_strconcat (property_base, "/mixer-command", NULL);
       xfconf_g_property_bind (channel, property, G_TYPE_STRING, config, "mixer-command");
       g_free (property);
diff --git a/panel-plugin/pulseaudio-config.h b/panel-plugin/pulseaudio-config.h
index e7d6fc1..3136c2a 100644
--- a/panel-plugin/pulseaudio-config.h
+++ b/panel-plugin/pulseaudio-config.h
@@ -40,7 +40,8 @@ PulseaudioConfig  *pulseaudio_config_new                            (const gchar
 
 gboolean           pulseaudio_config_get_enable_keyboard_shortcuts  (PulseaudioConfig     *config);
 guint              pulseaudio_config_get_volume_step                (PulseaudioConfig     *config);
-const gchar       *pulseaudio_config_get_mixer_command                 (PulseaudioConfig     *config);
+guint              pulseaudio_config_get_volume_max                 (PulseaudioConfig     *config);
+const gchar       *pulseaudio_config_get_mixer_command              (PulseaudioConfig     *config);
 
 G_END_DECLS
 

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


More information about the Xfce4-commits mailing list