Index: src/bacon-volume.c
===================================================================
RCS file: /cvs/gnome/totem/src/bacon-volume.c,v
retrieving revision 1.16
diff -p -u -B -r1.16 bacon-volume.c
--- src/bacon-volume.c	2 Nov 2006 16:06:42 -0000	1.16
+++ src/bacon-volume.c	3 Nov 2006 14:38:24 -0000
@@ -48,6 +48,10 @@ static gboolean	bacon_volume_button_pres
 						 GdkEventButton * event);
 static gboolean bacon_volume_key_release	(GtkWidget      * widget,
     						 GdkEventKey    * event);
+#ifndef HAVE_GTK_ONLY
+static void bacon_volume_button_style_set	(GtkWidget *widget,
+						 GtkStyle *previous_style);
+#endif
 static gboolean cb_dock_button_press		(GtkWidget      * widget,
 						 GdkEventButton * event,
 						 gpointer         data);
@@ -64,14 +68,10 @@ static gboolean cb_button_press			(GtkWi
 static gboolean cb_button_release		(GtkWidget      * widget,
 						 GdkEventButton * event,
 						 gpointer         data);
+static void     bacon_volume_button_update_icon (BaconVolumeButton *button);
 static void	bacon_volume_scale_value_changed(GtkRange       * range);
 #ifndef HAVE_GTK_ONLY
-static void	bacon_volume_button_realize	(GtkWidget	*widget,
-    						 BaconVolumeButton *button);
-static void	bacon_volume_theme_changed	(GtkIconTheme	* theme,
-						 gpointer         data);
-static void	bacon_volume_load_icons		(BaconVolumeButton * button,
-						 GtkIconTheme      * theme);
+static void	bacon_volume_button_load_icons	(GtkWidget      * widget);
 #endif
 
 /* see below for scale definitions */
@@ -116,13 +116,16 @@ bacon_volume_button_class_init (BaconVol
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
 
-  parent_class = g_type_class_ref (GTK_TYPE_BUTTON);
+  parent_class = g_type_class_peek_parent (klass);
 
   /* events */
   gobject_class->dispose = bacon_volume_button_dispose;
   gtkwidget_class->button_press_event = bacon_volume_button_press;
   gtkwidget_class->key_release_event = bacon_volume_key_release;
   gtkwidget_class->scroll_event = bacon_volume_button_scroll;
+#ifndef HAVE_GTK_ONLY
+  gtkwidget_class->style_set = bacon_volume_button_style_set;
+#endif
 
   /* signals */
   signals[SIGNAL_VALUE_CHANGED] = g_signal_new ("value-changed",
@@ -183,9 +186,6 @@ bacon_volume_button_new (GtkIconSize siz
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
 
-  g_signal_connect (G_OBJECT (button), "realize",
-      		    G_CALLBACK (bacon_volume_button_realize), button);
-
 #ifndef HAVE_GTK_ONLY
   /* image */
   button->image = gtk_image_new ();
@@ -239,8 +239,10 @@ bacon_volume_button_new (GtkIconSize siz
 		    G_CALLBACK (cb_button_release), button);
   gtk_box_pack_start (GTK_BOX (box), button->min, TRUE, FALSE, 0);
 
-  /* call callback once so original icon is drawn */
-  bacon_volume_scale_value_changed (GTK_RANGE (button->scale));
+#ifdef HAVE_GTK_ONLY
+  /* set button text */
+  bacon_volume_button_update_icon (button);
+#endif
 
   return GTK_WIDGET (button);
 }
@@ -268,15 +270,12 @@ bacon_volume_button_set_value (BaconVolu
 
 #ifndef HAVE_GTK_ONLY
 static void
-bacon_volume_button_realize (GtkWidget *widget, BaconVolumeButton *button)
+bacon_volume_button_style_set (GtkWidget *widget,
+			       GtkStyle *previous_style)
 {
-  GtkIconTheme *theme;
-  GdkScreen *screen;
+  GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
 
-  screen = gtk_widget_get_screen (widget);
-  theme = gtk_icon_theme_get_for_screen (screen);
-  g_signal_connect (G_OBJECT (theme), "changed",
-		    G_CALLBACK (bacon_volume_theme_changed), button);
+  bacon_volume_button_load_icons (widget);
 }
 #endif
 
@@ -670,7 +669,7 @@ bacon_volume_scale_class_init (GtkVScale
   GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
   GtkRangeClass *gtkrange_class = GTK_RANGE_CLASS (klass);
 
-  scale_parent_class = g_type_class_ref (GTK_TYPE_VSCALE);
+  scale_parent_class = g_type_class_peek_parent (klass);
 
   gtkwidget_class->button_press_event = bacon_volume_scale_press;
   gtkwidget_class->button_release_event = bacon_volume_scale_release;
@@ -737,25 +736,24 @@ bacon_volume_scale_release (GtkWidget   
 }
 
 static void
-bacon_volume_scale_value_changed (GtkRange * range)
+bacon_volume_button_update_icon (BaconVolumeButton *button)
 {
-  BaconVolumeScale *scale = BACON_VOLUME_SCALE (range);
-  BaconVolumeButton *button = scale->button;
-  GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (button->scale));
-  float step = (adj->upper - adj->lower) / 4;
+  GtkRange *range = GTK_RANGE (button->scale);
   float val = gtk_range_get_value (range);
 #ifdef HAVE_GTK_ONLY
   char *s;
 
   /* update label */
-  s = g_strdup_printf ("%d", lrintf (val));
+  s = g_strdup_printf ("%ld", lrintf (val));
   gtk_button_set_label (GTK_BUTTON (button), s);
   g_free (s);
 #else
+  GtkAdjustment *adj;
   GdkPixbuf *pixbuf;
+  float step;
 
-  if (button->icon[0] == NULL)
-    bacon_volume_load_icons (button, NULL);
+  adj = gtk_range_get_adjustment (range);
+  step = (adj->upper - adj->lower) / 4;
 
   if (val == adj->lower)
     pixbuf = button->icon[0];
@@ -766,9 +764,17 @@ bacon_volume_scale_value_changed (GtkRan
   else
     pixbuf = button->icon[3];
 
-  /* update image */
   gtk_image_set_from_pixbuf (GTK_IMAGE (button->image), pixbuf);
 #endif
+}
+
+static void
+bacon_volume_scale_value_changed (GtkRange * range)
+{
+  BaconVolumeScale *scale = BACON_VOLUME_SCALE (range);
+  BaconVolumeButton *button = scale->button;
+
+  bacon_volume_button_update_icon (button);
 
   /* signal */
   g_signal_emit (button, signals[SIGNAL_VALUE_CHANGED], 0);
@@ -776,43 +782,36 @@ bacon_volume_scale_value_changed (GtkRan
  
 #ifndef HAVE_GTK_ONLY
 static void
-bacon_volume_theme_changed (GtkIconTheme * theme,
-			    gpointer       data)
-{
-  BaconVolumeButton *button = BACON_VOLUME_BUTTON (data);
-
-  bacon_volume_load_icons (button, theme);
-  bacon_volume_scale_value_changed (GTK_RANGE (button->scale));
-}
-
-static void
-bacon_volume_load_icons	(BaconVolumeButton * button,
-			 GtkIconTheme      * _theme)
+bacon_volume_button_load_icons (GtkWidget *widget)
 {
+  BaconVolumeButton *button = BACON_VOLUME_BUTTON (widget);
   guint i;
   gint w, h;
+  GdkScreen *screen;
   GtkIconTheme *theme;
   const char *icon_name[] = {"audio-volume-muted", "audio-volume-low",
     "audio-volume-medium", "audio-volume-high"};
 
-  if (_theme != NULL) {
-    theme = _theme;
-  } else {
-    GdkScreen *screen;
-
-    screen = gtk_widget_get_screen (GTK_WIDGET (button));
-    theme = gtk_icon_theme_get_for_screen (screen);
-  }
+  screen = gtk_widget_get_screen (widget);
+  theme = gtk_icon_theme_get_for_screen (screen);
 
   gtk_icon_size_lookup (button->size, &w, &h);
 
   for (i = 0; i < 4; i++) {
+    GError *error = NULL;
     if (button->icon[i] != NULL) {
       g_object_unref (button->icon[i]);
       button->icon[i] = NULL;
     }
-    button->icon[i] = gtk_icon_theme_load_icon (theme, icon_name[i], w, 0, NULL);
+    button->icon[i] = gtk_icon_theme_load_icon (theme, icon_name[i], w, 0, &error);
+    if (error) {
+      g_print ("Couldn't load themed icon '%s': %s\n", icon_name[i], error->message);
+      g_error_free (error);
+    }
   }
+
+  /* Apply the new icons */
+  bacon_volume_button_update_icon (button);
 }
 #endif
 
Index: src/bacon-volume.h
===================================================================
RCS file: /cvs/gnome/totem/src/bacon-volume.h,v
retrieving revision 1.5
diff -p -u -B -r1.5 bacon-volume.h
--- src/bacon-volume.h	1 Nov 2006 10:23:09 -0000	1.5
+++ src/bacon-volume.h	3 Nov 2006 14:38:24 -0000
@@ -40,9 +40,9 @@ typedef struct _BaconVolumeButton {
   GtkIconSize size;
   gint click_id;
   float direction;
-  gboolean timeout;
   guint32 pop_time;
   GdkPixbuf *icon[4];
+  guint timeout : 1;
 } BaconVolumeButton;
 
 typedef struct _BaconVolumeButtonClass {
