[Xfce4-commits] <xfce4-mixer:master> Support xfce4-panel 4.10 with its deskbar mode

Guido Berhoerster noreply at xfce.org
Thu Sep 27 16:46:06 CEST 2012


Updating branch refs/heads/master
         to f0e810321ef39e0ab57b567469b3785626f7cffc (commit)
       from 396bda88e53ff968bbbd30c46396695de0e90476 (commit)

commit f0e810321ef39e0ab57b567469b3785626f7cffc
Author: Guido Berhoerster <guido+xfce at berhoerster.name>
Date:   Thu Sep 27 16:31:08 2012 +0200

    Support xfce4-panel 4.10 with its deskbar mode
    
    Add support for the deskbar mode introduced by xfce4-panel 4.10 and set the
    small property for the plugin so that it only occupies a single row in deskbar
    mode (bug #8350).

 NEWS                              |    1 +
 configure.ac.in                   |    1 +
 panel-plugin/xfce-mixer-plugin.c  |    6 ++++++
 panel-plugin/xfce-volume-button.c |    6 +++++-
 4 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index ab83293..1f72815 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
 - Modernize build system and build panel plugin as a module.
 - Use standard icons where possible.
 - Update the icons on theme change (bug #3498).
+- Support xfce4-panel 4.10 with its deskbar mode (bug #8350).
 
 
 4.8.0
diff --git a/configure.ac.in b/configure.ac.in
index 8624259..6a42c74 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -94,6 +94,7 @@ XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.8.0])
+XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.10.0])
 XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.8.0])
 
 dnl **************************************
diff --git a/panel-plugin/xfce-mixer-plugin.c b/panel-plugin/xfce-mixer-plugin.c
index e2470a0..a396cc6 100644
--- a/panel-plugin/xfce-mixer-plugin.c
+++ b/panel-plugin/xfce-mixer-plugin.c
@@ -210,6 +210,9 @@ xfce_mixer_plugin_construct (XfcePanelPlugin *plugin)
 
   xfce_panel_plugin_menu_show_configure (plugin);
 
+   /* Only occupy a single row in deskbar mode */
+   xfce_panel_plugin_set_small (XFCE_PANEL_PLUGIN (mixer_plugin), TRUE);
+
   /* Connect to plugin signals */
   g_signal_connect_swapped (G_OBJECT (plugin), "free-data", G_CALLBACK (xfce_mixer_plugin_free), mixer_plugin);
   g_signal_connect_swapped (G_OBJECT (plugin), "size-changed", G_CALLBACK (xfce_mixer_plugin_size_changed), mixer_plugin);
@@ -231,6 +234,9 @@ xfce_mixer_plugin_size_changed (XfceMixerPlugin *mixer_plugin,
 {
   g_return_val_if_fail (mixer_plugin != NULL, FALSE);
 
+  /* The plugin only occupies a single row */
+  size /= xfce_panel_plugin_get_nrows (XFCE_PANEL_PLUGIN (mixer_plugin));
+
   /* Determine size for the volume button icons */
   size -= 2 + 2 * MAX (mixer_plugin->button->style->xthickness, mixer_plugin->button->style->ythickness);
 
diff --git a/panel-plugin/xfce-volume-button.c b/panel-plugin/xfce-volume-button.c
index cc9bfed..adb94a7 100644
--- a/panel-plugin/xfce-volume-button.c
+++ b/panel-plugin/xfce-volume-button.c
@@ -38,6 +38,10 @@
 
 
 
+#define VOLUME_EPSILON 0.005
+
+
+
 /* Signal identifiers */
 enum
 {
@@ -415,7 +419,7 @@ xfce_volume_button_update (XfceVolumeButton *button)
   /* Determine the difference between upper and lower bound (= volume range) */
   range = (upper - lower) / (G_N_ELEMENTS (icons) - 2);
 
-  if (G_UNLIKELY (button->is_muted || value < 0.005))
+  if (G_UNLIKELY (button->is_muted || value < VOLUME_EPSILON))
     {
       /* By definition, use the first icon if the button is muted or the volume is 0 */
       pixbuf = button->pixbufs[0];


More information about the Xfce4-commits mailing list