rpms/gnome-applets/devel mixer-wakeups.patch, NONE, 1.1 gnome-applets.spec, 1.235, 1.236

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Mon Aug 13 03:24:35 UTC 2007


Author: mclasen

Update of /cvs/extras/rpms/gnome-applets/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26252

Modified Files:
	gnome-applets.spec 
Added Files:
	mixer-wakeups.patch 
Log Message:
Add a patch to stop the mixer applet from causing frequent wakeups


mixer-wakeups.patch:

--- NEW FILE mixer-wakeups.patch ---
diff -up gnome-applets-2.19.1/mixer/applet.c.wakeups gnome-applets-2.19.1/mixer/applet.c
--- gnome-applets-2.19.1/mixer/applet.c.wakeups	2007-08-12 23:00:22.000000000 -0400
+++ gnome-applets-2.19.1/mixer/applet.c	2007-08-12 23:00:29.000000000 -0400
@@ -80,6 +80,11 @@ static void	gnome_volume_applet_orientat
 
 static void	gnome_volume_applet_refresh	(GnomeVolumeApplet *applet,
 						 gboolean           force_refresh);
+
+#ifdef HAVE_GST_MIXER_NOTIFIES
+static void     cb_notify_message (GstBus *bus, GstMessage *message, gpointer data);
+#endif
+
 static gboolean	cb_check			(gpointer   data);
 
 static void	cb_volume			(GtkAdjustment *adj,
@@ -242,6 +247,14 @@ gnome_volume_applet_init (GnomeVolumeApp
   /* i18n */
   ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
   atk_object_set_name (ao, _("Volume Control"));
+
+  /* Bus for notifications */
+#ifdef HAVE_GST_MIXER_NOTIFIES
+  applet->bus = gst_bus_new ();
+  gst_bus_add_signal_watch (applet->bus);
+  g_signal_connect (G_OBJECT (applet->bus), "message::element", 
+       (GCallback) cb_notify_message, applet);
+#endif
 }
 
 /* Parse the list of tracks that are stored in GConf */
@@ -368,12 +381,37 @@ select_element_and_track (GnomeVolumeApp
     return FALSE;
 
   applet->mixer = g_object_ref (active_element);
+#ifdef HAVE_GST_MIXER_NOTIFIES
+  gst_element_set_bus (GST_ELEMENT (applet->mixer), applet->bus);
+#endif
   applet->tracks = active_tracks;
   g_list_foreach (applet->tracks, (GFunc) g_object_ref, NULL);
 
   return TRUE;
 }
 
+static void
+gnome_volume_applet_setup_timeout (GnomeVolumeApplet *applet)
+{
+  gboolean need_timeout = TRUE;
+#ifdef HAVE_GST_MIXER_NOTIFIES
+  need_timeout = ((gst_mixer_get_mixer_flags (GST_MIXER (applet->mixer)) &
+      GST_MIXER_FLAG_AUTO_NOTIFICATIONS) == 0);
+#endif
+
+  if (need_timeout) {
+    if (applet->timeout == 0) {
+      applet->timeout = g_timeout_add (100, cb_check, applet);
+    }
+  }
+  else {
+    if (applet->timeout != 0) {
+      g_source_remove (applet->timeout);
+      applet->timeout = 0;
+    }
+  }
+}
+
 gboolean
 gnome_volume_applet_setup (GnomeVolumeApplet *applet,
 			   GList *elements)
@@ -436,9 +474,8 @@ gnome_volume_applet_setup (GnomeVolumeAp
   g_signal_connect (component, "ui-event", G_CALLBACK (cb_ui_event), applet);
 
   gnome_volume_applet_refresh (applet, TRUE);
-  if (res) {
-    applet->timeout = g_timeout_add (100, cb_check, applet);
-  }
+  if (res)
+    gnome_volume_applet_setup_timeout (applet);
 
   if (res) {
     /* gconf */
@@ -479,6 +516,13 @@ gnome_volume_applet_dispose (GObject *ob
     g_list_free (applet->elements);
     applet->elements = NULL;
   }
+#ifdef HAVE_GST_MIXER_NOTIFIES
+  gst_bus_remove_signal_watch (applet->bus);
+  if (applet->bus) {
+    gst_object_unref (applet->bus);
+    applet->bus = NULL;
+  }
+#endif
 
   if (applet->tracks) {
     g_list_foreach (applet->tracks, (GFunc) g_object_unref, NULL);
@@ -1152,6 +1196,38 @@ gnome_volume_applet_refresh (GnomeVolume
 				"state", mute ? "1" : "0", NULL);
 }
 
+#ifdef HAVE_GST_MIXER_NOTIFIES
+static void
+cb_notify_message (GstBus *bus, GstMessage *message, gpointer data)
+{
+  GnomeVolumeApplet *applet = GNOME_VOLUME_APPLET (data);
+  GstMixerMessageType type;
+  GstMixerTrack *first_track;
+  GstMixerTrack *track = NULL;
+
+  if (applet->tracks == NULL || 
+      GST_MESSAGE_SRC (message) != GST_OBJECT (applet->mixer)) {
+    /* No tracks, or not from our mixer - can't update anything anyway */
+    return; 
+  }
+
+  first_track = g_list_first (applet->tracks)->data;
+
+  /* This code only calls refresh if the first_track changes, because the
+   * refresh code only retrieves the current value from that track anyway */
+  type = gst_mixer_message_get_type (message);
+  if (type == GST_MIXER_MESSAGE_MUTE_TOGGLED) {
+    gst_mixer_message_parse_mute_toggled (message, &track, NULL);
+  }
+  else { 
+    gst_mixer_message_parse_volume_changed (message, &track, NULL, NULL);
+  }
+
+  if (first_track == track)
+    gnome_volume_applet_refresh (GNOME_VOLUME_APPLET (data), FALSE);
+}
+#endif
+
 static gboolean
 cb_check (gpointer data)
 {
@@ -1214,6 +1290,8 @@ cb_gconf (GConfClient *client,
             /* save */
             gst_object_replace ((GstObject **) &applet->mixer, item->data);
             gst_element_set_state (old_element, GST_STATE_NULL);
+
+            gnome_volume_applet_setup_timeout (applet);
             newdevice = TRUE;
           }
           break;
diff -up gnome-applets-2.19.1/mixer/applet.h.wakeups gnome-applets-2.19.1/mixer/applet.h
--- gnome-applets-2.19.1/mixer/applet.h.wakeups	2007-08-12 23:00:17.000000000 -0400
+++ gnome-applets-2.19.1/mixer/applet.h	2007-08-12 23:00:29.000000000 -0400
@@ -71,6 +71,7 @@ typedef struct _GnomeVolumeApplet {
 
   /* element */
   GstMixer *mixer;
+  GstBus *bus;
   gboolean lock;
   gint state;
   GList *tracks;
diff -up gnome-applets-2.19.1/configure.in.wakeups gnome-applets-2.19.1/configure.in
--- gnome-applets-2.19.1/configure.in.wakeups	2007-08-12 23:03:29.000000000 -0400
+++ gnome-applets-2.19.1/configure.in	2007-08-12 23:03:55.000000000 -0400
@@ -479,11 +479,22 @@ esac
 
 AM_CONDITIONAL(APPLET_MIXER, test "x$HAVE_GST" = "xyes")
 AM_CONDITIONAL(HAVE_GST10, test "x$HAVE_GST_VER" = "x0.10")
+
+HAVE_GST_MIXER_NOTIFIES=no
 if test "x$HAVE_GST_VER" = "x0.10" ; then
 	AC_DEFINE(HAVE_GST10, 1, [Using Gstreamer 0.10])
 	# these don't seem to come from any pkg-config file
 	MIXER_LIBS="$MIXER_LIBS -lgstinterfaces-0.10 -lgstaudio-0.10"
+
+        PKG_CHECK_MODULES(GST_MIXER_NOTIFICATIONS,
+            gstreamer-plugins-base-0.10 >= 0.10.13.1, 
+            HAVE_GST_MIXER_NOTIFIES=yes, HAVE_GST_MIXER_NOTIFIES=no)
+        if test "x$HAVE_GST_MIXER_NOTIFIES" = "xyes"; then
+          AC_DEFINE(HAVE_GST_MIXER_NOTIFIES, 1, 
+              [Have GStreamer mixer notification API])
+        fi
 fi
+AM_CONDITIONAL(HAVE_GST_MIXER_NOTIFIES, test "x$HAVE_GST_MIXER_NOTIFIES" = "xyes")
 
 AC_SUBST(MIXER_CFLAGS)
 AC_SUBST(MIXER_LIBS)
@@ -766,6 +777,7 @@ gnome-applets-$VERSION configure summary
 	 - invest-applet		$BUILD_INVEST_APPLET
 	 - mini-commander		$enable_mini_commander
 	 - mixer			$HAVE_GST
+	        - mixer	notifications	$HAVE_GST_MIXER_NOTIFIES
 	 - modemlights			$BUILD_MODEM_LIGHTS
 	 - multiload			$build_gtop_applets
 	 - stickynotes			$enable_stickynotes


Index: gnome-applets.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-applets/devel/gnome-applets.spec,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -r1.235 -r1.236
--- gnome-applets.spec	6 Aug 2007 04:14:52 -0000	1.235
+++ gnome-applets.spec	13 Aug 2007 03:24:02 -0000	1.236
@@ -9,8 +9,9 @@
 %define libgtop2_version 2.12.0
 %define gail_version 1.2.0
 %define libbonoboui_version 2.3.0
-%define gstreamer_plugins_version 0.10
-%define gstreamer_version 0.10
+%define gstreamer_version 0.10.14
+%define gstreamer_plugins_version 0.10.14
+%define gstreamer_plugins_good_version 0.10.6
 %define libxklavier_version 2.91
 %define libwnck_version 2.9.3
 %define libgnome_desktop_version 2.11.1
@@ -33,7 +34,7 @@
 Summary:        Small applications for the GNOME panel
 Name:		gnome-applets
 Version:	2.19.1
-Release: 	5%{?dist}
+Release: 	6%{?dist}
 Epoch:          1
 License:	GPLv2+ and GFDL+
 Group:          User Interface/Desktops
@@ -56,6 +57,9 @@
 # http://bugzilla.gnome.org/show_bug.cgi?id=428072
 Patch33:	gnome-applets-2.18.0-node-leak.patch
 
+# http://bugzilla.gnome.org/show_bug.cgi?id=370937
+Patch34:	mixer-wakeups.patch
+
 BuildRequires:  glib2-devel >= %{glib2_version}
 BuildRequires:  gtk2-devel >= %{gtk2_version}
 BuildRequires:  libgnomeui-devel >= %{libgnomeui_version}
@@ -69,7 +73,7 @@
 BuildRequires:  libxklavier-devel >= %{libxklavier_version}
 BuildRequires:  gstreamer-devel >= %{gstreamer_version}
 BuildRequires:  gstreamer-plugins-base-devel >= %{gstreamer_plugins_version}
-BuildRequires:  gstreamer-plugins-good-devel >= %{gstreamer_plugins_version}
+BuildRequires:  gstreamer-plugins-good-devel >= %{gstreamer_plugins_good_version}
 BuildRequires:  /usr/bin/automake
 BuildRequires:  libbonoboui-devel >= %{libbonoboui_version}
 BuildRequires:  libwnck-devel >= %{libwnck_version}
@@ -152,6 +156,7 @@
 %patch30 -p1 -b .fix-null-applet
 %patch31 -p1 -b .fix-find
 %patch33 -p1 -b .node-leak
+%patch34 -p1 -b .mixer-wakeups
 
 cp gswitchit/gswitchit-applet.png  gswitchit/gswitchit-properties-capplet.png
 
@@ -329,6 +334,9 @@
 %{_libdir}/libgweather.so
 
 %changelog
+* Sun Aug 12 2007 Matthias Clasen <mclasen at redhat.com> - 1:2.19.1-6
+- Stop the mixer applet from polling the volume
+
 * Sun Aug  5 2007 Matthias Clasen <mclasen at redhat.com> - 1:2.19.1-5
 - Use %%find_lang for help files, too
 - Update the license field




More information about the scm-commits mailing list