Package: gnome-applets
Version: 2.18.0-3
Severity: normal

Hi,

mixer_applet2 wakes up every 200ms or so to check the volume, possibly
reducing laptop battery life. The included patch (which depends on
gstreamer support, filed as a separate bug) fixes this. It's taken from
the Ubuntu patch set, but AFAIK it's taken from upstream Bugzilla, in
turn written by the PowerTOP people.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-rc1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=nb_NO.UTF-8, LC_CTYPE=nb_NO.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gnome-applets depends on:
ii  debconf [debconf-2.0]      1.5.13        Debian configuration management sy
ii  gconf2                     2.18.0.1-3    GNOME configuration database syste
ii  gnome-applets-data         2.18.0-3      Various applets for GNOME 2 panel 
ii  gnome-icon-theme           2.18.0-2      GNOME Desktop icon theme
ii  gnome-panel                2.18.1-1+b1   launcher and docking facility for 
ii  gstreamer0.10-alsa         0.10.12-2     GStreamer plugin for ALSA
ii  gstreamer0.10-plugins-good 0.10.5-5      GStreamer plugins from the "good" 
ii  libapm1                    3.2.2-8.1     Library for interacting with APM d
ii  libatk1.0-0                1.18.0-2      The ATK accessibility toolkit
ii  libbonoboui2-0             2.18.0-5      The Bonobo UI library
ii  libc6                      2.5-7         GNU C Library: Shared libraries
ii  libcairo2                  1.4.6-1       The Cairo 2D vector graphics libra
ii  libcpufreq0                002-2         shared library to deal with the cp
ii  libdbus-1-3                1.0.2-5       simple interprocess messaging syst
ii  libdbus-glib-1-2           0.73-2        simple interprocess messaging syst
ii  libfontconfig1             2.4.2-1.2     generic font configuration library
ii  libgconf2-4                2.18.0.1-3    GNOME configuration database syste
ii  libglade2-0                1:2.6.0-4     library to load .glade files at ru
ii  libglib2.0-0               2.12.12-1     The GLib library of C routines
ii  libgnome-desktop-2         2.18.1-1      Utility library for loading .deskt
ii  libgnome2-0                2.18.0-4      The GNOME 2 library - runtime file
ii  libgnomekbd1               2.18.1-2      GNOME library to manage keyboard c
ii  libgnomekbdui1             2.18.1-2      User interface library for libgnom
ii  libgnomeui-0               2.18.1-2      The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0             1:2.18.1-2    GNOME Virtual File System (runtime
ii  libgstreamer-plugins-base0 0.10.12-2     GStreamer libraries from the "base
ii  libgstreamer0.10-0         0.10.12-5     Core GStreamer libraries and eleme
ii  libgtk2.0-0                2.10.12-1     The GTK+ graphical user interface 
ii  libgtop2-7                 2.14.8-2      gtop system monitoring library
ii  libgucharmap6              1:1.10.0-2    Unicode browser widget library (sh
ii  libhal1                    0.5.9-2       Hardware Abstraction Layer - share
ii  libnotify1 [libnotify1-gtk 0.4.4-3       sends desktop notifications to a n
ii  liborbit2                  1:2.14.7-0.1  libraries for ORBit2 - a CORBA ORB
ii  libpanel-applet2-0         2.18.1-1+b1   library for GNOME 2 panel applets
ii  libpango1.0-0              1.16.4-1      Layout and rendering of internatio
ii  libwnck18                  2.18.0-2      Window Navigator Construction Kit 
ii  libx11-6                   2:1.0.3-7     X11 client-side library
ii  libxcursor1                1:1.1.8-2     X cursor management library
ii  libxext6                   1:1.0.3-2     X11 miscellaneous extension librar
ii  libxfixes3                 1:4.0.3-2     X11 miscellaneous 'fixes' extensio
ii  libxi6                     1:1.0.1-4     X11 Input extension library
ii  libxinerama1               1:1.0.2-1     X11 Xinerama extension library
ii  libxklavier11              3.2-2         X Keyboard Extension high-level AP
ii  libxml2                    2.6.28.dfsg-1 GNOME XML library
ii  libxrandr2                 2:1.2.1-1     X11 RandR extension library
ii  libxrender1                1:0.9.2-1     X Rendering Extension client libra
ii  python                     2.4.4-4       An interactive high-level object-o

Versions of packages gnome-applets recommends:
ii  deskbar-applet         2.14.2-4.2        universal search and navigation ba
ii  gnome-media            2.18.0-2+b1       GNOME media utilities
ii  gnome-netstatus-applet 2.12.1-1          Network status applet for GNOME 2
ii  gnome-system-monitor   2.16.1-1          Process viewer and system resource
ii  imagemagick            7:6.2.4.5.dfsg1-1 Image manipulation programs
ii  libgnomevfs2-extra     1:2.18.1-2        GNOME Virtual File System (extra m
pn  tomboy                 <none>            (no description available)

-- debconf information excluded
diff --git a/mixer/applet.c b/mixer/applet.c
index 3d74f36..70456a1 100644
--- a/mixer/applet.c
+++ b/mixer/applet.c
@@ -81,7 +81,6 @@ static void	gnome_volume_applet_orientation	(PanelApplet *applet,
 
 static void	gnome_volume_applet_refresh	(GnomeVolumeApplet *applet,
 						 gboolean           force_refresh);
-static gboolean	cb_check			(gpointer   data);
 
 static void	cb_volume			(GtkAdjustment *adj,
 						 gpointer   data);
@@ -375,6 +374,24 @@ select_element_and_track (GnomeVolumeApplet *applet,
   return TRUE;
 }
 
+static void
+cb_mixer_mute_toggled (GstMixerTrack *track, gboolean mute, gpointer data)
+{
+  GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (data);
+
+  g_warning ("mute toggled");
+  gnome_volume_applet_refresh (applet, TRUE);
+}
+
+static void
+cb_mixer_volume_changed (GstMixerTrack *track, gpointer volumes, gpointer data)
+{
+  GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (data);
+
+  g_warning ("volume changed");
+  gnome_volume_applet_refresh (applet, TRUE);
+}
+
 gboolean
 gnome_volume_applet_setup (GnomeVolumeApplet *applet,
 			   GList *elements)
@@ -438,9 +455,12 @@ gnome_volume_applet_setup (GnomeVolumeApplet *applet,
 
   gnome_volume_applet_refresh (applet, TRUE);
   if (res) {
-    applet->timeout = g_timeout_add (100, cb_check, applet);
+    GList *l;
+    for (l = applet->tracks; l; l = l->next) {
+      g_signal_connect (G_OBJECT (l->data),"volume_changed", G_CALLBACK (cb_mixer_volume_changed), applet);
+      g_signal_connect (G_OBJECT (l->data),"mute_toggled", G_CALLBACK (cb_mixer_mute_toggled), applet);
+    }
   }
-
   if (res) {
     /* gconf */
     key = panel_applet_gconf_get_full_key (PANEL_APPLET (applet),
@@ -1154,14 +1174,6 @@ gnome_volume_applet_refresh (GnomeVolumeApplet *applet,
 				"state", mute ? "1" : "0", NULL);
 }
 
-static gboolean
-cb_check (gpointer data)
-{
-  gnome_volume_applet_refresh (GNOME_VOLUME_APPLET (data), FALSE);
-
-  return TRUE;
-}
-
 /*
  * GConf callback.
  */

Reply via email to