[Xfce4-commits] r29703 - in xfce4-mixer/trunk: . panel-plugin xfce4-mixer

Jannis Pohlmann jannis at xfce.org
Sun Apr 5 11:08:37 CEST 2009


Author: jannis
Date: 2009-04-05 09:08:37 +0000 (Sun, 05 Apr 2009)
New Revision: 29703

Modified:
   xfce4-mixer/trunk/ChangeLog
   xfce4-mixer/trunk/panel-plugin/xfce-mixer-plugin.c
   xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-track.c
   xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c
Log:
	* panel-plugin/xfce-mixer-plugin.c: Display mute/record state properly
	  on startup (bug #5002). Fix segfault when destroying the plugin
	  (thanks to Cody Somerville for hunting this one down) (bug #4948).
	* xfce4-mixer/xfce-mixer-track.c: Move capture track check into
	  xfce_mixer_track_update_record().
	* xfce4-mixer/xfce-mixer.c: Don't increment the reference count on
	  GObjects when passing them to GValue using g_value_set_object().

Modified: xfce4-mixer/trunk/ChangeLog
===================================================================
--- xfce4-mixer/trunk/ChangeLog	2009-04-04 10:12:48 UTC (rev 29702)
+++ xfce4-mixer/trunk/ChangeLog	2009-04-05 09:08:37 UTC (rev 29703)
@@ -1,3 +1,13 @@
+2009-04-05	Jannis Pohlmann <jannis at xfce.org>
+
+	* panel-plugin/xfce-mixer-plugin.c: Display mute/record state properly
+	  on startup (bug #5002). Fix segfault when destroying the plugin
+	  (thanks to Cody Somerville for hunting this one down) (bug #4948).
+	* xfce4-mixer/xfce-mixer-track.c: Move capture track check into
+	  xfce_mixer_track_update_record().
+	* xfce4-mixer/xfce-mixer.c: Don't increment the reference count on
+	  GObjects when passing them to GValue using g_value_set_object().
+
 2009-02-13	Jannis Pohlmann <jannis at xfce.org>
 
 	* xfce4-mixer/xfce4-mixer.desktop.in.in: Add missing AudioVideo

Modified: xfce4-mixer/trunk/panel-plugin/xfce-mixer-plugin.c
===================================================================
--- xfce4-mixer/trunk/panel-plugin/xfce-mixer-plugin.c	2009-04-04 10:12:48 UTC (rev 29702)
+++ xfce4-mixer/trunk/panel-plugin/xfce-mixer-plugin.c	2009-04-05 09:08:37 UTC (rev 29703)
@@ -86,8 +86,8 @@
 /* Function prototypes */
 static void             xfce_mixer_plugin_construct         (XfcePanelPlugin  *plugin);
 static XfceMixerPlugin *xfce_mixer_plugin_new               (XfcePanelPlugin  *plugin);
-static void             xfce_mixer_plugin_free              (XfcePanelPlugin  *plugin,
-                                                             XfceMixerPlugin  *mixer_plugin);
+static void             xfce_mixer_plugin_free              (XfceMixerPlugin  *mixer_plugin,
+                                                             XfcePanelPlugin  *plugin);
 static gboolean         xfce_mixer_plugin_size_changed      (XfceMixerPlugin  *mixer_plugin,
                                                              gint              size);
 static void             xfce_mixer_plugin_volume_changed    (XfceMixerPlugin  *mixer_plugin,
@@ -167,8 +167,8 @@
 
 
 static void
-xfce_mixer_plugin_free (XfcePanelPlugin *plugin,
-                        XfceMixerPlugin *mixer_plugin)
+xfce_mixer_plugin_free (XfceMixerPlugin *mixer_plugin,
+                        XfcePanelPlugin *plugin)
 {
   /* Free card and track names */
   g_free (mixer_plugin->command);
@@ -529,9 +529,11 @@
 static void
 xfce_mixer_plugin_update_track (XfceMixerPlugin *mixer_plugin)
 {
-  gint   *volumes;
-  gdouble volume;
-  gchar  *tip_text;
+  XfceMixerTrackType track_type;
+  gboolean           muted = FALSE;
+  gdouble            volume;
+  gint              *volumes;
+  gchar             *tip_text;
 
   g_return_if_fail (mixer_plugin != NULL);
   g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
@@ -549,8 +551,17 @@
   gtk_tooltips_set_tip (mixer_plugin->tooltips, mixer_plugin->button, tip_text, "test");
   g_free (tip_text);
 
+  /* Determine track type */
+  track_type = xfce_mixer_track_type_new (mixer_plugin->track);
+
+  if (G_LIKELY (track_type == XFCE_MIXER_TRACK_TYPE_PLAYBACK))
+    muted = GST_MIXER_TRACK_HAS_FLAG (mixer_plugin->track, GST_MIXER_TRACK_MUTE);
+  else if (track_type == XFCE_MIXER_TRACK_TYPE_CAPTURE)
+    muted = !GST_MIXER_TRACK_HAS_FLAG (mixer_plugin->track, GST_MIXER_TRACK_RECORD);
+
   /* Update the volume button */
   xfce_volume_button_set_volume (XFCE_VOLUME_BUTTON (mixer_plugin->button), volume);
+  xfce_volume_button_set_muted (XFCE_VOLUME_BUTTON (mixer_plugin->button), muted);
 
   /* Free volume array */
   g_free (volumes);
@@ -650,7 +661,9 @@
 
   /* Replace the track label */
   g_free (mixer_plugin->track_label);
+  mixer_plugin->track_label = NULL;
   g_object_get (track, "label", &mixer_plugin->track_label, NULL);
+  g_debug ("mixer_plugin->track_label = '%s'", mixer_plugin->track_label);
 }
 
 

Modified: xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-track.c
===================================================================
--- xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-track.c	2009-04-04 10:12:48 UTC (rev 29702)
+++ xfce4-mixer/trunk/xfce4-mixer/xfce-mixer-track.c	2009-04-05 09:08:37 UTC (rev 29703)
@@ -265,8 +265,7 @@
 
   /* Some of the mixer controls need to be updated before they can be used */
   xfce_mixer_track_update_mute (track);
-  if (G_UNLIKELY (xfce_mixer_track_type_new (track->gst_track) == XFCE_MIXER_TRACK_TYPE_CAPTURE))
-    xfce_mixer_track_update_record (track);
+  xfce_mixer_track_update_record (track);
 
   /* Free volume array */
   g_free (volumes);
@@ -425,11 +424,11 @@
 
   g_return_if_fail (IS_XFCE_MIXER_TRACK (track));
 
-  if (G_UNLIKELY (xfce_mixer_track_type_new (track->gst_track) == XFCE_MIXER_TRACK_TYPE_CAPTURE))
-    return;
-
-  muted = GST_MIXER_TRACK_HAS_FLAG (track->gst_track, GST_MIXER_TRACK_MUTE);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (track->mute_button), muted);
+  if (G_LIKELY (xfce_mixer_track_type_new (track->gst_track) != XFCE_MIXER_TRACK_TYPE_CAPTURE))
+    {
+      muted = GST_MIXER_TRACK_HAS_FLAG (track->gst_track, GST_MIXER_TRACK_MUTE);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (track->mute_button), muted);
+    }
 }
 
 
@@ -441,8 +440,11 @@
 
   g_return_if_fail (IS_XFCE_MIXER_TRACK (track));
 
-  record = GST_MIXER_TRACK_HAS_FLAG (track->gst_track, GST_MIXER_TRACK_RECORD);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (track->record_button), record);
+  if (G_UNLIKELY (xfce_mixer_track_type_new (track->gst_track) == XFCE_MIXER_TRACK_TYPE_CAPTURE))
+    {
+      record = GST_MIXER_TRACK_HAS_FLAG (track->gst_track, GST_MIXER_TRACK_RECORD);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (track->record_button), record);
+    }
 }
 
 

Modified: xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c
===================================================================
--- xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c	2009-04-04 10:12:48 UTC (rev 29702)
+++ xfce4-mixer/trunk/xfce4-mixer/xfce-mixer.c	2009-04-05 09:08:37 UTC (rev 29703)
@@ -351,7 +351,7 @@
   switch (prop_id)
     {
     case PROP_CARD:
-      g_value_set_object (value, g_object_ref (mixer->card));
+      g_value_set_object (value, mixer->card);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -372,7 +372,7 @@
   switch (prop_id)
     {
     case PROP_CARD:
-      mixer->card = g_object_ref (g_value_get_object (value));
+      mixer->card = g_value_dup_object (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);




More information about the Xfce4-commits mailing list