[Xfce4-commits] <xfce4-mixer:master> Use xfconf for the panel plugin configuration

Guido Berhoerster noreply at xfce.org
Thu Sep 27 16:46:07 CEST 2012


Updating branch refs/heads/master
         to 421d875b57d6a9e05cd58f79183a1691eb23633b (commit)
       from f0e810321ef39e0ab57b567469b3785626f7cffc (commit)

commit 421d875b57d6a9e05cd58f79183a1691eb23633b
Author: Guido Berhoerster <guido+xfce at berhoerster.name>
Date:   Thu Sep 27 16:31:08 2012 +0200

    Use xfconf for the panel plugin configuration
    
    Make the plugin a subclass of XfcePanelPlugin.
    Switch the plugin from a rc file to xfconf for storing the plugin
    configuration.

 NEWS                                   |    1 +
 libxfce4mixer/libxfce4mixer.c          |   17 +
 libxfce4mixer/libxfce4mixer.h          |    3 +
 libxfce4mixer/xfce-mixer-card-combo.c  |   12 +-
 libxfce4mixer/xfce-mixer-card-combo.h  |    2 +
 libxfce4mixer/xfce-mixer-track-combo.c |   66 +++-
 libxfce4mixer/xfce-mixer-track-combo.h |    3 +
 panel-plugin/Makefile.am               |    3 +
 panel-plugin/xfce-mixer-plugin.c       |  680 ++++++++++++++++----------------
 panel-plugin/xfce-mixer-plugin.h       |   44 ++
 panel-plugin/xfce-plugin-dialog.c      |  332 +++++++++++-----
 panel-plugin/xfce-plugin-dialog.h      |   12 +-
 12 files changed, 698 insertions(+), 477 deletions(-)

diff --git a/NEWS b/NEWS
index 1f72815..d63333f 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@
 - Use standard icons where possible.
 - Update the icons on theme change (bug #3498).
 - Support xfce4-panel 4.10 with its deskbar mode (bug #8350).
+- Use xfconf for the panel plugin configuration.
 
 
 4.8.0
diff --git a/libxfce4mixer/libxfce4mixer.c b/libxfce4mixer/libxfce4mixer.c
index d75c571..b7ad3b7 100644
--- a/libxfce4mixer/libxfce4mixer.c
+++ b/libxfce4mixer/libxfce4mixer.c
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -291,3 +292,19 @@ _xfce_mixer_destroy_mixer (GstMixer *mixer)
   gst_element_set_state (GST_ELEMENT (mixer), GST_STATE_NULL);
   gst_object_unref (GST_OBJECT (mixer));
 }
+
+
+
+int
+xfce_mixer_utf8_cmp (const gchar *s1, const gchar *s2)
+{
+  if (s1 == NULL && s2 != NULL)
+    return 1;
+  else if (s1 != NULL && s2 == NULL)
+    return -1;
+  else if (s1 == NULL && s2 == NULL)
+    return 0;
+
+  return g_utf8_collate (s1, s2);
+}
+
diff --git a/libxfce4mixer/libxfce4mixer.h b/libxfce4mixer/libxfce4mixer.h
index e19b463..a68ff6d 100644
--- a/libxfce4mixer/libxfce4mixer.h
+++ b/libxfce4mixer/libxfce4mixer.h
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,6 +52,8 @@ void           xfce_mixer_bus_disconnect         (guint          signal_handler_
 
 gint           xfce_mixer_get_max_volume         (gint          *volumes,
                                                   gint           num_channels);
+int            xfce_mixer_utf8_cmp               (const gchar   *s1,
+                                                  const gchar   *s2);
 
 G_END_DECLS;
 
diff --git a/libxfce4mixer/xfce-mixer-card-combo.c b/libxfce4mixer/xfce-mixer-card-combo.c
index 28fe134..e75d6ab 100644
--- a/libxfce4mixer/xfce-mixer-card-combo.c
+++ b/libxfce4mixer/xfce-mixer-card-combo.c
@@ -52,8 +52,6 @@ static void  xfce_mixer_card_combo_class_init        (XfceMixerCardComboClass *k
 static void  xfce_mixer_card_combo_init              (XfceMixerCardCombo      *combo);
 static void  xfce_mixer_card_combo_finalize          (GObject                 *object);
 static void  xfce_mixer_card_combo_changed           (XfceMixerCardCombo      *combo);
-static void _xfce_mixer_card_combo_set_active_card   (XfceMixerCardCombo      *combo,
-                                                      GstElement              *card);
 
 
 
@@ -177,7 +175,7 @@ xfce_mixer_card_combo_new (GstElement *card)
   
   combo = g_object_new (TYPE_XFCE_MIXER_CARD_COMBO, NULL);
 
-  _xfce_mixer_card_combo_set_active_card (XFCE_MIXER_CARD_COMBO (combo), card);
+  xfce_mixer_card_combo_set_active_card (XFCE_MIXER_CARD_COMBO (combo), card);
 
   return combo;
 }
@@ -215,8 +213,8 @@ xfce_mixer_card_combo_get_active_card (XfceMixerCardCombo *combo)
 
 
 
-static void
-_xfce_mixer_card_combo_set_active_card (XfceMixerCardCombo *combo,
+void
+xfce_mixer_card_combo_set_active_card (XfceMixerCardCombo *combo,
                                         GstElement         *card)
 {
   GstElement *current_card = NULL;
@@ -238,10 +236,8 @@ _xfce_mixer_card_combo_set_active_card (XfceMixerCardCombo *combo,
 
           valid_iter = gtk_tree_model_iter_next (GTK_TREE_MODEL (combo->list_store), &iter);
         }
+      gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
     }
-
-  if (G_LIKELY (card != NULL && current_card == card))
-    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
   else
     gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
 }
diff --git a/libxfce4mixer/xfce-mixer-card-combo.h b/libxfce4mixer/xfce-mixer-card-combo.h
index 23b717c..90b959a 100644
--- a/libxfce4mixer/xfce-mixer-card-combo.h
+++ b/libxfce4mixer/xfce-mixer-card-combo.h
@@ -39,6 +39,8 @@ GType       xfce_mixer_card_combo_get_type        (void) G_GNUC_CONST;
 
 GtkWidget  *xfce_mixer_card_combo_new             (GstElement         *element);
 GstElement *xfce_mixer_card_combo_get_active_card (XfceMixerCardCombo *combo);
+void        xfce_mixer_card_combo_set_active_card (XfceMixerCardCombo *combo,
+                                                   GstElement         *card);
 
 G_END_DECLS;
 
diff --git a/libxfce4mixer/xfce-mixer-track-combo.c b/libxfce4mixer/xfce-mixer-track-combo.c
index ce1fc20..f99a0ef 100644
--- a/libxfce4mixer/xfce-mixer-track-combo.c
+++ b/libxfce4mixer/xfce-mixer-track-combo.c
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,8 +57,6 @@ static void  xfce_mixer_track_combo_class_init (XfceMixerTrackComboClass *klass)
 static void  xfce_mixer_track_combo_init       (XfceMixerTrackCombo      *combo);
 static void  xfce_mixer_track_combo_finalize   (GObject                  *object);
 static void  xfce_mixer_track_combo_changed    (XfceMixerTrackCombo      *combo);
-static void _xfce_mixer_track_combo_set_track  (XfceMixerTrackCombo      *combo,
-                                                GstMixerTrack            *track);
 
 
 
@@ -142,7 +141,6 @@ xfce_mixer_track_combo_init (XfceMixerTrackCombo *combo)
   GtkCellRenderer *renderer;
 
   combo->card = NULL;
-  combo->track = NULL;
 
   combo->list_store = gtk_list_store_new (2, G_TYPE_STRING, GST_TYPE_MIXER_TRACK);
   gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (combo->list_store));
@@ -173,14 +171,16 @@ GtkWidget*
 xfce_mixer_track_combo_new (GstElement    *card,
                             GstMixerTrack *track)
 {
-  GtkWidget *combo;
+  GtkWidget           *widget;
+  XfceMixerTrackCombo *combo;
 
-  combo = g_object_new (TYPE_XFCE_MIXER_TRACK_COMBO, NULL);
+  widget = g_object_new (TYPE_XFCE_MIXER_TRACK_COMBO, NULL);
+  combo = XFCE_MIXER_TRACK_COMBO (widget);
 
-  _xfce_mixer_track_combo_set_track (XFCE_MIXER_TRACK_COMBO (combo), track);
-  xfce_mixer_track_combo_set_soundcard (XFCE_MIXER_TRACK_COMBO (combo), card);
+  xfce_mixer_track_combo_set_soundcard (combo, card);
+  xfce_mixer_track_combo_set_active_track (combo, track);
 
-  return combo;
+  return widget;
 }
 
 
@@ -196,6 +196,7 @@ xfce_mixer_track_combo_set_soundcard (XfceMixerTrackCombo *combo,
   gchar             *label;
   gint               counter;
   gint               active_index = 0;
+  GstMixerTrack     *track;
 
   g_return_if_fail (IS_XFCE_MIXER_TRACK_COMBO (combo));
 
@@ -210,6 +211,9 @@ xfce_mixer_track_combo_set_soundcard (XfceMixerTrackCombo *combo,
         combo->card = g_list_first (cards)->data;
     }
 
+  /* Try to re-use the current track */
+  track = xfce_mixer_track_combo_get_active_track (combo);
+
   /* Clear the list store data */
   gtk_list_store_clear (combo->list_store);
 
@@ -228,7 +232,7 @@ xfce_mixer_track_combo_set_soundcard (XfceMixerTrackCombo *combo,
 
           g_free (label);
 
-          if (G_UNLIKELY (combo->track != NULL && combo->track == GST_MIXER_TRACK (iter->data)))
+          if (G_UNLIKELY (track != NULL && track == GST_MIXER_TRACK (iter->data)))
             active_index = counter;
 
           ++counter;
@@ -240,16 +244,6 @@ xfce_mixer_track_combo_set_soundcard (XfceMixerTrackCombo *combo,
 
 
 
-void
-_xfce_mixer_track_combo_set_track (XfceMixerTrackCombo *combo,
-                                   GstMixerTrack       *track)
-{
-  g_return_if_fail (IS_XFCE_MIXER_TRACK_COMBO (combo));
-  combo->track = track;
-}
-
-
-
 static void
 xfce_mixer_track_combo_changed (XfceMixerTrackCombo *combo)
 {
@@ -280,3 +274,37 @@ xfce_mixer_track_combo_get_active_track (XfceMixerTrackCombo *combo)
 
   return track;
 }
+
+void
+xfce_mixer_track_combo_set_active_track (XfceMixerTrackCombo *combo,
+                                         GstMixerTrack       *track)
+{
+  GstMixerTrack *current_track = NULL;
+  GtkTreeIter    iter;
+  gboolean       valid_iter;
+
+  g_return_if_fail (IS_XFCE_MIXER_TRACK_COMBO (combo));
+
+  if (G_UNLIKELY (!GST_IS_MIXER_TRACK (track)))
+    {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
+      return;
+    }
+
+  valid_iter = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (combo->list_store), &iter);
+
+  while (valid_iter)
+    {
+      gtk_tree_model_get (GTK_TREE_MODEL (combo->list_store), &iter, TRACK_COLUMN, &current_track, -1);
+
+      if (G_UNLIKELY (current_track == track))
+        break;
+
+      valid_iter = gtk_tree_model_iter_next (GTK_TREE_MODEL (combo->list_store), &iter);
+    }
+
+  if (G_LIKELY (current_track == track))
+    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
+  else
+    gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
+}
diff --git a/libxfce4mixer/xfce-mixer-track-combo.h b/libxfce4mixer/xfce-mixer-track-combo.h
index 1a4a7c7..73a4a21 100644
--- a/libxfce4mixer/xfce-mixer-track-combo.h
+++ b/libxfce4mixer/xfce-mixer-track-combo.h
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,6 +47,8 @@ GtkWidget     *xfce_mixer_track_combo_new              (GstElement          *car
 void           xfce_mixer_track_combo_set_soundcard    (XfceMixerTrackCombo *combo,
                                                         GstElement          *card);
 GstMixerTrack *xfce_mixer_track_combo_get_active_track (XfceMixerTrackCombo *combo);
+void           xfce_mixer_track_combo_set_active_track (XfceMixerTrackCombo *combo,
+                                                        GstMixerTrack       *track);
 
 G_END_DECLS;
 
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 2d2bcbd..2170005 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -9,6 +9,7 @@ libmixer_la_SOURCES =							\
 	xfce-plugin-dialog.c						\
 	xfce-volume-button.h						\
 	xfce-volume-button.c						\
+	xfce-mixer-plugin.h						\
 	xfce-mixer-plugin.c
 
 libmixer_la_CFLAGS =							\
@@ -23,6 +24,7 @@ libmixer_la_CFLAGS =							\
 	$(LIBXFCE4UTIL_CFLAGS)						\
 	$(LIBXFCE4UI_CFLAGS)						\
 	$(LIBXFCE4PANEL_CFLAGS)						\
+	$(XFCONF_CFLAGS)						\
 	$(GST_PLUGINS_BASE_CFLAGS)
 
 libmixer_la_DEPENDENCIES =						\
@@ -42,6 +44,7 @@ libmixer_la_LIBADD =							\
 	$(LIBXFCE4UTIL_LIBS)						\
 	$(LIBXFCE4UI_LIBS)						\
 	$(LIBXFCE4PANEL_LIBS)						\
+	$(XFCONF_LIBS)							\
 	$(GST_PLUGINS_BASE_LIBS)					\
 	-lgstaudio-0.10							\
 	-lgstinterfaces-0.10
diff --git a/panel-plugin/xfce-mixer-plugin.c b/panel-plugin/xfce-mixer-plugin.c
index a396cc6..7ce66bb 100644
--- a/panel-plugin/xfce-mixer-plugin.c
+++ b/panel-plugin/xfce-mixer-plugin.c
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,10 +23,6 @@
 #include <config.h>
 #endif
 
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <gtk/gtk.h>
 
 #include <gst/gst.h>
@@ -33,6 +30,9 @@
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4panel/libxfce4panel.h>
+#include <xfconf/xfconf.h>
+
+#include "xfce-mixer-plugin.h"
 
 #include "libxfce4mixer/libxfce4mixer.h"
 
@@ -41,24 +41,64 @@
 
 
 
-#define DEFAULT_COMMAND "xfce4-mixer"
+enum
+{
+  PROP_0,
+  PROP_SOUND_CARD,
+  PROP_TRACK,
+  PROP_COMMAND,
+  N_PROPERTIES,
+};
+
+
+
+static void     xfce_mixer_plugin_construct                   (XfcePanelPlugin  *plugin);
+static void     xfce_mixer_plugin_set_property                (GObject          *object,
+                                                               guint             prop_id,
+                                                               const GValue     *value,
+                                                               GParamSpec       *pspec);
+static void     xfce_mixer_plugin_get_property                (GObject          *object,
+                                                               guint             prop_id,
+                                                               GValue           *value,
+                                                               GParamSpec       *pspec);
+static void     xfce_mixer_plugin_free_data                   (XfcePanelPlugin  *plugin);
+static void     xfce_mixer_plugin_configure_plugin            (XfcePanelPlugin  *plugin);
+static gboolean xfce_mixer_plugin_size_changed                (XfcePanelPlugin  *plugin,
+                                                               gint              size);
+static void     xfce_mixer_plugin_clicked                     (XfceMixerPlugin  *mixer_plugin);
+static void     xfce_mixer_plugin_volume_changed              (XfceMixerPlugin  *mixer_plugin,
+                                                               gdouble           volume);
+static void     xfce_mixer_plugin_mute_toggled                (XfceMixerPlugin  *mixer_plugin,
+                                                               gboolean          mute);
+static void     xfce_mixer_plugin_update_track                (XfceMixerPlugin  *mixer_plugin);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+static void     xfce_mixer_plugin_bus_message                 (GstBus           *bus,
+                                                               GstMessage       *message,
+                                                               XfceMixerPlugin  *mixer_plugin);
+#endif
+
 
 
 
-typedef struct _XfceMixerPlugin XfceMixerPlugin;
+struct _XfceMixerPluginClass
+{
+  /* Parent class */
+  XfcePanelPluginClass __parent__;
+};
 
 
 
-/* Plugin structure */
 struct _XfceMixerPlugin
 {
-  XfcePanelPlugin *plugin;
+  /* Parent type */
+  XfcePanelPlugin __parent__;
 
   /* Tooltips structure */
   GtkTooltips     *tooltips;
 
   /* Sound card being used */
   GstElement      *card;
+  gchar           *card_name;
 
   /* Mixer track being used */
   GstMixerTrack   *track;
@@ -71,6 +111,9 @@ struct _XfceMixerPlugin
   GtkWidget       *hvbox;
   GtkWidget       *button;
 
+  /* Reference to the plugin private xfconf channel */
+  XfconfChannel   *plugin_channel;
+
 #ifdef HAVE_GST_MIXER_NOTIFICATION
   /* Flag for ignoring messages from the GstBus */
   gboolean         ignore_bus_messages;
@@ -82,71 +125,88 @@ struct _XfceMixerPlugin
 
 
 
-/* Function prototypes */
-static void             xfce_mixer_plugin_construct         (XfcePanelPlugin  *plugin);
-static XfceMixerPlugin *xfce_mixer_plugin_new               (XfcePanelPlugin  *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,
-                                                             gdouble           volume);
-static void             xfce_mixer_plugin_mute_toggled      (XfceMixerPlugin  *mixer_plugin,
-                                                             gboolean          mute);
-static void             xfce_mixer_plugin_configure         (XfceMixerPlugin  *mixer_plugin);
-static void             xfce_mixer_plugin_clicked           (XfceMixerPlugin  *mixer_plugin);
-static void             xfce_mixer_plugin_read_config       (XfceMixerPlugin  *mixer_plugin);
-static void             xfce_mixer_plugin_write_config      (XfceMixerPlugin  *mixer_plugin);
-static void             xfce_mixer_plugin_update_track      (XfceMixerPlugin  *mixer_plugin);
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-static void             xfce_mixer_plugin_bus_message       (GstBus           *bus,
-                                                             GstMessage       *message,
-                                                             XfceMixerPlugin  *mixer_plugin);
-#endif
-static void             xfce_mixer_plugin_set_card          (XfceMixerPlugin  *mixer_plugin,
-                                                             GstElement       *card);
-static void             xfce_mixer_plugin_set_track         (XfceMixerPlugin  *mixer_plugin,
-                                                             GstMixerTrack    *track);
-static void             xfce_mixer_plugin_set_command       (XfceMixerPlugin  *mixer_plugin,
-                                                             const gchar      *command);
-
-
+/* Define the plugin */
+XFCE_PANEL_DEFINE_PLUGIN (XfceMixerPlugin, xfce_mixer_plugin)
 
-/* Register the plugin */
-XFCE_PANEL_PLUGIN_REGISTER (xfce_mixer_plugin_construct);
 
 
-
-static XfceMixerPlugin*
-xfce_mixer_plugin_new (XfcePanelPlugin *plugin)
+static void
+xfce_mixer_plugin_class_init (XfceMixerPluginClass *klass)
 {
-  XfceMixerPlugin *mixer_plugin;
+  GObjectClass         *gobject_class;
+  XfcePanelPluginClass *plugin_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->get_property = xfce_mixer_plugin_get_property;
+  gobject_class->set_property = xfce_mixer_plugin_set_property;
+
+  plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
+  plugin_class->construct = xfce_mixer_plugin_construct;
+  plugin_class->free_data = xfce_mixer_plugin_free_data;
+  plugin_class->size_changed = xfce_mixer_plugin_size_changed;
+  plugin_class->configure_plugin = xfce_mixer_plugin_configure_plugin;
+
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_SOUND_CARD,
+                                   g_param_spec_string ("sound-card",
+                                                        "sound-card",
+                                                        "sound-card",
+                                                        NULL,
+                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_TRACK,
+                                   g_param_spec_string ("track",
+                                                        "track",
+                                                        "track",
+                                                        NULL,
+                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_COMMAND,
+                                   g_param_spec_string ("command",
+                                                        "command",
+                                                        "command",
+                                                        NULL,
+                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
 
-  /* Allocate memory for the plugin structure */
-  mixer_plugin = panel_slice_new0 (XfceMixerPlugin);
 
-  /* Store pointer to the panel plugin */
-  mixer_plugin->plugin = plugin;
 
+static void
+xfce_mixer_plugin_init (XfceMixerPlugin *mixer_plugin)
+{
   /* Initialize some of the plugin variables */
   mixer_plugin->card = NULL;
   mixer_plugin->track = NULL;
   mixer_plugin->track_label = NULL;
-  mixer_plugin->command = g_strdup (DEFAULT_COMMAND);
+  mixer_plugin->command = NULL;
+
+  mixer_plugin->plugin_channel = NULL;
 
 #ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = FALSE;
   mixer_plugin->message_handler_id = 0;
 #endif
 
+  /* Initialize xfconf */
+  xfconf_init (NULL);
+
+  /* Initialize GStreamer */
+  gst_init (NULL, NULL);
+
+  /* Initialize the mixer library */
+  xfce_mixer_init ();
+
   /* Allocate a tooltips structure */
   mixer_plugin->tooltips = gtk_tooltips_new ();
   gtk_tooltips_set_delay (mixer_plugin->tooltips, 10);
 
   /* Create container for the plugin */
   mixer_plugin->hvbox = GTK_WIDGET (xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0));
-  xfce_panel_plugin_add_action_widget (plugin, mixer_plugin->hvbox);
-  gtk_container_add (GTK_CONTAINER (plugin), mixer_plugin->hvbox);
+  xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (mixer_plugin), mixer_plugin->hvbox);
+  gtk_container_add (GTK_CONTAINER (mixer_plugin), mixer_plugin->hvbox);
   gtk_widget_show (mixer_plugin->hvbox);
 
   /* Create volume button for the plugin */
@@ -158,172 +218,222 @@ xfce_mixer_plugin_new (XfcePanelPlugin *plugin)
   gtk_widget_show (mixer_plugin->button);
 
   /* Let the volume button receive mouse events */
-  xfce_panel_plugin_add_action_widget (plugin, mixer_plugin->button);
-
-  return mixer_plugin;
+  xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (mixer_plugin), mixer_plugin->button);
 }
 
 
 
 static void
-xfce_mixer_plugin_free (XfceMixerPlugin *mixer_plugin,
-                        XfcePanelPlugin *plugin)
+xfce_mixer_plugin_construct (XfcePanelPlugin *plugin)
 {
-  /* Free card and track names */
-  g_free (mixer_plugin->command);
-  g_free (mixer_plugin->track_label);
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  /* Disconnect from GstBus */
-  xfce_mixer_bus_disconnect (mixer_plugin->message_handler_id);
-#endif
+  xfce_panel_plugin_menu_show_configure (plugin);
 
-  /* Shutdown the mixer library */
-  xfce_mixer_shutdown ();
+  /* Only occupy a single row in deskbar mode */
+  xfce_panel_plugin_set_small (XFCE_PANEL_PLUGIN (mixer_plugin), TRUE);
 
-  /* Free memory of the mixer plugin */
-  panel_slice_free (XfceMixerPlugin, mixer_plugin);
+  /* Set up xfconf property bindings */
+  mixer_plugin->plugin_channel = xfconf_channel_new_with_property_base (xfce_panel_get_channel_name (), xfce_panel_plugin_get_property_base (plugin));
+  xfconf_g_property_bind (mixer_plugin->plugin_channel, "/sound-card", G_TYPE_STRING, mixer_plugin, "sound-card");
+  xfconf_g_property_bind (mixer_plugin->plugin_channel, "/track", G_TYPE_STRING, mixer_plugin, "track");
+  xfconf_g_property_bind (mixer_plugin->plugin_channel, "/command", G_TYPE_STRING, mixer_plugin, "command");
 }
 
 
 
 static void
-xfce_mixer_plugin_construct (XfcePanelPlugin *plugin)
+xfce_mixer_plugin_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
 {
-  XfceMixerPlugin *mixer_plugin;
-
-  /* Set up translation domain */
-  xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-
-  /* Initialize the thread system */
-  if (!g_thread_supported ())
-    g_thread_init (NULL);
-
-  /* Initialize GStreamer */
-  gst_init (NULL, NULL);
-
-  /* Initialize the mixer library */
-  xfce_mixer_init ();
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (object);
+  const gchar     *card_name;
+  GstElement      *card = NULL;
+  const gchar     *track_label;
+  gchar           *new_track_label;
+  GstMixerTrack   *track = NULL;
+
+  switch(prop_id)
+    {
+      case PROP_SOUND_CARD:
+        /* Freeze "notify" signals since the "track" property is manipulated */
+        g_object_freeze_notify (object);
+
+        g_free (mixer_plugin->card_name);
+        mixer_plugin->card_name = NULL;
+        mixer_plugin->card = NULL;
+
+        card_name = g_value_get_string (value);
+        if (card_name != NULL)
+            card = xfce_mixer_get_card (card_name);
+
+        if (GST_IS_MIXER (card))
+          {
+            mixer_plugin->card = card;
+            mixer_plugin->card_name = g_strdup (card_name);
+            xfce_mixer_select_card (mixer_plugin->card);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+            mixer_plugin->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_plugin_bus_message), mixer_plugin);
+#endif
+            new_track_label = xfconf_channel_get_string (mixer_plugin->plugin_channel, "/track", NULL);
+          }
+        else
+          {
+            new_track_label = NULL;
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+            xfce_mixer_bus_disconnect (mixer_plugin->message_handler_id);
+#endif
+          }
+        g_object_set (object, "track", new_track_label, NULL);
 
-  /* Create the plugin */
-  mixer_plugin = xfce_mixer_plugin_new (plugin);
+        g_free (new_track_label);
 
-  xfce_panel_plugin_menu_show_configure (plugin);
+        g_object_thaw_notify (object);
+        break;
+      case PROP_TRACK:
+        g_free (mixer_plugin->track_label);
+        mixer_plugin->track_label = NULL;
+        mixer_plugin->track = NULL;
+
+        if (GST_IS_MIXER (mixer_plugin->card))
+          {
+            track_label = g_value_get_string (value);
+            if (track_label != NULL)
+              track = xfce_mixer_get_track (mixer_plugin->card, track_label);
+
+            if (GST_IS_MIXER_TRACK (track))
+              {
+                mixer_plugin->track = track;
+                mixer_plugin->track_label = g_strdup (track_label);
+              }
+          }
+
+        xfce_mixer_plugin_update_track (mixer_plugin);
+        break;
+      case PROP_COMMAND:
+        g_free (mixer_plugin->command);
+        mixer_plugin->command = g_value_dup_string (value);
+        if (mixer_plugin->command == NULL)
+          mixer_plugin->command = g_strdup (XFCE_MIXER_PLUGIN_DEFAULT_COMMAND);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
 
-   /* Only occupy a single row in deskbar mode */
-   xfce_panel_plugin_set_small (XFCE_PANEL_PLUGIN (mixer_plugin), TRUE);
 
-  /* Connect to plugin signals */
-  g_signal_connect_swapped (G_OBJECT (plugin), "free-data", G_CALLBACK (xfce_mixer_plugin_free), mixer_plugin);
-  g_signal_connect_swapped (G_OBJECT (plugin), "size-changed", G_CALLBACK (xfce_mixer_plugin_size_changed), mixer_plugin);
-  g_signal_connect_swapped (G_OBJECT (plugin), "configure-plugin", G_CALLBACK (xfce_mixer_plugin_configure), mixer_plugin);
 
-  /* Read config file */
-  xfce_mixer_plugin_read_config (mixer_plugin);
+static void
+xfce_mixer_plugin_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (object);
 
-  /* Update the plugin if it was already set up */
-  if (G_LIKELY (GST_IS_MIXER (mixer_plugin->card) && GST_IS_MIXER_TRACK (mixer_plugin->track)))
-    xfce_mixer_plugin_update_track (mixer_plugin);
+  switch(prop_id)
+    {
+      case PROP_SOUND_CARD:
+        g_value_set_string (value, mixer_plugin->card_name);
+        break;
+      case PROP_TRACK:
+        g_value_set_string (value, mixer_plugin->track_label);
+        break;
+      case PROP_COMMAND:
+        g_value_set_string (value, mixer_plugin->command);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
 }
 
 
 
-static gboolean
-xfce_mixer_plugin_size_changed (XfceMixerPlugin *mixer_plugin,
-                                gint             size)
+static void
+xfce_mixer_plugin_free_data (XfcePanelPlugin *plugin)
 {
-  g_return_val_if_fail (mixer_plugin != NULL, FALSE);
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
 
-  /* The plugin only occupies a single row */
-  size /= xfce_panel_plugin_get_nrows (XFCE_PANEL_PLUGIN (mixer_plugin));
+  /* Shutdown xfconf */
+  g_object_unref (mixer_plugin->plugin_channel);
+  xfconf_shutdown ();
 
-  /* Determine size for the volume button icons */
-  size -= 2 + 2 * MAX (mixer_plugin->button->style->xthickness, mixer_plugin->button->style->ythickness);
+  /* Free card and track names */
+  g_free (mixer_plugin->command);
+  g_free (mixer_plugin->card_name);
+  g_free (mixer_plugin->track_label);
 
-  /* Set volume button icon size and update the volume button */
-  xfce_volume_button_set_icon_size (XFCE_VOLUME_BUTTON (mixer_plugin->button), size);
-  xfce_volume_button_update (XFCE_VOLUME_BUTTON (mixer_plugin->button));
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+  /* Disconnect from GstBus */
+  xfce_mixer_bus_disconnect (mixer_plugin->message_handler_id);
+#endif
 
-  return TRUE;
+  /* Shutdown the mixer library */
+  xfce_mixer_shutdown ();
 }
 
 
 
 static void
-xfce_mixer_plugin_volume_changed (XfceMixerPlugin  *mixer_plugin,
-                                  gdouble           volume)
-{
-  gchar *tip_text;
-  gint  *volumes;
-  gint   volume_range;
-  gint   new_volume;
-  gint   i;
+xfce_mixer_plugin_configure_plugin (XfcePanelPlugin *plugin)
+ {
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
+  GtkWidget       *dialog;
 
   g_return_if_fail (mixer_plugin != NULL);
-  g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
-  g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
-
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  mixer_plugin->ignore_bus_messages = TRUE;
-#endif
-
-  /* Set tooltip (e.g. 'Master: 50%') */
-  tip_text = g_strdup_printf (_("%s: %i%%"), mixer_plugin->track_label, (gint) (volume * 100));
-  gtk_tooltips_set_tip (mixer_plugin->tooltips, mixer_plugin->button, tip_text, "test");
-  g_free (tip_text);
-
-  /* Allocate array for track volumes */
-  volumes = g_new (gint, mixer_plugin->track->num_channels);
-
-  /* Determine difference between max and min volume */
-  volume_range = mixer_plugin->track->max_volume - mixer_plugin->track->min_volume;
 
-  /* Determine new volume */
-  new_volume = mixer_plugin->track->min_volume + (volume * volume_range);
+  /* Block the panel menu as long as the config dialog is shown */
+  xfce_panel_plugin_block_menu (plugin);
 
-  /* Set all channel volumes to the new volume */
-  for (i = 0; i < mixer_plugin->track->num_channels; ++i)
-    volumes[i] = new_volume;
+  /* Warn user if no sound cards are available */
+  if (G_UNLIKELY (g_list_length (xfce_mixer_get_cards ()) <= 0))
+    {
+      xfce_dialog_show_error (NULL,
+                              NULL,
+                              _("GStreamer was unable to detect any sound devices. "
+                              "Some sound system specific GStreamer packages may "
+                              "be missing. It may also be a permissions problem.")); 
 
-  /* Apply volume change to the sound card */
-  gst_mixer_set_volume (GST_MIXER (mixer_plugin->card), mixer_plugin->track, volumes);
+    }
+  else
+    {
+      /* Create and run the config dialog */
+      dialog = xfce_plugin_dialog_new (plugin);
+      gtk_dialog_run (GTK_DIALOG (dialog));
 
-  /* Free volume array */
-  g_free (volumes);
+      /* Destroy the config dialog */
+      gtk_widget_destroy (dialog);
+    }
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  mixer_plugin->ignore_bus_messages = FALSE;
-#endif
+  /* Make the plugin menu accessable again */
+  xfce_panel_plugin_unblock_menu (plugin);
 }
 
 
 
-static void
-xfce_mixer_plugin_mute_toggled (XfceMixerPlugin *mixer_plugin,
-                                gboolean         mute)
+static gboolean
+xfce_mixer_plugin_size_changed (XfcePanelPlugin *plugin,
+                                gint             size)
 {
-  g_return_if_fail (mixer_plugin != NULL);
-  g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
-  g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
+  XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  mixer_plugin->ignore_bus_messages = TRUE;
-#endif
+  g_return_val_if_fail (mixer_plugin != NULL, FALSE);
 
-  if (G_LIKELY (xfce_mixer_track_type_new (mixer_plugin->track) == XFCE_MIXER_TRACK_TYPE_PLAYBACK))
-    {
-      /* Apply mute change to the sound card */
-      gst_mixer_set_mute (GST_MIXER (mixer_plugin->card), mixer_plugin->track, mute);
-    }
-  else
-    {
-      /* Toggle capture */
-      gst_mixer_set_record (GST_MIXER (mixer_plugin->card), mixer_plugin->track, !mute);
-    }
+  /* The plugin only occupies a single row */
+  size /= xfce_panel_plugin_get_nrows (XFCE_PANEL_PLUGIN (mixer_plugin));
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  mixer_plugin->ignore_bus_messages = FALSE;
-#endif
+  /* Determine size for the volume button icons */
+  size -= 2 + 2 * MAX (mixer_plugin->button->style->xthickness, mixer_plugin->button->style->ythickness);
+
+  /* Set volume button icon size and update the volume button */
+  xfce_volume_button_set_icon_size (XFCE_VOLUME_BUTTON (mixer_plugin->button), size);
+  xfce_volume_button_update (XFCE_VOLUME_BUTTON (mixer_plugin->button));
+
+  return TRUE;
 }
 
 
@@ -350,7 +460,7 @@ xfce_mixer_plugin_clicked (XfceMixerPlugin *mixer_plugin)
 
       /* Configure the plugin if requested by the user */
       if (G_LIKELY (response == GTK_RESPONSE_ACCEPT))
-        xfce_mixer_plugin_configure (mixer_plugin);
+        xfce_mixer_plugin_configure_plugin (XFCE_PANEL_PLUGIN (mixer_plugin));
 
       return;
     }
@@ -377,151 +487,80 @@ xfce_mixer_plugin_clicked (XfceMixerPlugin *mixer_plugin)
 
 
 static void
-xfce_mixer_plugin_configure (XfceMixerPlugin *mixer_plugin)
+xfce_mixer_plugin_volume_changed (XfceMixerPlugin  *mixer_plugin,
+                                  gdouble           volume)
 {
-  GstElement    *card = NULL;
-  GstMixerTrack *track = NULL;
-  GtkWidget     *dialog;
-  gchar         *command;
+  gchar *tip_text;
+  gint  *volumes;
+  gint   volume_range;
+  gint   new_volume;
+  gint   i;
 
   g_return_if_fail (mixer_plugin != NULL);
+  g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
+  g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
 
-  /* Block the panel menu as long as the config dialog is shown */
-  xfce_panel_plugin_block_menu (mixer_plugin->plugin);
-
-  /* Warn user if no sound cards are available */
-  if (G_UNLIKELY (g_list_length (xfce_mixer_get_cards ()) <= 0))
-    {
-      xfce_dialog_show_error (NULL,
-                              NULL,
-                              _("GStreamer was unable to detect any sound devices. "
-                              "Some sound system specific GStreamer packages may "
-                              "be missing. It may also be a permissions problem.")); 
-
-    }
-  else
-    {
-      /* Create and run the config dialog */
-      dialog = xfce_plugin_dialog_new (mixer_plugin->card, mixer_plugin->track, mixer_plugin->command);
-      gtk_dialog_run (GTK_DIALOG (dialog));
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+  mixer_plugin->ignore_bus_messages = TRUE;
+#endif
 
-      /* Determine which card and mixer track were selected */
-      xfce_plugin_dialog_get_data (XFCE_PLUGIN_DIALOG (dialog), &card, &track, &command);
+  /* Set tooltip (e.g. 'Master: 50%') */
+  tip_text = g_strdup_printf (_("%s: %i%%"), mixer_plugin->track_label, (gint) (volume * 100));
+  gtk_tooltips_set_tip (mixer_plugin->tooltips, mixer_plugin->button, tip_text, "test");
+  g_free (tip_text);
 
-      /* Check if they are valid */
-      if (G_LIKELY (GST_IS_MIXER (card) && GST_IS_MIXER_TRACK (track)))
-        {
-          /* Set card and track of the plugin */
-          xfce_mixer_plugin_set_card (mixer_plugin, card);
-          xfce_mixer_plugin_set_track (mixer_plugin, track);
+  /* Allocate array for track volumes */
+  volumes = g_new (gint, mixer_plugin->track->num_channels);
 
-          /* Update the volume button */
-          xfce_mixer_plugin_update_track (mixer_plugin);
-        }
+  /* Determine difference between max and min volume */
+  volume_range = mixer_plugin->track->max_volume - mixer_plugin->track->min_volume;
 
-      /* Set mixer command */
-      xfce_mixer_plugin_set_command (mixer_plugin, command);
+  /* Determine new volume */
+  new_volume = mixer_plugin->track->min_volume + (volume * volume_range);
 
-      /* Save the plugin configuration */
-      xfce_mixer_plugin_write_config (mixer_plugin);
+  /* Set all channel volumes to the new volume */
+  for (i = 0; i < mixer_plugin->track->num_channels; ++i)
+    volumes[i] = new_volume;
 
-      /* Free mixer command */
-      g_free (command);
+  /* Apply volume change to the sound card */
+  gst_mixer_set_volume (GST_MIXER (mixer_plugin->card), mixer_plugin->track, volumes);
 
-      /* Destroy the config dialog */
-      gtk_widget_destroy (dialog);
-    }
+  /* Free volume array */
+  g_free (volumes);
 
-  /* Make the plugin menu accessable again */
-  xfce_panel_plugin_unblock_menu (mixer_plugin->plugin);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+  mixer_plugin->ignore_bus_messages = FALSE;
+#endif
 }
 
 
 
 static void
-xfce_mixer_plugin_read_config (XfceMixerPlugin *mixer_plugin)
+xfce_mixer_plugin_mute_toggled (XfceMixerPlugin *mixer_plugin,
+                                gboolean         mute)
 {
-  XfceRc        *rc;
-  GstElement    *card;
-  GstMixerTrack *track;
-  const gchar   *card_name = NULL;
-  const gchar   *track_name = NULL;
-  const gchar   *command = DEFAULT_COMMAND;
-  gchar         *filename;
-
   g_return_if_fail (mixer_plugin != NULL);
+  g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
+  g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
 
-  /* Search for the config file */
-  filename = xfce_panel_plugin_lookup_rc_file (mixer_plugin->plugin);
-
-  /* Abort if file cannot be found */
-  if (G_UNLIKELY (filename == NULL))
-    {
-      xfce_mixer_plugin_set_command (mixer_plugin, DEFAULT_COMMAND);
-      return;
-    }
-
-  /* Open rc handle */
-  rc = xfce_rc_simple_open (filename, TRUE);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+  mixer_plugin->ignore_bus_messages = TRUE;
+#endif
 
-  /* Only read config if rc handle could be opened */
-  if (G_LIKELY (rc != NULL))
+  if (G_LIKELY (xfce_mixer_track_type_new (mixer_plugin->track) == XFCE_MIXER_TRACK_TYPE_PLAYBACK))
     {
-      /* Read config values */
-      card_name = xfce_rc_read_entry (rc, "card", card_name);
-      track_name = xfce_rc_read_entry (rc, "track", track_name);
-      command = xfce_rc_read_entry (rc, "command", command);
-
-      /* Get card and track */
-      card = xfce_mixer_get_card (card_name);
-      track = xfce_mixer_get_track (card, track_name);
-
-      /* Update plugin values */
-      xfce_mixer_plugin_set_card (mixer_plugin, card);
-      xfce_mixer_plugin_set_track (mixer_plugin, track);
-      xfce_mixer_plugin_set_command (mixer_plugin, command);
-
-      /* Close rc handle */
-      xfce_rc_close (rc);
+      /* Apply mute change to the sound card */
+      gst_mixer_set_mute (GST_MIXER (mixer_plugin->card), mixer_plugin->track, mute);
     }
-
-  /* Free filename string */
-  g_free (filename);
-}
-
-
-
-static void
-xfce_mixer_plugin_write_config (XfceMixerPlugin *mixer_plugin)
-{
-  XfceRc *rc;
-  gchar  *filename;
-
-  g_return_if_fail (mixer_plugin != NULL);
-
-  /* Search for the config file */
-  filename = xfce_panel_plugin_save_location (mixer_plugin->plugin, TRUE);
-
-  /* Abort saving if the file does not exist and could not be created */
-  if (G_UNLIKELY (filename == NULL))
-    return;
-
-  /* Open rc handle */
-  rc = xfce_rc_simple_open (filename, FALSE);
-
-  if (G_LIKELY (rc != NULL))
+  else
     {
-      /* Write plugin values to the config file */
-      xfce_rc_write_entry (rc, "card", xfce_mixer_get_card_internal_name (mixer_plugin->card));
-      xfce_rc_write_entry (rc, "track", mixer_plugin->track_label);
-      xfce_rc_write_entry (rc, "command", mixer_plugin->command);
-
-      /* Close the rc handle */
-      xfce_rc_close (rc);
+      /* Toggle capture */
+      gst_mixer_set_record (GST_MIXER (mixer_plugin->card), mixer_plugin->track, !mute);
     }
 
-  /* Free filename string */
-  g_free (filename);
+#ifdef HAVE_GST_MIXER_NOTIFICATION
+  mixer_plugin->ignore_bus_messages = FALSE;
+#endif
 }
 
 
@@ -536,9 +575,14 @@ xfce_mixer_plugin_update_track (XfceMixerPlugin *mixer_plugin)
   gint              *volumes;
   gchar             *tip_text;
 
-  g_return_if_fail (mixer_plugin != NULL);
-  g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
-  g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
+  g_return_if_fail (IS_XFCE_MIXER_PLUGIN (mixer_plugin));
+
+  /* Reset tooltip and return if the card or track is invalid */
+  if (!GST_IS_MIXER (mixer_plugin->card) || !GST_IS_MIXER_TRACK (mixer_plugin->track))
+    {
+      gtk_tooltips_set_tip (mixer_plugin->tooltips, mixer_plugin->button, NULL, NULL);
+      return;
+    }
 
   /* Get volumes of the mixer track */
   volumes = g_new (gint, mixer_plugin->track->num_channels);
@@ -588,6 +632,9 @@ xfce_mixer_plugin_bus_message (GstBus          *bus,
   if (G_UNLIKELY (mixer_plugin->ignore_bus_messages))
     return;
 
+  if (G_UNLIKELY (!GST_IS_MIXER (mixer_plugin->card) || !GST_IS_MIXER_TRACK (mixer_plugin->track) || mixer_plugin->track_label == NULL))
+    return;
+
   if (G_UNLIKELY (GST_MESSAGE_SRC (message) != GST_OBJECT (mixer_plugin->card)))
     return;
 
@@ -630,58 +677,3 @@ xfce_mixer_plugin_bus_message (GstBus          *bus,
     }
 }
 #endif
-
-
-
-static void
-xfce_mixer_plugin_set_card (XfceMixerPlugin *mixer_plugin,
-                            GstElement      *card)
-{
-  g_return_if_fail (mixer_plugin != NULL);
-  g_return_if_fail (GST_IS_MIXER (card));
-
-  mixer_plugin->card = card;
-
-  xfce_mixer_select_card (mixer_plugin->card);
-
-#ifdef HAVE_GST_MIXER_NOTIFICATION
-  mixer_plugin->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_plugin_bus_message), mixer_plugin);
-#endif
-}
-
-
-
-static void
-xfce_mixer_plugin_set_track (XfceMixerPlugin *mixer_plugin,
-                             GstMixerTrack   *track)
-{
-  g_return_if_fail (mixer_plugin != NULL);
-  g_return_if_fail (GST_IS_MIXER_TRACK (track));
-
-  mixer_plugin->track = track;
-
-  /* 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);
-}
-
-
-
-static void
-xfce_mixer_plugin_set_command (XfceMixerPlugin *mixer_plugin,
-                               const gchar     *command)
-{
-  g_return_if_fail (mixer_plugin != NULL);
-
-  if (G_LIKELY (mixer_plugin->command != NULL))
-    {
-      if (G_UNLIKELY (g_utf8_collate (mixer_plugin->command, command) == 0))
-        return;
-
-      g_free (mixer_plugin->command);
-    }
-
-  mixer_plugin->command = g_strdup (command);
-}
diff --git a/panel-plugin/xfce-mixer-plugin.h b/panel-plugin/xfce-mixer-plugin.h
new file mode 100644
index 0000000..3017b5d
--- /dev/null
+++ b/panel-plugin/xfce-mixer-plugin.h
@@ -0,0 +1,44 @@
+/* vi:set expandtab sw=2 sts=2: */
+/*-
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __XFCE_MIXER_PLUGIN_H__
+#define __XFCE_MIXER_PLUGIN_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _XfceMixerPluginClass XfceMixerPluginClass;
+typedef struct _XfceMixerPlugin      XfceMixerPlugin;
+
+#define TYPE_XFCE_MIXER_PLUGIN            (xfce_mixer_plugin_get_type ())
+#define XFCE_MIXER_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XFCE_MIXER_PLUGIN, XfceMixerPlugin))
+#define XFCE_MIXER_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XFCE_MIXER_PLUGIN, XfceMixerPluginClass))
+#define IS_XFCE_MIXER_PLUGIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XFCE_MIXER_PLUGIN))
+#define IS_XFCE_MIXER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XFCE_MIXER_PLUGIN))
+#define XFCE_MIXER_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XFCE_MIXER_PLUGIN, XfceMixerPluginClass))
+
+GType     xfce_mixer_plugin_get_type       (void) G_GNUC_CONST;
+
+void  xfce_mixer_plugin_register_type (XfcePanelTypeModule *type_module);
+
+G_END_DECLS;
+
+#endif /* !__XFCE_MIXER_PLUGIN_H__ */
diff --git a/panel-plugin/xfce-plugin-dialog.c b/panel-plugin/xfce-plugin-dialog.c
index b6e627b..789a18c 100644
--- a/panel-plugin/xfce-plugin-dialog.c
+++ b/panel-plugin/xfce-plugin-dialog.c
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,30 +29,40 @@
 #include <gst/interfaces/mixer.h>
 
 #include <libxfce4ui/libxfce4ui.h>
+#include <libxfce4panel/libxfce4panel.h>
+#include <xfconf/xfconf.h>
 
 #include "libxfce4mixer/libxfce4mixer.h"
 
+#include "xfce-mixer-plugin.h"
+
 #include "xfce-plugin-dialog.h"
 
 
 
-static void xfce_plugin_dialog_class_init             (XfcePluginDialogClass *klass);
-static void xfce_plugin_dialog_init                   (XfcePluginDialog      *dialog);
-static void xfce_plugin_dialog_dispose                (GObject               *object);
-static void xfce_plugin_dialog_finalize               (GObject               *object);
-static void xfce_plugin_dialog_create_contents        (XfcePluginDialog      *dialog,
-                                                       GstElement            *card_name,
-                                                       GstMixerTrack         *track_name,
-                                                       const gchar           *command);
-static void xfce_plugin_dialog_soundcard_changed      (XfceMixerCardCombo    *combo,
-                                                       GstElement            *card,
-                                                       XfcePluginDialog      *dialog);
-static void xfce_plugin_dialog_update_tracks          (XfcePluginDialog      *dialog,
-                                                       GstElement            *card);
-static void xfce_plugin_dialog_track_changed          (XfceMixerTrackCombo   *combo,
-                                                       GstMixerTrack         *track,
-                                                       XfcePluginDialog      *dialog);
-static void xfce_plugin_dialog_command_button_clicked (XfcePluginDialog      *dialog);
+static void xfce_plugin_dialog_class_init                 (XfcePluginDialogClass *klass);
+static void xfce_plugin_dialog_init                       (XfcePluginDialog      *dialog);
+static void xfce_plugin_dialog_dispose                    (GObject               *object);
+static void xfce_plugin_dialog_finalize                   (GObject               *object);
+static void xfce_plugin_dialog_create_contents            (XfcePluginDialog      *dialog);
+static void xfce_plugin_dialog_command_button_clicked     (XfcePluginDialog      *dialog);
+static void xfce_plugin_dialog_soundcard_changed          (XfcePluginDialog      *dialog,
+                                                           GstElement            *card,
+                                                           XfceMixerCardCombo    *combo);
+static void xfce_plugin_dialog_track_changed              (XfcePluginDialog      *dialog,
+                                                           GstMixerTrack         *track,
+                                                           XfceMixerTrackCombo   *combo);
+static void xfce_plugin_dialog_command_entry_changed      (XfcePluginDialog      *dialog,
+                                                           GtkEditable           *editable);
+static void xfce_plugin_dialog_soundcard_property_changed (XfcePluginDialog      *dialog,
+                                                           GParamSpec            *pspec,
+                                                           GObject               *object);
+static void xfce_plugin_dialog_track_property_changed     (XfcePluginDialog      *dialog,
+                                                           GParamSpec            *pspec,
+                                                           GObject               *object);
+static void xfce_plugin_dialog_command_property_changed   (XfcePluginDialog      *dialog,
+                                                           GParamSpec            *pspec,
+                                                           GObject               *object);
 
 
 
@@ -60,13 +71,17 @@ struct _XfcePluginDialogClass
   XfceTitledDialogClass __parent__;
 };
 
+
+
 struct _XfcePluginDialog
 {
-  XfceTitledDialog __parent__;
+  XfceTitledDialog  __parent__;
+
+  XfceMixerPlugin  *plugin;
 
-  GtkWidget    *card_combo;
-  GtkWidget    *track_combo;
-  GtkWidget    *command_entry;
+  GtkWidget        *card_combo;
+  GtkWidget        *track_combo;
+  GtkWidget        *command_entry;
 };
 
 
@@ -122,6 +137,10 @@ xfce_plugin_dialog_class_init (XfcePluginDialogClass *klass)
 static void
 xfce_plugin_dialog_init (XfcePluginDialog *dialog)
 {
+  dialog->card_combo = NULL;
+  dialog->track_combo = NULL;
+  dialog->command_entry = NULL;
+  dialog->plugin = NULL;
 }
 
 
@@ -129,6 +148,12 @@ xfce_plugin_dialog_init (XfcePluginDialog *dialog)
 static void
 xfce_plugin_dialog_dispose (GObject *object)
 {
+  XfcePluginDialog *dialog = XFCE_PLUGIN_DIALOG (object);
+
+  g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_soundcard_property_changed, dialog);
+  g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_track_property_changed, dialog);
+  g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_command_property_changed, dialog);
+
   (*G_OBJECT_CLASS (xfce_plugin_dialog_parent_class)->dispose) (object);
 }
 
@@ -137,96 +162,35 @@ xfce_plugin_dialog_dispose (GObject *object)
 static void
 xfce_plugin_dialog_finalize (GObject *object)
 {
-#if 0
-  XfcePluginDialog *dialog = XFCE_PLUGIN_DIALOG (object);
-#endif
   (*G_OBJECT_CLASS (xfce_plugin_dialog_parent_class)->finalize) (object);
 }
 
 
 
 GtkWidget*
-xfce_plugin_dialog_new (GstElement    *active_card,
-                        GstMixerTrack *active_track,
-                        const gchar   *command)
+xfce_plugin_dialog_new (XfcePanelPlugin *plugin)
 {
   XfcePluginDialog *dialog;
-  
+
   dialog = XFCE_PLUGIN_DIALOG (g_object_new (TYPE_XFCE_PLUGIN_DIALOG, NULL));
+  dialog->plugin = XFCE_MIXER_PLUGIN (plugin);
 
-  xfce_plugin_dialog_create_contents (dialog, active_card, active_track, command);
+  xfce_plugin_dialog_create_contents (dialog);
 
   return GTK_WIDGET (dialog);
 }
 
 
 
-static void 
-xfce_plugin_dialog_soundcard_changed (XfceMixerCardCombo *combo,
-                                      GstElement         *card,
-                                      XfcePluginDialog   *dialog)
-{
-  xfce_plugin_dialog_update_tracks (dialog, card);
-}
-
-
-
-static void 
-xfce_plugin_dialog_update_tracks (XfcePluginDialog *dialog,
-                                  GstElement       *card)
-{
-  xfce_mixer_track_combo_set_soundcard (XFCE_MIXER_TRACK_COMBO (dialog->track_combo), card);
-}
-
-
-
-void
-xfce_plugin_dialog_get_data (XfcePluginDialog *dialog,
-                             GstElement      **card,
-                             GstMixerTrack   **track,
-                             gchar           **command)
-{
-  GstElement    *active_card;
-  GstMixerTrack *active_track;
-
-  g_return_if_fail (IS_XFCE_PLUGIN_DIALOG (dialog));
-
-  active_card = xfce_mixer_card_combo_get_active_card (XFCE_MIXER_CARD_COMBO (dialog->card_combo));
-
-  if (G_LIKELY (GST_IS_MIXER (active_card)))
-    *card = active_card;
-
-  active_track = xfce_mixer_track_combo_get_active_track (XFCE_MIXER_TRACK_COMBO (dialog->track_combo));
-
-  if (G_LIKELY (GST_IS_MIXER_TRACK (active_track)))
-    *track = active_track;
-
-  *command = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->command_entry)));
-}
-
-
-
-static void 
-xfce_plugin_dialog_track_changed (XfceMixerTrackCombo *combo,
-                                  GstMixerTrack       *track,
-                                  XfcePluginDialog    *dialog)
-{
-}
-
-
-
 static void
-xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog,
-                                    GstElement       *active_card,
-                                    GstMixerTrack    *active_track,
-                                    const gchar      *command)
+xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog)
 {
-  GtkWidget  *alignment;
-  GtkWidget  *vbox;
-  GtkWidget  *hbox;
-  GtkWidget  *button;
-  GtkWidget  *label;
-  gchar      *title;
+  GtkWidget     *alignment;
+  GtkWidget     *vbox;
+  GtkWidget     *hbox;
+  GtkWidget     *button;
+  GtkWidget     *label;
+  gchar         *title;
 
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "multimedia-volume-control");
   gtk_window_set_title (GTK_WINDOW (dialog), _("Mixer Plugin"));
@@ -255,8 +219,7 @@ xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog,
   gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 0);
   gtk_widget_show (alignment);
 
-  dialog->card_combo = xfce_mixer_card_combo_new (active_card);
-  g_signal_connect (G_OBJECT (dialog->card_combo), "soundcard-changed", G_CALLBACK (xfce_plugin_dialog_soundcard_changed), dialog);
+  dialog->card_combo = xfce_mixer_card_combo_new (NULL);
   gtk_container_add (GTK_CONTAINER (alignment), dialog->card_combo);
   gtk_widget_show (dialog->card_combo);
 
@@ -273,8 +236,7 @@ xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog,
   gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 0);
   gtk_widget_show (alignment);
 
-  dialog->track_combo = xfce_mixer_track_combo_new (active_card, active_track);
-  g_signal_connect (G_OBJECT (dialog->track_combo), "track-changed", G_CALLBACK (xfce_plugin_dialog_track_changed), dialog);
+  dialog->track_combo = xfce_mixer_track_combo_new (NULL, NULL);
   gtk_container_add (GTK_CONTAINER (alignment), dialog->track_combo);
   gtk_widget_show (dialog->track_combo);
 
@@ -296,7 +258,6 @@ xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog,
   gtk_widget_show (hbox);
 
   dialog->command_entry = gtk_entry_new ();
-  gtk_entry_set_text (GTK_ENTRY (dialog->command_entry), command);
   gtk_box_pack_start (GTK_BOX (hbox), dialog->command_entry, TRUE, TRUE, 0);
   gtk_widget_show (dialog->command_entry);
 
@@ -304,6 +265,19 @@ xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog,
   g_signal_connect_swapped (button, "clicked", G_CALLBACK (xfce_plugin_dialog_command_button_clicked), dialog);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
+
+  /* Hack to initialize the widget state */
+  xfce_plugin_dialog_soundcard_property_changed (dialog, g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (dialog->plugin)), "sound-card"), G_OBJECT (dialog->plugin));
+  xfce_plugin_dialog_track_property_changed (dialog, g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (dialog->plugin)), "track"), G_OBJECT (dialog->plugin));
+  xfce_plugin_dialog_command_property_changed (dialog, g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (dialog->plugin)), "command"), G_OBJECT (dialog->plugin));
+
+  g_signal_connect_swapped (G_OBJECT (dialog->card_combo), "soundcard-changed", G_CALLBACK (xfce_plugin_dialog_soundcard_changed), dialog);
+  g_signal_connect_swapped (G_OBJECT (dialog->track_combo), "track-changed", G_CALLBACK (xfce_plugin_dialog_track_changed), dialog);
+  g_signal_connect_swapped (G_OBJECT (dialog->command_entry), "changed", G_CALLBACK (xfce_plugin_dialog_command_entry_changed), dialog);
+
+  g_signal_connect_swapped (G_OBJECT (dialog->plugin), "notify::sound-card", G_CALLBACK (xfce_plugin_dialog_soundcard_property_changed), dialog);
+  g_signal_connect_swapped (G_OBJECT (dialog->plugin), "notify::track", G_CALLBACK (xfce_plugin_dialog_track_property_changed), dialog);
+  g_signal_connect_swapped (G_OBJECT (dialog->plugin), "notify::command", G_CALLBACK (xfce_plugin_dialog_command_property_changed), dialog);
 }
 
 
@@ -388,3 +362,165 @@ xfce_plugin_dialog_command_button_clicked (XfcePluginDialog *dialog)
   /* Destroy the dialog */
   gtk_widget_destroy (chooser);
 }
+
+
+
+static void 
+xfce_plugin_dialog_soundcard_changed (XfcePluginDialog   *dialog,
+                                      GstElement         *card,
+                                      XfceMixerCardCombo *combo)
+{
+  const gchar *card_name;
+
+  card_name = xfce_mixer_get_card_internal_name (card);
+
+  g_signal_handlers_block_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_soundcard_property_changed, dialog);
+  g_signal_handlers_block_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_track_property_changed, dialog);
+  g_object_set (G_OBJECT (dialog->plugin), "sound-card", card_name, NULL);
+  g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_track_property_changed, dialog);
+  g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_soundcard_property_changed, dialog);
+
+  xfce_mixer_track_combo_set_soundcard (XFCE_MIXER_TRACK_COMBO (dialog->track_combo), card);
+}
+
+
+
+static void
+xfce_plugin_dialog_track_changed (XfcePluginDialog    *dialog,
+                                  GstMixerTrack       *track,
+                                  XfceMixerTrackCombo *combo)
+{
+  gchar *track_label;
+
+  g_object_get (G_OBJECT (track), "label", &track_label, NULL);
+
+  g_signal_handlers_block_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_track_property_changed, dialog);
+  g_object_set (G_OBJECT (dialog->plugin), "track", track_label, NULL);
+  g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_track_property_changed, dialog);
+
+  g_free (track_label);
+}
+
+
+
+static void
+xfce_plugin_dialog_command_entry_changed (XfcePluginDialog *dialog,
+                                          GtkEditable      *editable)
+{
+  gchar *command;
+
+  command = gtk_editable_get_chars (editable, 0, -1);
+
+  g_signal_handlers_block_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_command_property_changed, dialog);
+  g_object_set (G_OBJECT (dialog->plugin), "command", command, NULL);
+  g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), xfce_plugin_dialog_command_property_changed, dialog);
+
+  g_free (command);
+}
+
+
+
+static void
+xfce_plugin_dialog_soundcard_property_changed (XfcePluginDialog *dialog,
+                                               GParamSpec       *pspec,
+                                               GObject          *object)
+{
+  GstElement  *old_card;
+  GstElement  *new_card = NULL;
+  gchar       *new_card_name;
+  const gchar *old_card_name = NULL;
+
+  g_return_if_fail (IS_XFCE_PLUGIN_DIALOG (dialog));
+  g_return_if_fail (G_IS_OBJECT (object));
+  g_return_if_fail (IS_XFCE_MIXER_CARD_COMBO (dialog->card_combo));
+  g_return_if_fail (IS_XFCE_MIXER_TRACK_COMBO (dialog->track_combo));
+
+  g_object_get (object, "sound-card", &new_card_name, NULL);
+  if (new_card_name != NULL)
+    new_card = xfce_mixer_get_card (new_card_name);
+
+  old_card = xfce_mixer_card_combo_get_active_card (XFCE_MIXER_CARD_COMBO (dialog->card_combo));
+  if (GST_IS_MIXER (old_card))
+    old_card_name = xfce_mixer_get_card_internal_name (old_card);
+
+  if (xfce_mixer_utf8_cmp (old_card_name, new_card_name) != 0)
+    {
+      g_signal_handlers_block_by_func (object, xfce_plugin_dialog_soundcard_changed, dialog);
+      g_signal_handlers_block_by_func (object, xfce_plugin_dialog_track_changed, dialog);
+      /* If "sound-card" is NULL, this will take care of resetting it to the default */
+      xfce_mixer_card_combo_set_active_card (XFCE_MIXER_CARD_COMBO (dialog->card_combo), new_card);
+      xfce_mixer_track_combo_set_soundcard (XFCE_MIXER_TRACK_COMBO (dialog->track_combo), new_card);
+      g_signal_handlers_unblock_by_func (object, xfce_plugin_dialog_track_changed, dialog);
+      g_signal_handlers_unblock_by_func (object, xfce_plugin_dialog_soundcard_changed, dialog);
+    }
+
+  g_free (new_card_name);
+}
+
+
+
+static void
+xfce_plugin_dialog_track_property_changed (XfcePluginDialog *dialog,
+                                           GParamSpec       *pspec,
+                                           GObject          *object)
+{
+  GstElement    *card;
+  GstMixerTrack *old_track;
+  GstMixerTrack *new_track = NULL;
+  gchar         *old_track_label = NULL;
+  gchar         *new_track_label = NULL;
+
+  g_return_if_fail (IS_XFCE_PLUGIN_DIALOG (dialog));
+  g_return_if_fail (G_IS_OBJECT (object));
+  g_return_if_fail (IS_XFCE_MIXER_CARD_COMBO (dialog->card_combo));
+  g_return_if_fail (IS_XFCE_MIXER_TRACK_COMBO (dialog->track_combo));
+
+  g_object_get (object, "track", &new_track_label, NULL);
+
+  card = xfce_mixer_card_combo_get_active_card (XFCE_MIXER_CARD_COMBO (dialog->card_combo));
+  if (new_track_label != NULL && GST_IS_MIXER (card))
+    new_track = xfce_mixer_get_track (card, new_track_label);
+
+  old_track = xfce_mixer_track_combo_get_active_track (XFCE_MIXER_TRACK_COMBO (dialog->track_combo));
+  if (GST_IS_MIXER_TRACK (old_track))
+    g_object_get (G_OBJECT (old_track), "label", &old_track_label, NULL);
+
+  if (xfce_mixer_utf8_cmp (old_track_label, new_track_label) != 0)
+    {
+      g_signal_handlers_block_by_func (object, xfce_plugin_dialog_track_changed, dialog);
+      /* If track has been removed, this will take care of resetting it to the default */
+      xfce_mixer_track_combo_set_active_track (XFCE_MIXER_TRACK_COMBO (dialog->track_combo), new_track);
+      g_signal_handlers_unblock_by_func (object, xfce_plugin_dialog_track_changed, dialog);
+    }
+
+  g_free (new_track_label);
+  g_free (old_track_label);
+}
+
+
+
+static void
+xfce_plugin_dialog_command_property_changed (XfcePluginDialog *dialog,
+                                             GParamSpec       *pspec,
+                                             GObject          *object)
+{
+  gchar *command;
+
+  g_return_if_fail (IS_XFCE_PLUGIN_DIALOG (dialog));
+  g_return_if_fail (G_IS_OBJECT (object));
+
+  g_object_get (object, "command", &command, NULL);
+
+  if (xfce_mixer_utf8_cmp (gtk_entry_get_text (GTK_ENTRY (dialog->command_entry)), command) != 0)
+    {
+      g_signal_handlers_block_by_func (object, xfce_plugin_dialog_command_entry_changed, dialog);
+      if (command != NULL)
+        gtk_entry_set_text (GTK_ENTRY (dialog->command_entry), command);
+      else
+        gtk_entry_set_text (GTK_ENTRY (dialog->command_entry), "");
+      g_signal_handlers_unblock_by_func (object, xfce_plugin_dialog_command_entry_changed, dialog);
+    }
+
+  g_free (command);
+}
+
diff --git a/panel-plugin/xfce-plugin-dialog.h b/panel-plugin/xfce-plugin-dialog.h
index 31b079d..3588400 100644
--- a/panel-plugin/xfce-plugin-dialog.h
+++ b/panel-plugin/xfce-plugin-dialog.h
@@ -1,6 +1,7 @@
 /* vi:set expandtab sw=2 sts=2: */
 /*-
  * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,16 +39,11 @@ typedef struct _XfcePluginDialog      XfcePluginDialog;
 #define IS_XFCE_PLUGIN_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XFCE_PLUGIN_DIALOG))
 #define XFCE_PLUGIN_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XFCE_PLUGIN_DIALOG, XfcePluginDialogClass))
 
-GType     xfce_plugin_dialog_get_type  (void) G_GNUC_CONST;
+#define XFCE_MIXER_PLUGIN_DEFAULT_COMMAND "xfce4-mixer"
 
-GtkWidget *xfce_plugin_dialog_new      (GstElement    *active_card,
-                                        GstMixerTrack *active_track,
-                                        const gchar   *command);
+GType     xfce_plugin_dialog_get_type  (void) G_GNUC_CONST;
 
-void       xfce_plugin_dialog_get_data (XfcePluginDialog *dialog,
-                                        GstElement      **card,
-                                        GstMixerTrack   **track,
-                                        gchar           **command);
+GtkWidget *xfce_plugin_dialog_new (XfcePanelPlugin *plugin);
 
 G_END_DECLS;
 


More information about the Xfce4-commits mailing list