[gnome-media] Move on_adjustment_value_changed() signal connection



commit 43fb8d06f48a84c1b04e25820881aaf4e5df7e39
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Aug 18 11:55:22 2009 +0100

    Move on_adjustment_value_changed() signal connection
    
    ... to bar_set_stream, and only connect if the bar
    has a stream.

 gnome-volume-control/src/gvc-mixer-dialog.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gnome-volume-control/src/gvc-mixer-dialog.c b/gnome-volume-control/src/gvc-mixer-dialog.c
index 868e677..48ba25d 100644
--- a/gnome-volume-control/src/gvc-mixer-dialog.c
+++ b/gnome-volume-control/src/gvc-mixer-dialog.c
@@ -881,8 +881,11 @@ bar_set_stream (GvcMixerDialog *dialog,
 
         adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (bar)));
 
+        g_signal_handlers_disconnect_by_func (adj, on_adjustment_value_changed, dialog);
+
         g_object_set_data (G_OBJECT (bar), "gvc-mixer-dialog-stream", stream);
         g_object_set_data (G_OBJECT (adj), "gvc-mixer-dialog-stream", stream);
+        g_object_set_data (G_OBJECT (adj), "gvc-mixer-dialog-bar", bar);
 
         if (stream != NULL) {
                 gboolean is_muted;
@@ -907,6 +910,10 @@ bar_set_stream (GvcMixerDialog *dialog,
                                   "notify::port",
                                   G_CALLBACK (on_stream_port_notify),
                                   dialog);
+                g_signal_connect (adj,
+                                  "value-changed",
+                                  G_CALLBACK (on_adjustment_value_changed),
+                                  dialog);
         }
 }
 
@@ -1010,12 +1017,6 @@ add_stream (GvcMixerDialog *dialog,
 
         if (bar != NULL) {
                 bar_set_stream (dialog, bar, stream);
-                adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (bar)));
-
-                g_signal_connect (adj,
-                                  "value-changed",
-                                  G_CALLBACK (on_adjustment_value_changed),
-                                  dialog);
                 gtk_widget_show (bar);
         }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]