[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 03/03: Don't issue volume notifications when plugin menu is shown.
noreply at xfce.org
noreply at xfce.org
Sat Sep 3 10:56:33 CEST 2016
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 50c9279946715ef52ba7f4cccbdc98c06d3c3025
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sat Sep 3 09:55:22 2016 +0100
Don't issue volume notifications when plugin menu is shown.
---
panel-plugin/pulseaudio-button.c | 10 ++++++++++
panel-plugin/pulseaudio-button.h | 5 ++++-
panel-plugin/pulseaudio-notify.c | 9 +++++++--
panel-plugin/pulseaudio-notify.h | 4 +++-
panel-plugin/pulseaudio-plugin.c | 13 +++++++------
5 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index a920b55..e38db90 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -364,6 +364,16 @@ pulseaudio_button_set_size (PulseaudioButton *button,
+PulseaudioMenu *
+pulseaudio_button_get_menu (PulseaudioButton *button)
+{
+ g_return_val_if_fail (IS_PULSEAUDIO_BUTTON (button), NULL);
+
+ return button->menu;
+}
+
+
+
static void
pulseaudio_button_volume_changed (PulseaudioButton *button,
gboolean should_notify,
diff --git a/panel-plugin/pulseaudio-button.h b/panel-plugin/pulseaudio-button.h
index 6d5bc66..b7982e2 100644
--- a/panel-plugin/pulseaudio-button.h
+++ b/panel-plugin/pulseaudio-button.h
@@ -21,9 +21,10 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include "pulseaudio-plugin.h"
+#include "pulseaudio-config.h"
#include "pulseaudio-volume.h"
#include "pulseaudio-menu.h"
-//#include "pulseaudio-config.h"
G_BEGIN_DECLS
@@ -46,6 +47,8 @@ PulseaudioButton *pulseaudio_button_new (PulseaudioPlugin *plugin,
void pulseaudio_button_set_size (PulseaudioButton *button,
gint size);
+PulseaudioMenu *pulseaudio_button_get_menu (PulseaudioButton *button);
+
G_END_DECLS
#endif /* !__PULSEAUDIO_BUTTON_H__ */
diff --git a/panel-plugin/pulseaudio-notify.c b/panel-plugin/pulseaudio-notify.c
index 0620221..efc6f27 100644
--- a/panel-plugin/pulseaudio-notify.c
+++ b/panel-plugin/pulseaudio-notify.c
@@ -68,6 +68,7 @@ struct _PulseaudioNotify
PulseaudioConfig *config;
PulseaudioVolume *volume;
+ PulseaudioButton *button;
gboolean gauge_notifications;
NotifyNotification *notification;
@@ -157,7 +158,8 @@ pulseaudio_notify_notify (PulseaudioNotify *notify)
g_return_if_fail (IS_PULSEAUDIO_NOTIFY (notify));
g_return_if_fail (IS_PULSEAUDIO_VOLUME (notify->volume));
- if (!pulseaudio_config_get_show_notifications (notify->config))
+ if (!pulseaudio_config_get_show_notifications (notify->config) ||
+ pulseaudio_button_get_menu (notify->button) != NULL)
return;
volume = pulseaudio_volume_get_volume (notify->volume);
@@ -228,17 +230,20 @@ pulseaudio_notify_volume_changed (PulseaudioNotify *notify,
PulseaudioNotify *
pulseaudio_notify_new (PulseaudioConfig *config,
- PulseaudioVolume *volume)
+ PulseaudioVolume *volume,
+ PulseaudioButton *button)
{
PulseaudioNotify *notify;
g_return_val_if_fail (IS_PULSEAUDIO_CONFIG (config), NULL);
g_return_val_if_fail (IS_PULSEAUDIO_VOLUME (volume), NULL);
+ g_return_val_if_fail (IS_PULSEAUDIO_BUTTON (button), NULL);
notify = g_object_new (TYPE_PULSEAUDIO_NOTIFY, NULL);
notify->config = config;
notify->volume = volume;
+ notify->button = button;
notify->volume_changed_id =
g_signal_connect_swapped (G_OBJECT (notify->volume), "volume-changed",
G_CALLBACK (pulseaudio_notify_volume_changed), notify);
diff --git a/panel-plugin/pulseaudio-notify.h b/panel-plugin/pulseaudio-notify.h
index c2e0714..e4d6e66 100644
--- a/panel-plugin/pulseaudio-notify.h
+++ b/panel-plugin/pulseaudio-notify.h
@@ -24,6 +24,7 @@
#include <glib-object.h>
#include "pulseaudio-config.h"
#include "pulseaudio-volume.h"
+#include "pulseaudio-button.h"
G_BEGIN_DECLS
@@ -40,7 +41,8 @@ typedef struct _PulseaudioNotifyClass PulseaudioNotifyClass;
GType pulseaudio_notify_get_type (void) G_GNUC_CONST;
PulseaudioNotify *pulseaudio_notify_new (PulseaudioConfig *config,
- PulseaudioVolume *volume);
+ PulseaudioVolume *volume,
+ PulseaudioButton *button);
G_END_DECLS
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index 95db7b2..0c16e72 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -266,7 +266,7 @@ static gboolean
pulseaudio_plugin_bind_keys (PulseaudioPlugin *pulseaudio_plugin)
{
gboolean success;
- g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
+ g_return_val_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin), FALSE);
pulseaudio_debug ("Grabbing volume control keys");
success = (keybinder_bind (PULSEAUDIO_PLUGIN_LOWER_VOLUME_KEY, pulseaudio_plugin_volume_key_pressed, pulseaudio_plugin) &&
@@ -359,16 +359,17 @@ pulseaudio_plugin_construct (XfcePanelPlugin *plugin)
/* volume controller */
pulseaudio_plugin->volume = pulseaudio_volume_new (pulseaudio_plugin->config);
+ /* instantiate a button box */
+ pulseaudio_plugin->button = pulseaudio_button_new (pulseaudio_plugin,
+ pulseaudio_plugin->config,
+ pulseaudio_plugin->volume);
/* initialize notify wrapper */
#ifdef HAVE_LIBNOTIFY
pulseaudio_plugin->notify = pulseaudio_notify_new (pulseaudio_plugin->config,
- pulseaudio_plugin->volume);
+ pulseaudio_plugin->volume,
+ pulseaudio_plugin->button);
#endif
- /* instantiate a button box */
- pulseaudio_plugin->button = pulseaudio_button_new (pulseaudio_plugin,
- pulseaudio_plugin->config,
- pulseaudio_plugin->volume);
gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET (pulseaudio_plugin->button));
gtk_widget_show (GTK_WIDGET (pulseaudio_plugin->button));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list