[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/02: Use symbolic icons in the panel

noreply at xfce.org noreply at xfce.org
Thu Mar 5 00:02:08 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 314286b6f7da37472dcc69adfe64b66c07d580ec
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Mar 4 23:43:54 2015 +0100

    Use symbolic icons in the panel
---
 panel-plugin/pulseaudio-button.c |   24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index f69d5a2..7fea918 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -52,10 +52,10 @@
 
 /* Icons for different volume levels */
 static const char *icons[] = {
-  "audio-volume-muted",
-  "audio-volume-low",
-  "audio-volume-medium",
-  "audio-volume-high",
+  "audio-volume-muted-symbolic",
+  "audio-volume-low-symbolic",
+  "audio-volume-medium-symbolic",
+  "audio-volume-high-symbolic",
   NULL
 };
 
@@ -138,7 +138,7 @@ pulseaudio_button_init (PulseaudioButton *button)
   /* Preload icons */
   button->pixbuf_idx = 0;
   button->pixbufs = g_new0 (GdkPixbuf*, G_N_ELEMENTS (icons)-1);
-  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 ();
@@ -266,24 +266,22 @@ pulseaudio_button_menu_deactivate (PulseaudioButton *button,
 static void
 pulseaudio_button_update_icons (PulseaudioButton *button)
 {
-  GtkIconTheme   *icon_theme;
   guint           i;
+  GtkIconInfo    *info;
+  GtkStyleContext *context;
+  gboolean is_symbolic;
 
   g_return_if_fail (IS_PULSEAUDIO_BUTTON (button));
 
-  icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (button)));
+  context = GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (gtk_widget_get_parent (GTK_WIDGET (button)))));
 
   /* Pre-load all icons */
   for (i = 0; i < G_N_ELEMENTS (icons)-1; ++i)
     {
       if (GDK_IS_PIXBUF (button->pixbufs[i]))
         g_object_unref (G_OBJECT (button->pixbufs[i]));
-
-      button->pixbufs[i] = gtk_icon_theme_load_icon (icon_theme,
-                                                     icons[i],
-                                                     button->icon_size,
-                                                     GTK_ICON_LOOKUP_USE_BUILTIN,
-                                                     NULL);
+        info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), icons[i], button->icon_size, GTK_ICON_LOOKUP_USE_BUILTIN);
+        button->pixbufs[i] = gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL);
     }
 
   /* Update the state of the button */

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


More information about the Xfce4-commits mailing list