[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 08/12: Added support for keyboard shortcuts
noreply at xfce.org
noreply at xfce.org
Tue Feb 17 00:12:47 CET 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 78e8d290a556a8d63d50d3d29fc7880d2a5d2598
Author: Andrzej <ndrwrdck at gmail.com>
Date: Thu Jun 26 02:04:35 2014 +0100
Added support for keyboard shortcuts
enable-keyboard-shortcuts property not yet working (?)
---
configure.ac.in | 13 ++-
panel-plugin/Makefile.am | 6 +-
panel-plugin/pulseaudio-button.c | 8 +-
panel-plugin/pulseaudio-config.c | 235 ++++++++++++++++++++++++++++++++++++++
panel-plugin/pulseaudio-config.h | 45 ++++++++
panel-plugin/pulseaudio-plugin.c | 160 +++++++++++++++++++++-----
panel-plugin/pulseaudio-plugin.h | 2 +
7 files changed, 428 insertions(+), 41 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 8029211..fbe519f 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -91,6 +91,12 @@ dnl *** Optional IDO library ***
dnl ****************************
XDT_CHECK_OPTIONAL_PACKAGE([IDO], [libido3-0.1], [13.10.0], [ido], [IDO library])
+dnl **********************************
+dnl *** Optional keybinder Support ***
+dnl **********************************
+XDT_CHECK_OPTIONAL_PACKAGE([KEYBINDER], [keybinder-3.0], [0.2.2], [keybinder],
+ [keybinder Support])
+
dnl ***********************************
dnl *** Check for debugging support ***
dnl ***********************************
@@ -126,9 +132,6 @@ echo
echo "Build Configuration:"
echo
echo "* Debug Support: $enable_debug"
-if test x"$IDO_FOUND" = x"yes"; then
-echo "* Use IDO library: yes"
-else
-echo "* Use IDO library: no"
-fi
+echo "* Use keybinder: ${KEYBINDER_FOUND:-no}"
+echo "* Use IDO library: ${IDO_FOUND:-no}"
echo
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 5c7b203..f0947a0 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -23,6 +23,8 @@ libpulseaudio_plugin_la_SOURCES = \
pulseaudio-volume.h \
pulseaudio-button.c \
pulseaudio-button.h \
+ pulseaudio-config.c \
+ pulseaudio-config.h \
pulseaudio-plugin.c \
pulseaudio-plugin.h
@@ -35,6 +37,7 @@ libpulseaudio_plugin_la_CFLAGS = \
$(LIBXFCE4PANEL_CFLAGS) \
$(XFCONF_CFLAGS) \
$(IDO_CFLAGS) \
+ $(KEYBINDER_CFLAGS) \
$(PLATFORM_CFLAGS) \
-DDATADIR=\""$(datadir)"\"
@@ -53,7 +56,8 @@ libpulseaudio_plugin_la_LIBADD = \
$(LIBXFCE4UI_LIBS) \
$(LIBXFCE4PANEL_LIBS) \
$(XFCONF_LIBS) \
- $(IDO_LIBS)
+ $(IDO_LIBS) \
+ $(KEYBINDER_LIBS)
#
# Desktop file
diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index d145ea3..b1cc40f 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -29,6 +29,7 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
+#include "pulseaudio-plugin.h"
#include "pulseaudio-button.h"
#define V_MUTED 0
@@ -36,8 +37,6 @@
#define V_MEDIUM 2
#define V_HIGH 3
-#define STEP 0.06
-
/* Icons for different volume levels */
static const char *icons[] = {
@@ -226,10 +225,7 @@ pulseaudio_button_scroll_event (GtkWidget *widget, GdkEventScroll *event)
gdouble volume = pulseaudio_volume_get_volume (button->volume);
gdouble new_volume;
- if (pulseaudio_volume_get_muted (button->volume))
- volume = 0.0;
-
- new_volume = MIN (MAX (volume + (1.0 - 2.0 * event->direction) * STEP, 0.0), 1.0);
+ new_volume = MIN (MAX (volume + (1.0 - 2.0 * event->direction) * VOLUME_STEP, 0.0), 1.0);
pulseaudio_volume_set_volume (button->volume, new_volume);
//g_debug ("dir: %d %f -> %f", event->direction, volume, new_volume);
diff --git a/panel-plugin/pulseaudio-config.c b/panel-plugin/pulseaudio-config.c
new file mode 100644
index 0000000..978c056
--- /dev/null
+++ b/panel-plugin/pulseaudio-config.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2014 Andrzej <ndrwrdck at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+
+/*
+ * This file implements a configuration store. The class extends GObject.
+ *
+ */
+
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4ui/libxfce4ui.h>
+#include <xfconf/xfconf.h>
+//#include <exo/exo.h>
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+#include "pulseaudio-plugin.h"
+#include "pulseaudio-config.h"
+
+
+
+
+#define DEFAULT_ENABLE_KEYBOARD_SHORTCUTS TRUE
+
+
+
+
+static void pulseaudio_config_finalize (GObject *object);
+static void pulseaudio_config_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void pulseaudio_config_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+
+
+struct _PulseaudioConfigClass
+{
+ GObjectClass __parent__;
+};
+
+struct _PulseaudioConfig
+{
+ GObject __parent__;
+
+ gboolean enable_keyboard_shortcuts;
+};
+
+
+
+enum
+ {
+ PROP_0,
+ PROP_ENABLE_KEYBOARD_SHORTCUTS,
+ N_PROPERTIES,
+ };
+
+enum
+ {
+ CONFIGURATION_CHANGED,
+ LAST_SIGNAL
+ };
+
+static guint pulseaudio_config_signals [LAST_SIGNAL] = { 0, };
+
+
+G_DEFINE_TYPE (PulseaudioConfig, pulseaudio_config, G_TYPE_OBJECT)
+
+
+
+static void
+pulseaudio_config_class_init (PulseaudioConfigClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = pulseaudio_config_finalize;
+ gobject_class->get_property = pulseaudio_config_get_property;
+ gobject_class->set_property = pulseaudio_config_set_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_ENABLE_KEYBOARD_SHORTCUTS,
+ g_param_spec_boolean ("enable-keyboard-shortcuts", NULL, NULL,
+ DEFAULT_ENABLE_KEYBOARD_SHORTCUTS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+
+
+ pulseaudio_config_signals[CONFIGURATION_CHANGED] =
+ g_signal_new (g_intern_static_string ("configuration-changed"),
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+
+
+static void
+pulseaudio_config_init (PulseaudioConfig *config)
+{
+ config->enable_keyboard_shortcuts = DEFAULT_ENABLE_KEYBOARD_SHORTCUTS;
+}
+
+
+
+static void
+pulseaudio_config_finalize (GObject *object)
+{
+ //PulseaudioConfig *config = PULSEAUDIO_CONFIG (object);
+
+ xfconf_shutdown();
+
+ G_OBJECT_CLASS (pulseaudio_config_parent_class)->finalize (object);
+}
+
+
+
+static void
+pulseaudio_config_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PulseaudioConfig *config = PULSEAUDIO_CONFIG (object);
+
+ switch (prop_id)
+ {
+ case PROP_ENABLE_KEYBOARD_SHORTCUTS:
+ g_value_set_boolean (value, config->enable_keyboard_shortcuts);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+pulseaudio_config_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PulseaudioConfig *config = PULSEAUDIO_CONFIG (object);
+ gint val;
+
+ switch (prop_id)
+ {
+ case PROP_ENABLE_KEYBOARD_SHORTCUTS:
+ val = g_value_get_boolean (value);
+ if (config->enable_keyboard_shortcuts != val)
+ {
+ config->enable_keyboard_shortcuts = val;
+ printf ("********** NOTIFY %d\n", val);
+ g_object_notify (G_OBJECT (config), "enable-keyboard-shortcuts");
+ g_signal_emit (G_OBJECT (config), pulseaudio_config_signals [CONFIGURATION_CHANGED], 0);
+ }
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+
+gboolean
+pulseaudio_config_get_enable_keyboard_shortcuts (PulseaudioConfig *config)
+{
+ g_return_val_if_fail (IS_PULSEAUDIO_CONFIG (config), DEFAULT_ENABLE_KEYBOARD_SHORTCUTS);
+
+ return config->enable_keyboard_shortcuts;
+}
+
+
+
+
+PulseaudioConfig *
+pulseaudio_config_new (const gchar *property_base)
+{
+ PulseaudioConfig *config;
+ XfconfChannel *channel;
+ gchar *property;
+
+ config = g_object_new (TYPE_PULSEAUDIO_CONFIG, NULL);
+
+ if (xfconf_init (NULL))
+ {
+ channel = xfconf_channel_get ("xfce4-panel");
+
+ property = g_strconcat (property_base, "/enable-keyboard-shortcuts", NULL);
+ xfconf_g_property_bind (channel, property, G_TYPE_BOOLEAN, config, "enable-keyboard-shortcuts");
+ g_free (property);
+
+ g_object_notify (G_OBJECT (config), "enable-keyboard-shortcuts");
+ g_signal_emit (G_OBJECT (config), pulseaudio_config_signals [CONFIGURATION_CHANGED], 0);
+ }
+
+ return config;
+}
diff --git a/panel-plugin/pulseaudio-config.h b/panel-plugin/pulseaudio-config.h
new file mode 100644
index 0000000..c8b534d
--- /dev/null
+++ b/panel-plugin/pulseaudio-config.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Andrzej <ndrwrdck at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PULSEAUDIO_CONFIG_H__
+#define __PULSEAUDIO_CONFIG_H__
+
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _PulseaudioConfigClass PulseaudioConfigClass;
+typedef struct _PulseaudioConfig PulseaudioConfig;
+
+#define TYPE_PULSEAUDIO_CONFIG (pulseaudio_config_get_type ())
+#define PULSEAUDIO_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PULSEAUDIO_CONFIG, PulseaudioConfig))
+#define PULSEAUDIO_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PULSEAUDIO_CONFIG, PulseaudioConfigClass))
+#define IS_PULSEAUDIO_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PULSEAUDIO_CONFIG))
+#define IS_PULSEAUDIO_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PULSEAUDIO_CONFIG))
+#define PULSEAUDIO_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PULSEAUDIO_CONFIG, PulseaudioConfigClass))
+
+GType pulseaudio_config_get_type (void) G_GNUC_CONST;
+
+PulseaudioConfig *pulseaudio_config_new (const gchar *property_base);
+
+gboolean pulseaudio_config_get_enable_keyboard_shortcuts (PulseaudioConfig *config);
+
+G_END_DECLS
+
+#endif /* !__PULSEAUDIO_CONFIG_H__ */
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index 9a7f611..52b6169 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -35,6 +35,7 @@
#include <libxfce4panel/xfce-panel-plugin.h>
#include "pulseaudio-plugin.h"
+#include "pulseaudio-config.h"
#include "pulseaudio-volume.h"
#include "pulseaudio-button.h"
@@ -42,14 +43,34 @@
#include <libido/libido.h>
#endif
+
+#ifdef HAVE_KEYBINDER
+#include <keybinder.h>
+
+#define PULSEAUDIO_PLUGIN_RAISE_VOLUME_KEY "XF86AudioRaiseVolume"
+#define PULSEAUDIO_PLUGIN_LOWER_VOLUME_KEY "XF86AudioLowerVolume"
+#define PULSEAUDIO_PLUGIN_MUTE_KEY "XF86AudioMute"
+#endif
+
+
+
/* prototypes */
static void pulseaudio_plugin_construct (XfcePanelPlugin *plugin);
-static void pulseaudio_plugin_free (XfcePanelPlugin *plugin);
+static void pulseaudio_plugin_free_data (XfcePanelPlugin *plugin);
static void pulseaudio_plugin_show_about (XfcePanelPlugin *plugin);
static void pulseaudio_plugin_configure_plugin (XfcePanelPlugin *plugin);
static gboolean pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
gint size);
+#ifdef HAVE_KEYBINDER
+static void pulseaudio_plugin_bind_keys_cb (PulseaudioPlugin *pulseaudio_plugin);
+static void pulseaudio_plugin_bind_keys (PulseaudioPlugin *pulseaudio_plugin,
+ gboolean bind);
+static void pulseaudio_plugin_volume_key_pressed (const char *keystring,
+ void *user_data);
+static void pulseaudio_plugin_mute_pressed (const char *keystring,
+ void *user_data);
+#endif
struct _PulseaudioPluginClass
{
@@ -61,6 +82,7 @@ struct _PulseaudioPlugin
{
XfcePanelPlugin __parent__;
+ PulseaudioConfig *config;
PulseaudioVolume *volume;
/* panel widgets */
@@ -84,7 +106,7 @@ pulseaudio_plugin_class_init (PulseaudioPluginClass *klass)
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->construct = pulseaudio_plugin_construct;
- plugin_class->free_data = pulseaudio_plugin_free;
+ plugin_class->free_data = pulseaudio_plugin_free_data;
plugin_class->about = pulseaudio_plugin_show_about;
plugin_class->configure_plugin = pulseaudio_plugin_configure_plugin;
plugin_class->size_changed = pulseaudio_plugin_size_changed;
@@ -105,8 +127,14 @@ pulseaudio_plugin_init (PulseaudioPlugin *pulseaudio_plugin)
static void
-pulseaudio_plugin_free (XfcePanelPlugin *plugin)
+pulseaudio_plugin_free_data (XfcePanelPlugin *plugin)
{
+ PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (plugin);
+
+#ifdef HAVE_KEYBINDER
+ if (pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config))
+ pulseaudio_plugin_bind_keys (pulseaudio_plugin, FALSE);
+#endif
}
@@ -114,29 +142,30 @@ pulseaudio_plugin_free (XfcePanelPlugin *plugin)
static void
pulseaudio_plugin_show_about (XfcePanelPlugin *plugin)
{
- GdkPixbuf *icon;
-
- const gchar *auth[] =
- {
- "Andrzej Radecki <ndrwrdck at gmail.com>",
- NULL
- };
-
- g_return_if_fail (IS_PULSEAUDIO_PLUGIN (plugin));
-
- icon = xfce_panel_pixbuf_from_source ("xfce4-pulseaudio-plugin", NULL, 32);
- gtk_show_about_dialog (NULL,
- "logo", icon,
- "license", xfce_get_license_text (XFCE_LICENSE_TEXT_GPL),
- "version", PACKAGE_VERSION,
- "program-name", PACKAGE_NAME,
- "comments", _("A panel plugin for controlling PulseAudio mixer."),
- "website", "http://goodies.xfce.org/projects/panel-plugins/xfce4-pulseaudio-plugin",
- "copyright", _("Copyright (c) 2014\n"),
- "authors", auth, NULL);
-
- if (icon)
- g_object_unref (G_OBJECT (icon));
+ GdkPixbuf *icon;
+
+ const gchar *auth[] =
+ {
+ "Andrzej Radecki <ndrwrdck at gmail.com>",
+ NULL
+ };
+
+ g_return_if_fail (IS_PULSEAUDIO_PLUGIN (plugin));
+
+ icon = xfce_panel_pixbuf_from_source ("xfce4-pulseaudio-plugin", NULL, 32);
+ gtk_show_about_dialog (NULL,
+ "logo", icon,
+ "license", xfce_get_license_text (XFCE_LICENSE_TEXT_GPL),
+ "version", PACKAGE_VERSION,
+ "program-name", PACKAGE_NAME,
+ "comments", _("A panel plugin for controlling PulseAudio mixer."),
+ "website", "http://goodies.xfce.org/projects/panel-plugins/xfce4-pulseaudio-plugin",
+ "copyright", _("Copyright (c) 2014\n"),
+ "authors", auth,
+ NULL);
+
+ if (icon)
+ g_object_unref (G_OBJECT (icon));
}
@@ -210,14 +239,77 @@ pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
+#ifdef HAVE_KEYBINDER
+static void
+pulseaudio_plugin_bind_keys_cb (PulseaudioPlugin *pulseaudio_plugin)
+{
+ g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
+
+ pulseaudio_plugin_bind_keys (pulseaudio_plugin, pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config));
+}
+
+
+static void
+pulseaudio_plugin_bind_keys (PulseaudioPlugin *pulseaudio_plugin,
+ gboolean bind)
+{
+ g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
+
+ g_debug ("pulseaudio_plugin_bind_keys: %d", bind);
+
+ if (bind)
+ {
+ keybinder_bind (PULSEAUDIO_PLUGIN_LOWER_VOLUME_KEY, pulseaudio_plugin_volume_key_pressed, pulseaudio_plugin);
+ keybinder_bind (PULSEAUDIO_PLUGIN_RAISE_VOLUME_KEY, pulseaudio_plugin_volume_key_pressed, pulseaudio_plugin);
+ keybinder_bind (PULSEAUDIO_PLUGIN_MUTE_KEY, pulseaudio_plugin_mute_pressed, pulseaudio_plugin);
+ }
+ else
+ {
+ keybinder_unbind (PULSEAUDIO_PLUGIN_LOWER_VOLUME_KEY, pulseaudio_plugin_volume_key_pressed);
+ keybinder_unbind (PULSEAUDIO_PLUGIN_RAISE_VOLUME_KEY, pulseaudio_plugin_volume_key_pressed);
+ keybinder_unbind (PULSEAUDIO_PLUGIN_MUTE_KEY, pulseaudio_plugin_mute_pressed);
+ }
+}
+
+
+static void
+pulseaudio_plugin_volume_key_pressed (const char *keystring,
+ void *user_data)
+{
+ PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (user_data);
+ gdouble volume = pulseaudio_volume_get_volume (pulseaudio_plugin->volume);
+ gdouble new_volume;
+
+ g_debug ("%s pressed", keystring);
+
+ if (strcmp (keystring, PULSEAUDIO_PLUGIN_RAISE_VOLUME_KEY) == 0)
+ pulseaudio_volume_set_volume (pulseaudio_plugin->volume, MIN (MAX (volume + VOLUME_STEP, 0.0), 1.0));
+ else if (strcmp (keystring, PULSEAUDIO_PLUGIN_LOWER_VOLUME_KEY) == 0)
+ pulseaudio_volume_set_volume (pulseaudio_plugin->volume, MIN (MAX (volume - VOLUME_STEP, 0.0), 1.0));
+}
+
+
+static void
+pulseaudio_plugin_mute_pressed (const char *keystring,
+ void *user_data)
+{
+ PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (user_data);
+
+ g_debug ("%s pressed", keystring);
+
+ pulseaudio_volume_toggle_muted (pulseaudio_plugin->volume);
+}
+#endif
+
+
static void
pulseaudio_plugin_construct (XfcePanelPlugin *plugin)
{
PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (plugin);
- #ifdef HAVE_IDO
+#ifdef HAVE_IDO
ido_init();
- #endif
+#endif
xfce_panel_plugin_menu_show_configure (plugin);
xfce_panel_plugin_menu_show_about (plugin);
@@ -231,11 +323,19 @@ pulseaudio_plugin_construct (XfcePanelPlugin *plugin)
g_log_set_default_handler (pulseaudio_plugin_log_handler, plugin);
/* initialize xfconf */
- //pulseaudio_plugin->config = pulseaudio_config_new (xfce_panel_plugin_get_property_base (plugin));
+ pulseaudio_plugin->config = pulseaudio_config_new (xfce_panel_plugin_get_property_base (plugin));
/* instantiate preference dialog builder */
//pulseaudio_plugin->dialog = pulseaudio_dialog_new (pulseaudio_plugin->config);
+#ifdef HAVE_KEYBINDER
+ /* Initialize libkeybinder */
+ keybinder_init ();
+ g_signal_connect (G_OBJECT (pulseaudio_plugin->config), "notify::enable-keyboard-shortcuts",
+ G_CALLBACK (pulseaudio_plugin_bind_keys_cb), pulseaudio_plugin);
+ pulseaudio_plugin_bind_keys (pulseaudio_plugin, pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config));
+#endif
+
/* volume controller */
pulseaudio_plugin->volume = pulseaudio_volume_new ();
@@ -243,5 +343,7 @@ pulseaudio_plugin_construct (XfcePanelPlugin *plugin)
pulseaudio_plugin->button = pulseaudio_button_new (pulseaudio_plugin->volume);
gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET (pulseaudio_plugin->button));
gtk_widget_show (GTK_WIDGET (pulseaudio_plugin->button));
+
+
}
diff --git a/panel-plugin/pulseaudio-plugin.h b/panel-plugin/pulseaudio-plugin.h
index 082b8ce..3cbfd2e 100644
--- a/panel-plugin/pulseaudio-plugin.h
+++ b/panel-plugin/pulseaudio-plugin.h
@@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
+#define VOLUME_STEP 0.06
+
G_BEGIN_DECLS
typedef struct _PulseaudioPluginClass PulseaudioPluginClass;
typedef struct _PulseaudioPlugin PulseaudioPlugin;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list