[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Added extra checks

noreply at xfce.org noreply at xfce.org
Sat Mar 7 01:44:32 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 d84fbe60cb53981b1a7701ab010f4ee8da7d5a0c
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Sat Mar 7 00:44:21 2015 +0000

    Added extra checks
---
 panel-plugin/pulseaudio-button.c |   12 ++++++++----
 panel-plugin/pulseaudio-menu.c   |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index 0e8a81f..631b3ea 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -139,7 +139,7 @@ pulseaudio_button_init (PulseaudioButton *button)
   /* Preload icons */
   button->pixbuf_idx = 0;
   button->pixbufs = g_new0 (GdkPixbuf*, G_N_ELEMENTS (icons)-1);
-  g_signal_connect (G_OBJECT (button), "style_updated", G_CALLBACK (pulseaudio_button_update_icons), button); 
+  g_signal_connect (G_OBJECT (button), "style-updated", G_CALLBACK (pulseaudio_button_update_icons), button);
 
   /* Setup Gtk style */
   css_provider = gtk_css_provider_new ();
@@ -163,8 +163,6 @@ pulseaudio_button_init (PulseaudioButton *button)
 
   g_object_set (G_OBJECT (button), "has-tooltip", TRUE, NULL);
 
-  pulseaudio_button_update (button, TRUE);
-
   //button->align_box = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
   //gtk_container_add (GTK_CONTAINER (button), button->align_box);
   //gtk_widget_show (button->align_box);
@@ -299,6 +297,7 @@ pulseaudio_button_update (PulseaudioButton *button,
   gchar    *tip_text;
 
   g_return_if_fail (IS_PULSEAUDIO_BUTTON (button));
+  g_return_if_fail (IS_PULSEAUDIO_VOLUME (button->volume));
 
   volume = pulseaudio_volume_get_volume (button->volume);
   muted = pulseaudio_volume_get_muted (button->volume);
@@ -338,6 +337,7 @@ pulseaudio_button_set_size (PulseaudioButton *button,
   gint              width;
   gint              xthickness;
   gint              ythickness;
+  gint              size_old;
 
   g_return_if_fail (IS_PULSEAUDIO_BUTTON (button));
   g_return_if_fail (size > 0);
@@ -352,6 +352,7 @@ pulseaudio_button_set_size (PulseaudioButton *button,
   width = size - 2* MAX (xthickness, ythickness);
   /* Since symbolic icons are usually only provided in 16px we
    * try to be clever and use size steps */
+  size_old = button->icon_size;
   if (width <= 21)
       button->icon_size = 16;
   else if (width >=22 && width <= 29)
@@ -362,7 +363,8 @@ pulseaudio_button_set_size (PulseaudioButton *button,
       button->icon_size = width;
 
   gtk_widget_set_size_request (GTK_WIDGET (button), size, size);
-  pulseaudio_button_update_icons (button);
+  if (button->icon_size != size_old)
+    pulseaudio_button_update_icons (button);
 }
 
 
@@ -398,6 +400,8 @@ pulseaudio_button_new (PulseaudioPlugin *plugin,
     g_signal_connect_swapped (G_OBJECT (button->volume), "volume-changed",
                               G_CALLBACK (pulseaudio_button_volume_changed), button);
 
+  pulseaudio_button_update (button, TRUE);
+
   return GTK_WIDGET (button);
 }
 
diff --git a/panel-plugin/pulseaudio-menu.c b/panel-plugin/pulseaudio-menu.c
index fc4ebe5..6ff462c 100644
--- a/panel-plugin/pulseaudio-menu.c
+++ b/panel-plugin/pulseaudio-menu.c
@@ -175,6 +175,7 @@ pulseaudio_menu_volume_changed (PulseaudioMenu   *menu,
                                 PulseaudioVolume *volume)
 {
   g_return_if_fail (IS_PULSEAUDIO_MENU (menu));
+  g_return_if_fail (IS_PULSEAUDIO_VOLUME (volume));
 
   g_signal_handlers_block_by_func (G_OBJECT (menu->mute_output_item),
                                    pulseaudio_menu_mute_output_item_toggled,

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


More information about the Xfce4-commits mailing list