[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 10/12: Added initial support for config dialog and fixed keybinding option

noreply at xfce.org noreply at xfce.org
Tue Feb 17 00:12:49 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 fef99e2e5ed4ee8779f3393dce05f999acf433aa
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Sat Feb 14 22:29:16 2015 +0000

    Added initial support for config dialog and fixed keybinding option
---
 panel-plugin/Makefile.am             |    7 +-
 panel-plugin/pulseaudio-config.c     |    1 -
 panel-plugin/pulseaudio-dialog.glade |  283 +++++++---------------------------
 panel-plugin/pulseaudio-plugin.c     |   77 +++++----
 po/POTFILES.in                       |    1 +
 5 files changed, 111 insertions(+), 258 deletions(-)

diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index f0947a0..52d9ac0 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -26,7 +26,10 @@ libpulseaudio_plugin_la_SOURCES = \
 	pulseaudio-config.c \
 	pulseaudio-config.h \
 	pulseaudio-plugin.c \
-	pulseaudio-plugin.h
+	pulseaudio-plugin.h \
+	pulseaudio-dialog.c \
+	pulseaudio-dialog.h
+
 
 libpulseaudio_plugin_la_CFLAGS = \
 	$(PULSEAUDIO_CFLAGS) \
@@ -86,7 +89,7 @@ DISTCLEANFILES += \
 	$(libpulseaudio_built_sources)
 
 pulseaudio-dialog_ui.h: pulseaudio-dialog.glade
-	$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=pulseaudio-dialog_ui $< >$@
+	$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=pulseaudio_dialog_ui $< >$@
 endif
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/panel-plugin/pulseaudio-config.c b/panel-plugin/pulseaudio-config.c
index 978c056..19a2c72 100644
--- a/panel-plugin/pulseaudio-config.c
+++ b/panel-plugin/pulseaudio-config.c
@@ -184,7 +184,6 @@ pulseaudio_config_set_property (GObject      *object,
       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);
         }
diff --git a/panel-plugin/pulseaudio-dialog.glade b/panel-plugin/pulseaudio-dialog.glade
index d1a4c5a..012bb03 100644
--- a/panel-plugin/pulseaudio-dialog.glade
+++ b/panel-plugin/pulseaudio-dialog.glade
@@ -1,11 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.14"/>
   <!-- interface-requires libxfce4ui 0.0 -->
+  <requires lib="gtk+" version="2.14"/>
   <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">xfce4-indicator-plugin</property>
+  </object>
   <object class="XfceTitledDialog" id="dialog">
     <property name="can_focus">False</property>
-    <property name="title" translatable="yes">Indicators</property>
+    <property name="title" translatable="yes">Pulseaudio</property>
     <property name="default_width">425</property>
     <property name="default_height">525</property>
     <property name="icon_name">gtk-properties</property>
@@ -26,7 +31,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -41,7 +45,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -66,13 +69,13 @@
             <property name="border_width">6</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkFrame" id="frame3">
+              <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment3">
+                  <object class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
@@ -83,13 +86,13 @@
                         <property name="border_width">6</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkCheckButton" id="checkbutton-single-row">
-                            <property name="label" translatable="yes">Arrange indicators in a single row</property>
+                          <object class="GtkCheckButton" id="checkbutton-keyboard-shortcuts">
+                            <property name="label" translatable="yes">Enable keyboard _shortcuts for volume control</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="tooltip_text" translatable="yes">If enabled, ensure that the indicators are laid out in a single row or column.</property>
-                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
@@ -98,22 +101,6 @@
                             <property name="position">0</property>
                           </packing>
                         </child>
-                        <child>
-                          <object class="GtkCheckButton" id="checkbutton-align-left">
-                            <property name="label" translatable="yes">Align left in deskbar mode</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">Controls the indicator button layout when the panel is in a Deskbar mode. Possible choices are "centered" or "aligned left".</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
                       </object>
                     </child>
                   </object>
@@ -122,7 +109,7 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Appearance</property>
+                    <property name="label" translatable="yes">Behaviour</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
                     </attributes>
@@ -136,217 +123,87 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame1">
+              <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
+                  <object class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkVBox" id="vbox3">
+                      <object class="GtkVBox" id="vbox4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="border_width">6</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkCheckButton" id="checkbutton-whitelist">
-                            <property name="label" translatable="yes">Hide indicators by default</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="tooltip_text" translatable="yes">When enabled, only indicators marked "Visible" are shown. Otherwise, all indicators not marked "Hidden" are displayed.</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkHBox" id="hbox2">
+                          <object class="GtkTable" id="table1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">6</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">12</property>
+                            <property name="row_spacing">6</property>
                             <child>
-                              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                              <object class="GtkLabel" id="label2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Mixer _tool</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="entry-mixer-name">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hscrollbar_policy">automatic</property>
-                                <property name="vscrollbar_policy">automatic</property>
-                                <property name="shadow_type">in</property>
-                                <child>
-                                  <object class="GtkTreeView" id="indicators-treeview">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="model">indicators-store</property>
-                                    <property name="headers_clickable">False</property>
-                                    <property name="rules_hint">True</property>
-                                    <property name="enable_search">False</property>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn-icon">
-                                        <property name="min_width">24</property>
-                                        <child>
-                                          <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
-                                          <attributes>
-                                            <attribute name="pixbuf">0</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn-name">
-                                        <property name="title" translatable="yes">Indicator</property>
-                                        <property name="expand">True</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext1"/>
-                                          <attributes>
-                                            <attribute name="text">1</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn-blacklist">
-                                        <property name="title" translatable="yes">Hidden</property>
-                                        <child>
-                                          <object class="GtkCellRendererToggle" id="hidden-toggle"/>
-                                          <attributes>
-                                            <attribute name="active">2</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn-whitelist">
-                                        <property name="title" translatable="yes">Visible</property>
-                                        <child>
-                                          <object class="GtkCellRendererToggle" id="visible-toggle"/>
-                                          <attributes>
-                                            <attribute name="active">3</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
+                                <property name="invisible_char">•</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="primary_icon_sensitive">True</property>
+                                <property name="secondary_icon_sensitive">True</property>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkVBox" id="vbox4">
+                              <object class="GtkAlignment" id="alignment3">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="spacing">6</property>
+                                <property name="xalign">0</property>
+                                <property name="xscale">0</property>
                                 <child>
-                                  <object class="GtkButton" id="item-up">
+                                  <object class="GtkButton" id="button-run-mixer">
+                                    <property name="label" translatable="yes">_Run mixer tool...</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
-                                    <property name="tooltip_text" translatable="yes">Move the selected indicator one row up.</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <child>
-                                      <object class="GtkImage" id="image2">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="stock">gtk-go-up</property>
-                                      </object>
-                                    </child>
+                                    <property name="image">image1</property>
+                                    <property name="use_underline">True</property>
                                   </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="item-down">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="tooltip_text" translatable="yes">Move the selected indicator one row down.</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <child>
-                                      <object class="GtkImage" id="image3">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="stock">gtk-go-down</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label4">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">20</property>
-                            <property name="ypad">6</property>
-                            <property name="label" translatable="yes"><i>Please restart the panel for visibility changes to take effect.</i></property>
-                            <property name="use_markup">True</property>
-                            <property name="wrap">True</property>
-                          </object>
-                          <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkHButtonBox" id="hbuttonbox1">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="layout_style">start</property>
-                            <child>
-                              <object class="GtkButton" id="indicators-clear">
-                                <property name="label" translatable="yes">C_lear known indicators</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <property name="tooltip_text" translatable="yes">Resets the list of indicators and their visibility settings.</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="image">image1</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">3</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                       </object>
@@ -357,7 +214,7 @@
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Known Indicators</property>
+                    <property name="label" translatable="yes">Sound settings</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
                     </attributes>
@@ -365,14 +222,14 @@
                 </child>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
@@ -384,30 +241,4 @@
       <action-widget response="0">help-button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkImage" id="image1">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="stock">gtk-clear</property>
-  </object>
-  <object class="GtkListStore" id="indicators-store">
-    <columns>
-      <!-- column-name icon -->
-      <column type="GdkPixbuf"/>
-      <!-- column-name title -->
-      <column type="gchararray"/>
-      <!-- column-name hidden -->
-      <column type="gboolean"/>
-      <!-- column-name visible -->
-      <column type="gboolean"/>
-      <!-- column-name tooltip -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
-  <object class="GtkAdjustment" id="size-adjustment">
-    <property name="lower">12</property>
-    <property name="upper">64</property>
-    <property name="value">32</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">2</property>
-  </object>
 </interface>
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index 52b6169..b0a896b 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -1,4 +1,4 @@
-/*  Copyright (c) 2014 Andrzej <ndrwrdck at gmail.com>
+/*  Copyright (c) 2014-2015 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
@@ -38,6 +38,7 @@
 #include "pulseaudio-config.h"
 #include "pulseaudio-volume.h"
 #include "pulseaudio-button.h"
+#include "pulseaudio-dialog.h"
 
 #ifdef HAVE_IDO
 #include <libido/libido.h>
@@ -63,9 +64,10 @@ static gboolean         pulseaudio_plugin_size_changed                     (Xfce
                                                                             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_bind_keys_cb                     (PulseaudioPlugin      *pulseaudio_plugin,
+                                                                            PulseaudioConfig      *pulseaudio_config);
+static gboolean         pulseaudio_plugin_bind_keys                        (PulseaudioPlugin      *pulseaudio_plugin);
+static void             pulseaudio_plugin_unbind_keys                      (PulseaudioPlugin      *pulseaudio_plugin);
 static void             pulseaudio_plugin_volume_key_pressed               (const char            *keystring,
                                                                             void                  *user_data);
 static void             pulseaudio_plugin_mute_pressed                     (const char            *keystring,
@@ -88,6 +90,9 @@ struct _PulseaudioPlugin
   /* panel widgets */
   GtkWidget           *button;
 
+  /* config dialog builder */
+  PulseaudioDialog    *dialog;
+
   /* log file */
   FILE                *logfile;
 };
@@ -132,8 +137,8 @@ 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);
+  /* release keybindings */
+  pulseaudio_plugin_unbind_keys (pulseaudio_plugin);
 #endif
 }
 
@@ -175,7 +180,7 @@ pulseaudio_plugin_configure_plugin (XfcePanelPlugin *plugin)
 {
   PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (plugin);
 
-  //pulseaudio_dialog_show (pulseaudio_plugin->dialog, gtk_widget_get_screen (GTK_WIDGET (plugin)));
+  pulseaudio_dialog_show (pulseaudio_plugin->dialog, gtk_widget_get_screen (GTK_WIDGET (plugin)));
 }
 
 
@@ -241,34 +246,45 @@ pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
 
 #ifdef HAVE_KEYBINDER
 static void
-pulseaudio_plugin_bind_keys_cb (PulseaudioPlugin      *pulseaudio_plugin)
+pulseaudio_plugin_bind_keys_cb (PulseaudioPlugin      *pulseaudio_plugin,
+                                PulseaudioConfig      *pulseaudio_config)
 {
   g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
 
-  pulseaudio_plugin_bind_keys (pulseaudio_plugin, pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config));
+  if (pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config))
+    pulseaudio_plugin_bind_keys (pulseaudio_plugin);
+  else
+    pulseaudio_plugin_unbind_keys (pulseaudio_plugin);
 }
 
 
-static void
-pulseaudio_plugin_bind_keys (PulseaudioPlugin      *pulseaudio_plugin,
-                             gboolean               bind)
+static gboolean
+pulseaudio_plugin_bind_keys (PulseaudioPlugin      *pulseaudio_plugin)
 {
+  gboolean success;
   g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
+  g_debug ("Grabbing volume control keys");
 
-  g_debug ("pulseaudio_plugin_bind_keys: %d", bind);
+  success = (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));
 
-  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);
-    }
+  if (!success)
+    g_warning ("Could not have grabbed volume control keys. Is another volume control application (xfce4-volumed) running?");
+
+  return success;
+}
+
+
+static void
+pulseaudio_plugin_unbind_keys (PulseaudioPlugin      *pulseaudio_plugin)
+{
+  g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
+  g_debug ("Releasing volume control keys");
+
+  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);
 }
 
 
@@ -326,14 +342,17 @@ pulseaudio_plugin_construct (XfcePanelPlugin *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);
+  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));
+  g_signal_connect_swapped (G_OBJECT (pulseaudio_plugin->config), "notify::enable-keyboard-shortcuts",
+                            G_CALLBACK (pulseaudio_plugin_bind_keys_cb), pulseaudio_plugin);
+  if (pulseaudio_config_get_enable_keyboard_shortcuts (pulseaudio_plugin->config))
+    pulseaudio_plugin_bind_keys (pulseaudio_plugin);
+  else
+    pulseaudio_plugin_unbind_keys (pulseaudio_plugin);
 #endif
 
   /* volume controller */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d4e23fb..c786742 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,3 +1,4 @@
 panel-plugin/pulseaudio.desktop.in.in
 panel-plugin/pulseaudio.c
+panel-plugin/pulseaudio-button.c
 panel-plugin/pulseaudio-dialog.glade

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


More information about the Xfce4-commits mailing list