diff --git a/libxfce4mixer/xfce-mixer-preferences.c b/libxfce4mixer/xfce-mixer-preferences.c index 04aef50..e088983 100644 --- a/libxfce4mixer/xfce-mixer-preferences.c +++ b/libxfce4mixer/xfce-mixer-preferences.c @@ -37,7 +37,8 @@ enum PROP_0, PROP_WINDOW_WIDTH, PROP_WINDOW_HEIGHT, - PROP_SOUND_CARD, + PROP_ACTIVE_CARD, + PROP_ACTIVE_TRACK, N_PROPERTIES, }; @@ -139,10 +140,18 @@ xfce_mixer_preferences_class_init (XfceMixerPreferencesClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (gobject_class, - PROP_SOUND_CARD, - g_param_spec_string ("sound-card", - "sound-card", - "sound-card", + PROP_ACTIVE_CARD, + g_param_spec_string ("active-card", + "active-card", + "active-card", + NULL, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + + g_object_class_install_property (gobject_class, + PROP_ACTIVE_TRACK, + g_param_spec_string ("active-track", + "active-track", + "active-track", NULL, G_PARAM_READABLE | G_PARAM_WRITABLE)); } @@ -157,7 +166,8 @@ xfce_mixer_preferences_init (XfceMixerPreferences *preferences) xfconf_g_property_bind (preferences->channel, "/window-width", G_TYPE_INT, G_OBJECT (preferences), "window-width"); xfconf_g_property_bind (preferences->channel, "/window-height", G_TYPE_INT, G_OBJECT (preferences), "window-height"); - xfconf_g_property_bind (preferences->channel, "/sound-card", G_TYPE_STRING, G_OBJECT (preferences), "sound-card"); + xfconf_g_property_bind (preferences->channel, "/active-card", G_TYPE_STRING, G_OBJECT (preferences), "active-card"); + xfconf_g_property_bind (preferences->channel, "/active-track", G_TYPE_STRING, G_OBJECT (preferences), "active-track"); xfce_mixer_preferences_load (preferences); } diff --git a/xfce4-mixer/xfce-mixer-window.c b/xfce4-mixer/xfce-mixer-window.c index d08505d..10eba43 100644 --- a/xfce4-mixer/xfce-mixer-window.c +++ b/xfce4-mixer/xfce-mixer-window.c @@ -44,6 +44,9 @@ static void xfce_mixer_window_finalize (GObject * static void xfce_mixer_window_soundcard_changed (XfceMixerCardCombo *combo, GstElement *card, XfceMixerWindow *window); +static void xfce_mixer_window_maintrack_changed (XfceMixerTrackCombo *combo, + GstMixerTrack *track, + XfceMixerWindow *window); static void xfce_mixer_window_action_select_controls (GtkAction *action, XfceMixerWindow *window); static void xfce_mixer_window_close (GtkAction *action, @@ -69,6 +72,7 @@ struct _XfceMixerWindow GtkActionGroup *action_group; GtkWidget *soundcard_combo; + GtkWidget *maintrack_combo; /* Active mixer control set */ GtkWidget *mixer_frame; @@ -154,6 +158,7 @@ xfce_mixer_window_init (XfceMixerWindow *window) GtkWidget *hbox; GtkWidget *bbox; gchar *active_card = NULL; + gchar *active_track = NULL; gchar *title; gint width; gint height; @@ -161,7 +166,7 @@ xfce_mixer_window_init (XfceMixerWindow *window) window->preferences = xfce_mixer_preferences_get (); - g_object_get (window->preferences, "window-width", &width, "window-height", &height, "sound-card", &active_card, NULL); + g_object_get (window->preferences, "window-width", &width, "window-height", &height, "active-card", &active_card, "active-track", &active_track, NULL); /* Configure the main window */ gtk_window_set_icon_name (GTK_WINDOW (window), "multimedia-volume-control"); @@ -221,6 +226,24 @@ xfce_mixer_window_init (XfceMixerWindow *window) gtk_container_add (GTK_CONTAINER (hbox), window->soundcard_combo); gtk_widget_show (window->soundcard_combo); + hbox = gtk_hbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); + gtk_widget_show (hbox); + + label = gtk_label_new (NULL); + title = g_strdup_printf ("%s", _("Main track:")); + gtk_label_set_markup (GTK_LABEL (label), title); + g_free (title); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_widget_show (label); + + window->maintrack_combo = xfce_mixer_track_combo_new (xfce_mixer_get_card (active_card), + xfce_mixer_get_track (xfce_mixer_get_card (active_card), active_track)); + g_signal_connect (G_OBJECT (window->maintrack_combo), "track-changed", G_CALLBACK (xfce_mixer_window_maintrack_changed), window); + gtk_container_add (GTK_CONTAINER (hbox), window->maintrack_combo); + gtk_widget_show (window->maintrack_combo); + window->mixer_frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (window->mixer_frame), GTK_SHADOW_NONE); gtk_container_set_border_width (GTK_CONTAINER (window->mixer_frame), 6); @@ -317,8 +340,24 @@ xfce_mixer_window_soundcard_changed (XfceMixerCardCombo *combo, /* Make the "Select Controls..." button sensitive */ gtk_widget_set_sensitive (window->select_controls_button, TRUE); + /* Tell the track combo about the card change */ + xfce_mixer_track_combo_set_soundcard (XFCE_MIXER_TRACK_COMBO (window->maintrack_combo), card); + /* Remember the card for next time */ - g_object_set (G_OBJECT (window->preferences), "sound-card", xfce_mixer_get_card_internal_name (card), NULL); + g_object_set (G_OBJECT (window->preferences), "active-card", xfce_mixer_get_card_internal_name (card), NULL); +} + + + +static void xfce_mixer_window_maintrack_changed (XfceMixerTrackCombo *combo, + GstMixerTrack *track, + XfceMixerWindow *window) +{ + gchar *track_name; + + /* Remember the track for next time */ + g_object_get (G_OBJECT (track), "label", &track_name, NULL); + g_object_set (G_OBJECT (window->preferences), "active-track", track_name, NULL); }