r12520 - in /desktop/unstable/gnome-applets/debian: changelog patches/80_mixer_user_gstreamer_signals.patch
slomo at users.alioth.debian.org
slomo at users.alioth.debian.org
Mon Sep 17 11:41:08 UTC 2007
Author: slomo
Date: Mon Sep 17 11:41:08 2007
New Revision: 12520
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=12520
Log:
* debian/patches/80_mixer_user_gstreamer_signals.patch:
+ Patch from Ubuntu/Bugzilla (#370937). Use signals to get notified about
mixer changes instead of polling (Closes: #424015).
Added:
desktop/unstable/gnome-applets/debian/patches/80_mixer_user_gstreamer_signals.patch
Modified:
desktop/unstable/gnome-applets/debian/changelog
Modified: desktop/unstable/gnome-applets/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-applets/debian/changelog?rev=12520&op=diff
==============================================================================
--- desktop/unstable/gnome-applets/debian/changelog (original)
+++ desktop/unstable/gnome-applets/debian/changelog Mon Sep 17 11:41:08 2007
@@ -32,6 +32,9 @@
- Updated.
+ debian/patches/10_colourado-l10n.patch:
- Dropped, merged upstream.
+ * debian/patches/80_mixer_user_gstreamer_signals.patch:
+ + Patch from Ubuntu/Bugzilla (#370937). Use signals to get notified about
+ mixer changes instead of polling (Closes: #424015).
-- Sebastian Dröge <slomo at debian.org> Mon, 17 Sep 2007 11:02:06 +0200
Added: desktop/unstable/gnome-applets/debian/patches/80_mixer_user_gstreamer_signals.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-applets/debian/patches/80_mixer_user_gstreamer_signals.patch?rev=12520&op=file
==============================================================================
--- desktop/unstable/gnome-applets/debian/patches/80_mixer_user_gstreamer_signals.patch (added)
+++ desktop/unstable/gnome-applets/debian/patches/80_mixer_user_gstreamer_signals.patch Mon Sep 17 11:41:08 2007
@@ -1,0 +1,150 @@
+diff -ur gnome-applets-2.19.1/mixer/applet.c gnome-applets-2.19.1.new/mixer/applet.c
+--- gnome-applets-2.19.1/mixer/applet.c 2007-07-28 03:02:35.000000000 +0100
++++ gnome-applets-2.19.1.new/mixer/applet.c 2007-08-30 20:36:22.000000000 +0100
+@@ -80,6 +80,9 @@
+
+ static void gnome_volume_applet_refresh (GnomeVolumeApplet *applet,
+ gboolean force_refresh);
++
++static void cb_notify_message (GstBus *bus, GstMessage *message, gpointer data);
++
+ static gboolean cb_check (gpointer data);
+
+ static void cb_volume (GtkAdjustment *adj,
+@@ -242,6 +245,12 @@
+ /* i18n */
+ ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
+ atk_object_set_name (ao, _("Volume Control"));
++
++ /* Bus for notifications */
++ 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);
+ }
+
+ /* Parse the list of tracks that are stored in GConf */
+@@ -368,12 +377,33 @@
+ return FALSE;
+
+ applet->mixer = g_object_ref (active_element);
++ gst_element_set_bus (GST_ELEMENT (applet->mixer), applet->bus);
+ 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;
++ need_timeout = ((gst_mixer_get_mixer_flags (GST_MIXER (applet->mixer)) &
++ GST_MIXER_FLAG_AUTO_NOTIFICATIONS) == 0);
++
++ 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 +466,8 @@
+ 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 +508,11 @@
+ g_list_free (applet->elements);
+ applet->elements = NULL;
+ }
++ gst_bus_remove_signal_watch (applet->bus);
++ if (applet->bus) {
++ gst_object_unref (applet->bus);
++ applet->bus = NULL;
++ }
+
+ if (applet->tracks) {
+ g_list_foreach (applet->tracks, (GFunc) g_object_unref, NULL);
+@@ -1049,6 +1083,8 @@
+
+ applet->lock = FALSE;
+ applet->force_next_update = TRUE;
++
++ gnome_volume_applet_refresh (GNOME_VOLUME_APPLET (data), FALSE);
+ }
+
+ /*
+@@ -1152,6 +1188,36 @@
+ "state", mute ? "1" : "0", NULL);
+ }
+
++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);
++}
++
+ static gboolean
+ cb_check (gpointer data)
+ {
+@@ -1214,6 +1280,8 @@
+ /* 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 -ur gnome-applets-2.19.1/mixer/applet.h gnome-applets-2.19.1.new/mixer/applet.h
+--- gnome-applets-2.19.1/mixer/applet.h 2007-07-28 03:02:35.000000000 +0100
++++ gnome-applets-2.19.1.new/mixer/applet.h 2007-08-30 20:21:10.000000000 +0100
+@@ -71,6 +71,7 @@
+
+ /* element */
+ GstMixer *mixer;
++ GstBus *bus;
+ gboolean lock;
+ gint state;
+ GList *tracks;
More information about the pkg-gnome-commits
mailing list