[ekiga/ds-gsettings3: 22/33] GSettings: Migrated sound events, audio output and audio input settins.



commit 7a998bef415adf66dfd0ab0eee2686a72f79d776
Author: Damien Sandras <dsandras beip be>
Date:   Sat Apr 27 17:29:11 2013 +0200

    GSettings: Migrated sound events, audio output and audio input settins.
    
    Some code was also cleaned up.

 lib/Makefile.am                                    |    4 -
 lib/ekiga-settings.h                               |    1 +
 lib/engine/audioinput/audioinput-core.cpp          |   38 ++-
 lib/engine/audioinput/audioinput-core.h            |   12 +-
 lib/engine/audioinput/audioinput-gmconf-bridge.cpp |   63 ---
 lib/engine/audioinput/audioinput-gmconf-bridge.h   |   64 ---
 lib/engine/audiooutput/audiooutput-core.cpp        |  113 +++++-
 lib/engine/audiooutput/audiooutput-core.h          |   79 ++--
 .../audiooutput/audiooutput-gmconf-bridge.cpp      |  127 ------
 lib/engine/audiooutput/audiooutput-gmconf-bridge.h |   64 ---
 lib/engine/components/opal/h323-endpoint.cpp       |    1 +
 lib/engine/components/opal/sip-endpoint.cpp        |    1 +
 lib/engine/engine.cpp                              |    4 +-
 lib/engine/gui/gtk-frontend/main_window.cpp        |   38 ++-
 lib/engine/gui/gtk-frontend/preferences-window.cpp |  438 +++++++++++++++++++-
 lib/gmconf/gmconf-ekiga-keys.h                     |    1 -
 lib/gmconf/gmconf-upgrade.c                        |   28 +--
 17 files changed, 657 insertions(+), 419 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8ae687c..5a46ae6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -363,8 +363,6 @@ libekiga_la_SOURCES += \
        engine/audiooutput/audiooutput-scheduler.cpp \
        engine/audiooutput/audiooutput-core.h \
        engine/audiooutput/audiooutput-core.cpp \
-       engine/audiooutput/audiooutput-gmconf-bridge.h \
-       engine/audiooutput/audiooutput-gmconf-bridge.cpp
 
 ##
 # Sources of the audio input stack
@@ -375,8 +373,6 @@ libekiga_la_SOURCES += \
        engine/audioinput/audioinput-info.h     \
        engine/audioinput/audioinput-core.h     \
        engine/audioinput/audioinput-core.cpp       \
-       engine/audioinput/audioinput-gmconf-bridge.h \
-       engine/audioinput/audioinput-gmconf-bridge.cpp
 
 ##
 # Sources of the hardware abstraction layer (HAL) stack
diff --git a/lib/ekiga-settings.h b/lib/ekiga-settings.h
index eebc8bd..5514a04 100644
--- a/lib/ekiga-settings.h
+++ b/lib/ekiga-settings.h
@@ -42,5 +42,6 @@
 #define USER_INTERFACE "org.gnome." PACKAGE_NAME ".general.user-interface"
 
 #define SOUND_EVENTS_SCHEMA "org.gnome." PACKAGE_NAME ".general.sound-events"
+#define AUDIO_DEVICES_SCHEMA "org.gnome." PACKAGE_NAME ".devices.audio"
 
 #endif /* EKIGA_SETTINGS_H */
diff --git a/lib/engine/audioinput/audioinput-core.cpp b/lib/engine/audioinput/audioinput-core.cpp
index b205e16..f26e1a0 100644
--- a/lib/engine/audioinput/audioinput-core.cpp
+++ b/lib/engine/audioinput/audioinput-core.cpp
@@ -39,10 +39,25 @@
 
 #include <glib/gi18n.h>
 
+#include "config.h"
+
+#include "ekiga-settings.h"
+
 #include "audioinput-core.h"
 
 using namespace Ekiga;
 
+static void audio_device_changed (G_GNUC_UNUSED GSettings *settings,
+                                  G_GNUC_UNUSED const gchar *key,
+                                  gpointer data)
+{
+  g_return_if_fail (data != NULL);
+
+  AudioInputCore *core = (AudioInputCore*) (data);
+  core->setup ();
+}
+
+
 AudioInputCore::AudioInputCore (Ekiga::ServiceCore & _core) : core(_core)
 {
   PWaitAndSignal m_var(core_mutex);
@@ -66,34 +81,43 @@ AudioInputCore::AudioInputCore (Ekiga::ServiceCore & _core) : core(_core)
   current_volume = 0;
 
   current_manager = NULL;
-  audioinput_core_conf_bridge = NULL;
   average_level = 0;
   calculate_average = false;
   yield = false;
 
   notification_core = core.get<Ekiga::NotificationCore> ("notification-core");
+  audio_device_settings = g_settings_new (AUDIO_DEVICES_SCHEMA);
+  audio_device_settings_signal = 0;
 }
 
 AudioInputCore::~AudioInputCore ()
 {
   PWaitAndSignal m(core_mutex);
 
-  if (audioinput_core_conf_bridge)
-    delete audioinput_core_conf_bridge;
-
   for (std::set<AudioInputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++)
     delete (*iter);
+  g_clear_object (&audio_device_settings);
 
   managers.clear();
 }
 
-void AudioInputCore::setup_conf_bridge ()
+void AudioInputCore::setup ()
 {
   PWaitAndSignal m(core_mutex);
+  gchar* audio_device = NULL;
+
+  audio_device = g_settings_get_string (audio_device_settings, "input-device");
+
+  set_device (audio_device);
+
+  if (audio_device_settings_signal == 0)
+    audio_device_settings_signal =
+      g_signal_connect (audio_device_settings, "changed::input-device",
+                        G_CALLBACK (audio_device_changed), this);
 
-  audioinput_core_conf_bridge = new AudioInputCoreConfBridge (*this);
+  g_free (audio_device);
 }
 
 void AudioInputCore::add_manager (AudioInputManager &manager)
@@ -374,7 +398,7 @@ void AudioInputCore::set_volume (unsigned volume)
 
 void AudioInputCore::on_set_device (const AudioInputDevice & device)
 {
-  gm_conf_set_string (AUDIO_DEVICES_KEY "input_device", device.GetString ().c_str ());
+  g_settings_set_string (audio_device_settings, "input-device", device.GetString ().c_str ());
 }
 
 void AudioInputCore::on_device_opened (AudioInputDevice device,
diff --git a/lib/engine/audioinput/audioinput-core.h b/lib/engine/audioinput/audioinput-core.h
index 60901d3..05b9fb5 100644
--- a/lib/engine/audioinput/audioinput-core.h
+++ b/lib/engine/audioinput/audioinput-core.h
@@ -43,10 +43,11 @@
 #include "audioinput-manager.h"
 #include "notification-core.h"
 #include "hal-core.h"
-#include "audioinput-gmconf-bridge.h"
 
 #include <ptlib.h>
 
+#include <gio/gio.h>
+
 #define AUDIO_INPUT_FALLBACK_DEVICE_TYPE   "Ekiga"
 #define AUDIO_INPUT_FALLBACK_DEVICE_SOURCE "Ekiga"
 #define AUDIO_INPUT_FALLBACK_DEVICE_NAME   "SILENT"
@@ -101,9 +102,9 @@ namespace Ekiga
       */
       ~AudioInputCore ();
 
-      /** Set up gmconf bridge
+      /** Set up devices
        */
-      void setup_conf_bridge();
+      void setup ();
 
 
       /*** Service Implementation ***/
@@ -315,14 +316,15 @@ namespace Ekiga
       PMutex core_mutex;
       PMutex volume_mutex;
 
-      AudioInputCoreConfBridge* audioinput_core_conf_bridge;
-
       float average_level;
       bool calculate_average;
       bool yield;
 
       Ekiga::ServiceCore & core;
       boost::shared_ptr<Ekiga::NotificationCore> notification_core;
+
+      GSettings *audio_device_settings;
+      guint audio_device_settings_signal;
     };
 /**
  * @}
diff --git a/lib/engine/audiooutput/audiooutput-core.cpp b/lib/engine/audiooutput/audiooutput-core.cpp
index 0ac44b7..7c0bba2 100644
--- a/lib/engine/audiooutput/audiooutput-core.cpp
+++ b/lib/engine/audiooutput/audiooutput-core.cpp
@@ -57,6 +57,25 @@ static void sound_event_changed (G_GNUC_UNUSED GSettings *settings,
   core->setup_sound_events (key);
 }
 
+static void audio_device_changed (GSettings *settings,
+                                  G_GNUC_UNUSED const gchar *key,
+                                  gpointer data)
+{
+  g_return_if_fail (data != NULL);
+
+  AudioOutputCore *core = (AudioOutputCore*) (data);
+  gchar *schema_id = NULL;
+
+  g_object_get (settings, "schema-id", &schema_id, NULL);
+
+  g_return_if_fail (schema_id != NULL);
+
+  if (!g_strcmp0 (schema_id, AUDIO_DEVICES_SCHEMA))
+    core->setup_audio_device ();
+  else if (!g_strcmp0 (schema_id, SOUND_EVENTS_SCHEMA))
+    core->setup_audio_device (secondary);
+}
+
 
 AudioOutputCore::AudioOutputCore (Ekiga::ServiceCore& core)
 {
@@ -78,15 +97,15 @@ AudioOutputCore::AudioOutputCore (Ekiga::ServiceCore& core)
 
   current_manager[primary] = NULL;
   current_manager[secondary] = NULL;
-  audiooutput_core_conf_bridge = NULL;
   average_level = 0;
   calculate_average = false;
   yield = false;
 
   notification_core = core.get<Ekiga::NotificationCore> ("notification-core");
   sound_events_settings = g_settings_new (SOUND_EVENTS_SCHEMA);
-
-  setup_sound_events ();
+  audio_device_settings = g_settings_new (AUDIO_DEVICES_SCHEMA);
+  audio_device_settings_signals[primary] = 0;
+  audio_device_settings_signals[secondary] = 0;
 }
 
 AudioOutputCore::~AudioOutputCore ()
@@ -94,9 +113,6 @@ AudioOutputCore::~AudioOutputCore ()
   PWaitAndSignal m_pri(core_mutex[primary]);
   PWaitAndSignal m_sec(core_mutex[secondary]);
 
-  if (audiooutput_core_conf_bridge)
-    delete audiooutput_core_conf_bridge;
-
   audio_event_scheduler->quit ();
 
   for (std::set<AudioOutputManager *>::iterator iter = managers.begin ();
@@ -105,16 +121,82 @@ AudioOutputCore::~AudioOutputCore ()
     delete (*iter);
 
   managers.clear();
+
+  g_clear_object (&sound_events_settings);
+  g_clear_object (&audio_device_settings);
+}
+
+
+void AudioOutputCore::setup ()
+{
+  setup_audio_device (primary);
+  setup_audio_device (secondary);
+  setup_sound_events ();
 }
 
-void AudioOutputCore::setup_conf_bridge ()
+void AudioOutputCore::setup_audio_device (AudioOutputPS device_idx)
 {
   PWaitAndSignal m_pri(core_mutex[primary]);
   PWaitAndSignal m_sec(core_mutex[secondary]);
+  AudioOutputDevice device;
+
+  std::vector <AudioOutputDevice> devices;
+  bool found = false;
 
-   audiooutput_core_conf_bridge = new AudioOutputCoreConfBridge (*this);
+  gchar* audio_device = NULL;
+
+  audio_device = (device_idx == primary) ?
+    g_settings_get_string (audio_device_settings, "output-device")
+    :
+    g_settings_get_string (sound_events_settings, "output-device");
+
+  get_devices (devices);
+  if (audio_device != NULL) {
+    for (std::vector<AudioOutputDevice>::iterator it = devices.begin ();
+         it < devices.end ();
+         it++) {
+      if ((*it).GetString () == audio_device) {
+        found = true;
+        break;
+      }
+    }
+  }
+
+  if (found) {
+    device.SetFromString (audio_device);
+  }
+  else {
+    if (!devices.empty())
+      device.SetFromString (devices.begin ()->GetString ());
+    else {
+      // if there is no audio device / ptlib plugin, use fallback device below
+      device.type = "";
+    }
+  }
+
+  if (audio_device == NULL || !g_strcmp0 (audio_device, "")
+      || device.type.empty () || device.source.empty () || device.name.empty ()) {
+    PTRACE(1, "AudioOutputCore\tTried to set malformed audio device");
+    device.type   = AUDIO_OUTPUT_FALLBACK_DEVICE_TYPE;
+    device.source = AUDIO_OUTPUT_FALLBACK_DEVICE_SOURCE;
+    device.name   = AUDIO_OUTPUT_FALLBACK_DEVICE_NAME;
+  }
+
+  PTRACE(1, "AudioOutputCore\tSet " << (device_idx == primary ? "primary" : "secondary") << " audio device 
to " << device.name);
+  set_device (device_idx, device);
+
+  if (audio_device_settings_signals[device_idx] == 0 && device_idx == primary)
+    audio_device_settings_signals[device_idx] =
+      g_signal_connect (audio_device_settings, "changed::output-device",
+                        G_CALLBACK (audio_device_changed), this);
+  else if (audio_device_settings_signals[device_idx] == 0 && device_idx == secondary)
+    audio_device_settings_signals[device_idx] =
+      g_signal_connect (sound_events_settings, "changed::output-device",
+                        G_CALLBACK (audio_device_changed), this);
+  g_free (audio_device);
 }
 
+
 void AudioOutputCore::setup_sound_events (std::string e)
 {
   static const char *events[] =
@@ -126,6 +208,8 @@ void AudioOutputCore::setup_sound_events (std::string e)
       "ring-tone-sound"
     };
 
+  gulong signal = 0;
+
   boost::replace_all (e, "enable-", "");
   for (int i = 0 ; i < 5 ; i++) {
     std::string event = events[i];
@@ -146,8 +230,17 @@ void AudioOutputCore::setup_sound_events (std::string e)
       map_event (event, file_name, primary, enabled);
       g_free (file_name);
     }
+  }
 
-    if (e.empty ()) {
+  signal = g_signal_handler_find (G_OBJECT (sound_events_settings),
+                                  G_SIGNAL_MATCH_FUNC,
+                                  0, 0, NULL,
+                                  (gpointer) sound_event_changed,
+                                  NULL);
+  /* Connect all signals at once if no handler is found */
+  if (signal == 0) {
+    for (int i = 0 ; i < 5 ; i++) {
+      std::string event = events[i];
       g_signal_connect (sound_events_settings, ("changed::" + event).c_str (),
                         G_CALLBACK (sound_event_changed), this);
       g_signal_connect (sound_events_settings, ("changed::enable-" + event).c_str (),
@@ -439,7 +532,7 @@ void AudioOutputCore::play_buffer(AudioOutputPS ps, const char* buffer, unsigned
 
 void AudioOutputCore::on_set_device (const AudioOutputDevice & device)
 {
-  gm_conf_set_string (AUDIO_DEVICES_KEY "output_device", device.GetString ().c_str ());
+  g_settings_set_string (audio_device_settings, "output-device", device.GetString ().c_str ());
 }
 
 void AudioOutputCore::on_device_opened (AudioOutputPS ps,
diff --git a/lib/engine/audiooutput/audiooutput-core.h b/lib/engine/audiooutput/audiooutput-core.h
index 003eed1..ad8af82 100644
--- a/lib/engine/audiooutput/audiooutput-core.h
+++ b/lib/engine/audiooutput/audiooutput-core.h
@@ -42,7 +42,6 @@
 #include "notification-core.h"
 
 #include "audiooutput-manager.h"
-#include "audiooutput-gmconf-bridge.h"
 #include "audiooutput-scheduler.h"
 
 #include <ptlib.h>
@@ -65,19 +64,19 @@ namespace Ekiga
    * in a thread safe manner. Typically, most of the functions except start(),
    * stop(), set_buffer_size() and set_frame_data() will be called from a UI thread,
    * while the three mentioned funtions will be used by an audio streaming thread.
-   * 
-   * The audio output core abstracts different audio output managers, which can 
-   * represent different backends like PTLIB, from the application and can 
+   *
+   * The audio output core abstracts different audio output managers, which can
+   * represent different backends like PTLIB, from the application and can
    * switch the output device transparently for the audio streaming thread,
    * even while audio output is in progress.
    *
    * If the removal of an audio output device is detected by a failed
-   * write or by a message from the HalCore, the audio output core will 
+   * write or by a message from the HalCore, the audio output core will
    * determine the responsible audio output manager and send a signal to the UI,
-   * which can be used to update device lists. Also, if the removed device was the 
+   * which can be used to update device lists. Also, if the removed device was the
    * currently used one, the core falls back to the backup device.
-   * 
-   * A similar procedure is performed on the addition of a device. In case we fell 
+   *
+   * A similar procedure is performed on the addition of a device. In case we fell
    * back due to a removed device, and the respective device is re-added to the system,
    * it will be automatically activated.
    *
@@ -97,15 +96,14 @@ namespace Ekiga
       */
       ~AudioOutputCore ();
 
-      /** Set up gmconf bridge
-       */
-      void setup_conf_bridge();
+      /* Setup internal devices and events */
+      void setup ();
 
-      /** Set up sound events
-       * @param The sound event to setup. Leave empty for all.
-       */
       void setup_sound_events (std::string event = "");
 
+      void setup_audio_device (AudioOutputPS device_idx = primary);
+
+
       /*** Service Implementation ***/
 
       /** Returns the name of the service.
@@ -152,9 +150,9 @@ namespace Ekiga
 
       /** Inform the core of an added audiooutput device
        * This function is called by the HalCore when an audio output device is added.
-       * It determines responsible managers for that specific device and informs the 
-       * GUI about the device that was added (via device_added signal). 
-       * In case the added device was the desired device and we fell back, 
+       * It determines responsible managers for that specific device and informs the
+       * GUI about the device that was added (via device_added signal).
+       * In case the added device was the desired device and we fell back,
        * we will reactivate it. MUST be called from main thread,
        * @param sink the device sink (e.g. alsa).
        * @param device_name the name of the added device.
@@ -164,15 +162,16 @@ namespace Ekiga
 
       /** Inform the core of a removed audiooutput device
        * This function is called by the HalCore when an audio output device is removed.
-       * It determines responsible managers for that specific device and informs the 
-       * GUI about the device that was removed (via device_removed signal). 
+       * It determines responsible managers for that specific device and informs the
+       * GUI about the device that was removed (via device_removed signal).
        * In case the removed device was the current device we fall back to the
        * fallback device. MUST be called from main thread,
        * @param sink the device sink (e.g. alsa).
        * @param device_name the name of the removed device.
        * @param manager the HalManger detected the removal.
        */
-      void remove_device (const std::string & sink, const std::string & device_name, HalManager* manager);
+      void remove_device (const std::string & sink, const std::string & device_name,
+                          HalManager* manager);
 
 
       /*** Event Management ***/
@@ -184,21 +183,22 @@ namespace Ekiga
        * @param ps whether the event shall be played on the primary or secondary device preferrably.
        * @param enabled if the event is enabled.
        */
-      void map_event (const std::string & event_name, const std::string & file_name, AudioOutputPS ps, bool 
enabled);
+      void map_event (const std::string & event_name, const std::string & file_name,
+                      AudioOutputPS ps, bool enabled);
 
       /** Play a sound specified by a file name
        * Play a sound file once.
-       * The sound will be played in the background as soon as the Scheduler 
+       * The sound will be played in the background as soon as the Scheduler
        * schedules it.
        * This function only adds the sound to the Scheduler queue and returns immediately.
-       * The sound will be played on the primary device 
+       * The sound will be played on the primary device
        * @param file_name the name of the file.
        */
       void play_file (const std::string & file_name);
 
       /** Play a sound specified by an event name
        * Play a sound associated to the event speficied by its name once.
-       * The sound will be played in the background as soon as the Scheduler 
+       * The sound will be played in the background as soon as the Scheduler
        * schedules it.
        * This function only adds the sound to the Scheduler queue and returns immediately.
        * The sound will be played on the primary or seconday device depending on
@@ -211,7 +211,7 @@ namespace Ekiga
 
       /** Play a sound specified by an event name
        * Play a sound associated to the event specified by its name repeatingly.
-       * The sound will be played in the background as soon as the Scheduler 
+       * The sound will be played in the background as soon as the Scheduler
        * schedules it.
        * This function only adds the sound to the Scheduler queue and returns immediately.
        * The sound will be played on the primary or seconday device depending on
@@ -242,12 +242,13 @@ namespace Ekiga
        * @param sample_rate the samplerate.
        * @param bps bits per sample.
        */
-      void play_buffer(AudioOutputPS ps, const char* buffer, unsigned long len, unsigned channels, unsigned 
sample_rate, unsigned bps);
+      void play_buffer(AudioOutputPS ps, const char* buffer, unsigned long len,
+                       unsigned channels, unsigned sample_rate, unsigned bps);
 
 
       /*** Stream Management ***/
 
-      /** Set the number and size of buffers 
+      /** Set the number and size of buffers
        * Will be applied the next time the device is opened.
        * @param buffer_size the size of each buffer in byte.
        * @param num_buffers the number of buffers.
@@ -258,7 +259,7 @@ namespace Ekiga
        * @param channels the number of channels (1 or 2).
        * @param samplerate the samplerate.
        * @param bits_per_sample the number of bits per sample (e.g. 8, 16).
-       */ 
+       */
       void start (unsigned channels, unsigned samplerate, unsigned bits_per_sample);
 
       /** Stop the audio output of the primary device.
@@ -266,7 +267,7 @@ namespace Ekiga
       void stop ();
 
      /** Set one audio buffer in the current manager.
-       * This function will pass one buffer to the current manager. 
+       * This function will pass one buffer to the current manager.
        * Requires the audio output to be started.
        * In case the device returns an error writing the frame, set_frame_data()
        * falls back to the fallback device and writes the frame there. Thus
@@ -276,7 +277,7 @@ namespace Ekiga
        * @param size the number of bytes to be written.
        * @param bytes_written number of bytes actually written.
        */
-      void set_frame_data (const char *data, unsigned size, unsigned & bytes_written); 
+      void set_frame_data (const char *data, unsigned size, unsigned & bytes_written);
 
      /** Set the volume of the next opportunity
        * Sets the volume to the specified value the next time
@@ -329,16 +330,17 @@ namespace Ekiga
                              AudioOutputSettings settings,
                              AudioOutputManager *manager);
       void on_device_closed (AudioOutputPS ps, AudioOutputDevice device, AudioOutputManager *manager);
-      void on_device_error  (AudioOutputPS ps, AudioOutputDevice device, AudioOutputErrorCodes error_code, 
AudioOutputManager *manager);
+      void on_device_error  (AudioOutputPS ps, AudioOutputDevice device,
+                             AudioOutputErrorCodes error_code, AudioOutputManager *manager);
 
-      void internal_set_primary_device(const AudioOutputDevice & device);
+      void internal_set_primary_device (const AudioOutputDevice & device);
       void internal_set_manager (AudioOutputPS ps, const AudioOutputDevice & device);
-      void internal_set_primary_fallback();
-
-      bool internal_open (AudioOutputPS ps, unsigned channels, unsigned samplerate, unsigned 
bits_per_sample);
+      void internal_set_primary_fallback ();
+      bool internal_open (AudioOutputPS ps, unsigned channels, unsigned samplerate,
+                          unsigned bits_per_sample);
       void internal_close(AudioOutputPS ps);
-
-      void internal_play(AudioOutputPS ps, const char* buffer, unsigned long len, unsigned channels, 
unsigned sample_rate, unsigned bps);
+      void internal_play(AudioOutputPS ps, const char* buffer, unsigned long len,
+                         unsigned channels, unsigned sample_rate, unsigned bps);
 
       void calculate_average_level (const short *buffer, unsigned size);
 
@@ -364,7 +366,6 @@ namespace Ekiga
       PMutex core_mutex[2];
       PMutex volume_mutex;
 
-      AudioOutputCoreConfBridge* audiooutput_core_conf_bridge;
       AudioEventScheduler* audio_event_scheduler;
 
       float average_level;
@@ -374,6 +375,8 @@ namespace Ekiga
       boost::shared_ptr<Ekiga::NotificationCore> notification_core;
 
       GSettings *sound_events_settings;
+      GSettings *audio_device_settings;
+      guint audio_device_settings_signals[2];
     };
 /**
  * @}
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index 736fa42..42aa255 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -40,6 +40,7 @@
 
 #include "h323-endpoint.h"
 
+#include "gmconf.h"
 #include "account-core.h"
 
 namespace Opal {
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 01a6471..01c55ab 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -38,6 +38,7 @@
 
 #include <glib/gi18n.h>
 #include "config.h"
+#include "gmconf.h"
 #include "sip-endpoint.h"
 #include "chat-core.h"
 
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index bae12d0..6536f77 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -199,8 +199,8 @@ engine_init (Ekiga::ServiceCorePtr service_core,
 
   videooutput_core->setup_conf_bridge();
   videoinput_core->setup_conf_bridge();
-  audiooutput_core->setup_conf_bridge();
-  audioinput_core->setup_conf_bridge();
+  audioinput_core->setup ();
+  audiooutput_core->setup ();
 
 
   hal_core->videoinput_device_added.connect (boost::bind (&Ekiga::VideoInputCore::add_device, boost::ref 
(*videoinput_core), _1, _2, _3, _4));
diff --git a/lib/engine/gui/gtk-frontend/main_window.cpp b/lib/engine/gui/gtk-frontend/main_window.cpp
index 8f32d1e..8888af9 100644
--- a/lib/engine/gui/gtk-frontend/main_window.cpp
+++ b/lib/engine/gui/gtk-frontend/main_window.cpp
@@ -39,6 +39,7 @@
 
 #include "ekiga-settings.h"
 
+#include "gmconf.h"
 #include "main_window.h"
 
 #include "dialpad.h"
@@ -55,6 +56,7 @@
 
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
+#include <gio/gio.h>
 
 #include "engine.h"
 
@@ -145,6 +147,8 @@ struct _EkigaMainWindowPrivate
   Ekiga::scoped_connections connections;
 
   std::list<gpointer> notifiers;
+
+  GSettings *sound_events_settings;
 };
 
 /* channel types */
@@ -745,7 +749,35 @@ on_chat_unread_alert (G_GNUC_UNUSED GtkWidget* widget,
                      gpointer self)
 {
   EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
-  mw->priv->audiooutput_core->play_event("new_message_sound");
+
+  g_return_if_fail (mw != NULL);
+  if (!g_settings_get_boolean (mw->priv->sound_events_settings, "enable-new-message-sound"))
+    return;
+
+  std::string file_name_string = g_settings_get_string (mw->priv->sound_events_settings, 
"new-message-sound");
+
+  if (!file_name_string.empty ())
+    mw->priv->audiooutput_core->play_file(file_name_string);
+}
+
+
+static void
+status_icon_clicked_cb (G_GNUC_UNUSED GtkWidget* widget,
+                        gpointer data)
+{
+  GtkWidget *window = GTK_WIDGET (data);
+
+  if (!gtk_widget_get_visible (window)
+      || (gdk_window_get_state (GDK_WINDOW (gtk_widget_get_window (window))) & GDK_WINDOW_STATE_ICONIFIED)) {
+    gtk_widget_show (window);
+  }
+  else {
+
+    if (gtk_window_has_toplevel_focus (GTK_WINDOW (window)))
+      gtk_widget_hide (window);
+    else
+      gtk_window_present (GTK_WINDOW (window));
+  }
 }
 
 
@@ -1431,6 +1463,8 @@ ekiga_main_window_init (EkigaMainWindow *mw)
   mw->priv->current_call = boost::shared_ptr<Ekiga::Call>();
   mw->priv->calling_state = Standby;
 
+  mw->priv->sound_events_settings = g_settings_new (SOUND_EVENTS_SCHEMA);
+
   for (int i = 0 ; i < NUM_SECTIONS ; i++)
     mw->priv->toggle_buttons[i] = NULL;
 
@@ -1478,6 +1512,8 @@ ekiga_main_window_dispose (GObject* gobject)
     mw->priv->roster_view = NULL;
   }
 
+  g_clear_object (&mw->priv->sound_events_settings);
+
   G_OBJECT_CLASS (ekiga_main_window_parent_class)->dispose (gobject);
 }
 
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp 
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index 0ff9cd8..58218f8 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -79,6 +79,7 @@ typedef struct _GmPreferencesWindow
   boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core;
   boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
   GSettings *sound_events_settings;
+  GSettings *audio_devices_settings;
   Ekiga::scoped_connections connections;
 } GmPreferencesWindow;
 
@@ -87,13 +88,23 @@ typedef struct _GmPreferencesWindow
 _GmPreferencesWindow::_GmPreferencesWindow(Ekiga::ServiceCore &_core): core(_core)
 {
   sound_events_settings = g_settings_new (SOUND_EVENTS_SCHEMA);
+  audio_devices_settings = g_settings_new (AUDIO_DEVICES_SCHEMA);
 }
 
 _GmPreferencesWindow::~_GmPreferencesWindow()
 {
   g_clear_object (&sound_events_settings);
+  g_clear_object (&audio_devices_settings);
 }
 
+enum {
+  COLUMN_STRING_RAW = 0, /* must be zero because it's used in gmconfwidgets */
+  COLUMN_STRING_TRANSLATED,
+  COLUMN_SENSITIVE,
+  COLUMN_GSETTINGS,
+};
+
+
 /* Declarations */
 
 /* GUI Functions */
@@ -221,8 +232,40 @@ static void gm_pw_init_video_codecs_page (GtkWidget *prefs_window,
                                           GtkWidget *container);
 
 
+/* DESCRIPTION  :  /
+ * BEHAVIOR     :  Creates a GtkOptionMenu associated with a string config
+ *                 key and returns the result.
+ *                 The first parameter is the section in which the GtkEntry
+ *                 should be attached. The other parameters are the text label,
+ *                 the possible values for the menu, the config key, the
+ *                 tooltip, the row where to attach it in the section.
+ * PRE          :  The array ends with NULL.
+ */
+static GtkWidget *gm_pw_string_option_menu_new (GtkWidget *,
+                                                const gchar *,
+                                                const gchar **,
+                                                GSettings *,
+                                                const gchar *,
+                                                const gchar *,
+                                                int);
+
+
+/* DESCRIPTION  :  /
+ * BEHAVIOR     :  Updates the content of a GtkOptionMenu associated with
+ *                 a string config key. The first parameter is the menu,
+ *                 the second is the array of possible values, and the
+ *                 last one is the config key and the default value if the
+ *                 conf key is associated to a NULL value.
+ * PRE          :  The array ends with NULL.
+ */
+static void gm_pw_string_option_menu_update (GtkWidget *option_menu,
+                                             const gchar **options,
+                                             GSettings *settings,
+                                             const gchar *conf_key,
+                                             const gchar *default_value);
+
 
-/* GTK Callbacks */
+/* Callbacks */
 
 /* DESCRIPTION  :  This callback is called when the user clicks
  *                 on the refresh devices list button in the prefs.
@@ -294,6 +337,12 @@ static void sound_event_setting_changed (GSettings *,
                                          gchar *,
                                          gpointer data);
 
+static void string_option_menu_changed (GtkWidget *option_menu,
+                                        gpointer data);
+
+static void string_option_setting_changed (GSettings *settings,
+                                           gchar *key,
+                                           gpointer data);
 
 <<<<<<< HEAD
 /* DESCRIPTION  :  This callback is called by the preview-play button of the
@@ -731,24 +780,123 @@ gm_pw_init_audio_devices_page (GtkWidget *prefs_window,
   get_audiooutput_devices (pw->audiooutput_core, device_list);
   array = vector_of_string_to_array (device_list);
   pw->sound_events_output =
-    gnome_prefs_string_option_menu_new (subsection, _("Ringing device:"), (const gchar **)array, 
SOUND_EVENTS_KEY "output_device", _("Select the ringing audio device to use"), 0, DEFAULT_AUDIO_DEVICE_NAME);
+    gm_pw_string_option_menu_new (subsection,
+                                  _("Ringing device:"),
+                                  (const gchar **) array,
+                                  pw->sound_events_settings,
+                                  "output-device",
+                                  _("Select the ringing audio device to use"), 0);
   pw->audio_player =
-    gnome_prefs_string_option_menu_new (subsection, _("Output device:"), (const gchar **)array, 
AUDIO_DEVICES_KEY "output_device", _("Select the audio output device to use"), 1, DEFAULT_AUDIO_DEVICE_NAME);
+    gm_pw_string_option_menu_new (subsection,
+                                  _("Output device:"),
+                                  (const gchar **) array,
+                                  pw->audio_devices_settings,
+                                  "output-device",
+                                  _("Select the audio output device to use"), 1);
   g_free (array);
 
   /* The recorder */
   get_audioinput_devices (pw->audioinput_core, device_list);
   array = vector_of_string_to_array (device_list);
   pw->audio_recorder =
-    gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, 
AUDIO_DEVICES_KEY "input_device", _("Select the audio input device to use"), 2, DEFAULT_AUDIO_DEVICE_NAME);
+    gm_pw_string_option_menu_new (subsection,
+                                  _("Input device:"),
+                                  (const gchar **) array,
+                                  pw->audio_devices_settings,
+                                  "input-device",
+                                  _("Select the audio input device to use"), 2);
   g_free (array);
 
   /* That button will refresh the device list */
-  gm_pw_add_update_button (container, _("_Detect devices"), G_CALLBACK (refresh_devices_list_cb), _("Click 
here to refresh the device list"), 1, prefs_window);
+  gm_pw_add_update_button (container, _("_Detect devices"),
+                           G_CALLBACK (refresh_devices_list_cb),
+                           _("Click here to refresh the device list"), 1,
+                           prefs_window);
+}
+
+
+static void
+<<<<<<< HEAD
+=======
+gm_prefs_window_get_videoinput_devices_list (Ekiga::ServiceCore& core,
+                                             std::vector<std::string> & device_list)
+{
+  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core =
+    core.get<Ekiga::VideoInputCore> ("videoinput-core");
+  std::vector <Ekiga::VideoInputDevice> devices;
+
+  device_list.clear();
+  videoinput_core->get_devices(devices);
+
+  for (std::vector<Ekiga::VideoInputDevice>::iterator iter = devices.begin ();
+       iter != devices.end ();
+       iter++)
+    device_list.push_back(iter->GetString());
+
+  if (device_list.size() == 0)
+    device_list.push_back(_("No device found"));
+}
+
+
+void
+gm_prefs_window_get_audiooutput_devices_list (Ekiga::ServiceCore& core,
+                                              std::vector<std::string> & device_list)
+{
+  boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = core.get<Ekiga::AudioOutputCore> 
("audiooutput-core");
+  std::vector <Ekiga::AudioOutputDevice> devices;
+
+  std::string device_string;
+  device_list.clear();
+
+  audiooutput_core->get_devices(devices);
+
+  for (std::vector<Ekiga::AudioOutputDevice>::iterator iter = devices.begin ();
+       iter != devices.end ();
+       iter++)
+    device_list.push_back(iter->GetString());
+
+  if (device_list.size() == 0)
+    device_list.push_back(_("No device found"));
+}
+
+
+void
+gm_prefs_window_get_audioinput_devices_list (Ekiga::ServiceCore& core,
+                                             std::vector<std::string> & device_list)
+{
+  boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core = core.get<Ekiga::AudioInputCore> 
("audioinput-core");
+  std::vector <Ekiga::AudioInputDevice> devices;
+
+  device_list.clear();
+  audioinput_core->get_devices(devices);
+
+  for (std::vector<Ekiga::AudioInputDevice>::iterator iter = devices.begin ();
+       iter != devices.end ();
+       iter++)
+    device_list.push_back(iter->GetString());
+
+  if (device_list.size() == 0)
+    device_list.push_back(_("No device found"));
+}
+
+
+gchar**
+gm_prefs_window_convert_string_list (const std::vector<std::string> & list)
+{
+  gchar **array = NULL;
+  unsigned i;
+
+  array = (gchar**) g_malloc (sizeof(gchar*) * (list.size() + 1));
+  for (i = 0; i < list.size(); i++)
+    array[i] = (gchar*) list[i].c_str();
+  array[i] = NULL;
+
+  return array;
 }
 
 
 static void
+>>>>>>> GSettings: Migrated sound events, audio output and audio input settins.
 gm_pw_init_video_devices_page (GtkWidget *prefs_window,
                                GtkWidget *container)
 {
@@ -870,7 +1018,178 @@ gm_pw_init_video_codecs_page (GtkWidget *prefs_window,
 }
 
 
-/* GTK Callbacks */
+GtkWidget *
+gm_pw_string_option_menu_new (GtkWidget *table,
+                              const gchar *label_txt,
+                              const gchar **options,
+                              GSettings *settings,
+                              const gchar *conf_key,
+                              const gchar *tooltip,
+                              int row)
+{
+  GtkWidget *label = NULL;
+  GtkWidget *option_menu = NULL;
+  GtkListStore *list_store = NULL;
+  GtkCellRenderer *renderer = NULL;
+  GtkTreeIter iter;
+
+  gchar *conf_string = NULL;
+  gchar *signal_name = NULL;
+  gboolean writable = FALSE;
+
+  int history = -1;
+  int cpt = 0;
+
+  writable = g_settings_is_writable (settings, conf_key);
+
+  label = gtk_label_new (label_txt);
+  if (!writable)
+    gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
+
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_FILL),
+                    0, 0);
+
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+
+  list_store = gtk_list_store_new (4,
+                                   G_TYPE_STRING,
+                                   G_TYPE_STRING,
+                                   G_TYPE_BOOLEAN,
+                                   G_TYPE_POINTER);
+  option_menu = gtk_combo_box_new_with_model (GTK_TREE_MODEL (list_store));
+  if (!writable)
+    gtk_widget_set_sensitive (GTK_WIDGET (option_menu), FALSE);
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_menu), renderer, FALSE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (option_menu), renderer,
+                                  "text", COLUMN_STRING_TRANSLATED,
+                                  "sensitive", COLUMN_SENSITIVE,
+                                  NULL);
+  g_object_set (G_OBJECT (renderer),
+                "ellipsize-set", TRUE,
+                "ellipsize", PANGO_ELLIPSIZE_END,
+                "width-chars", 30, NULL);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
+
+  conf_string = g_settings_get_string (settings, conf_key);
+  while (options [cpt]) {
+
+    if (conf_string && !g_strcmp0 (conf_string, options [cpt]))
+      history = cpt;
+
+    gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
+                        COLUMN_STRING_RAW, options [cpt],
+                        COLUMN_STRING_TRANSLATED, gettext (options [cpt]),
+                        COLUMN_SENSITIVE, TRUE,
+                        COLUMN_GSETTINGS, (gpointer) settings,
+                        -1);
+    cpt++;
+  }
+
+  /* Default value not found in the valid choices,
+   * select the first one
+   */
+  if (history == -1) {
+    history = 0;
+    g_settings_set_string (settings, conf_key, options [0]);
+  }
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), history);
+  gtk_table_attach (GTK_TABLE (table), option_menu, 1, 2, row, row+1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (GTK_FILL),
+                    0, 0);
+
+  gtk_widget_set_tooltip_text (option_menu, tooltip);
+
+  /* Update configuration when the user changes the selected option */
+  g_signal_connect (option_menu, "changed",
+                   G_CALLBACK (string_option_menu_changed),
+                   (gpointer) conf_key);
+
+  /* Update the widget when the user changes the configuration */
+  signal_name = g_strdup_printf ("changed::%s", conf_key);
+  g_signal_connect (settings, signal_name,
+                    G_CALLBACK (string_option_setting_changed), option_menu);
+  g_free (signal_name);
+
+  g_free (conf_string);
+  gtk_widget_show_all (table);
+
+  return option_menu;
+}
+
+
+void
+gm_pw_string_option_menu_update (GtkWidget *option_menu,
+                                 const gchar **options,
+                                 GSettings *settings,
+                                 const gchar *conf_key,
+                                 const gchar *default_value)
+{
+  GtkTreeModel *model = NULL;
+  GtkTreeIter iter;
+
+  gchar *conf_string = NULL;
+
+  int history = -1;
+  int cpt = 0;
+
+  if (!options || !conf_key)
+    return;
+
+  conf_string = g_settings_get_string (settings, conf_key);
+  if (conf_string == NULL)
+    conf_string = g_strdup (default_value);
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (option_menu));
+
+  gtk_list_store_clear (GTK_LIST_STORE (model));
+
+  cpt = 0;
+  while (options [cpt]) {
+
+    if (conf_string && !g_strcmp0 (options [cpt], conf_string))
+      history = cpt;
+
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                        COLUMN_STRING_RAW, options [cpt],
+                        COLUMN_STRING_TRANSLATED, options [cpt],
+                        COLUMN_SENSITIVE, TRUE,
+                        COLUMN_GSETTINGS, (gpointer) settings,
+                        -1);
+    cpt++;
+  }
+
+  if (history == -1) {
+
+    if (conf_string && g_strcmp0 (conf_string, "")) {
+
+      gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+      gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                          COLUMN_STRING_RAW, conf_string,
+                          COLUMN_STRING_TRANSLATED, gettext (conf_string),
+                          COLUMN_SENSITIVE, FALSE,
+                          COLUMN_GSETTINGS, (gpointer) settings,
+                          -1);
+      history = cpt;
+    }
+    else
+      history = --cpt;
+  }
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), history);
+
+  g_free (conf_string);
+}
+
+
+/* Callbacks */
 static void
 refresh_devices_list_cb (G_GNUC_UNUSED GtkWidget *widget,
                         gpointer data)
@@ -1154,6 +1473,88 @@ void on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & device,
   gnome_prefs_string_option_menu_remove(pw->sound_events_output, (device.GetString()).c_str());
 }
 
+
+void
+string_option_menu_changed (GtkWidget *option_menu,
+                           gpointer data)
+{
+  GSettings *settings = NULL;
+
+  GtkTreeModel *model = NULL;
+  GtkTreeIter iter;
+
+  gchar *text = NULL;
+  gchar *current_value = NULL;
+  gchar *key = NULL;
+
+  key = (gchar *) data;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (option_menu));
+  if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (option_menu), &iter)) {
+
+    gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+                        COLUMN_STRING_RAW, &text,
+                        COLUMN_GSETTINGS, &settings, -1);
+    current_value = g_settings_get_string (settings, key);
+
+    if (text && current_value && g_strcmp0 (text, current_value))
+      g_settings_set_string (settings, key, text);
+
+    g_free (text);
+  }
+}
+
+
+void
+string_option_setting_changed (GSettings *settings,
+                               gchar *key,
+                               gpointer data)
+{
+  int cpt = 0;
+  int count = 0;
+
+  GtkTreeModel *model = NULL;
+  GtkTreeIter iter;
+
+  gchar *text = NULL;
+  gchar* txt = NULL;
+
+  GtkWidget *e = GTK_WIDGET (data);
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (e));
+  count = gtk_tree_model_iter_n_children (model, NULL);
+  gtk_tree_model_get_iter_first (model, &iter);
+
+  for (cpt = 0 ; cpt < count ; cpt++) {
+
+    gtk_tree_model_get (model, &iter, COLUMN_STRING_RAW, &text, -1);
+    txt = g_settings_get_string (settings, key);
+    if (text && !g_strcmp0 (text, txt)) {
+
+      g_free (text);
+      g_free (txt);
+      break;
+    }
+    g_free (txt);
+    gtk_tree_model_iter_next (model, &iter);
+
+    g_free (text);
+  }
+
+  g_signal_handlers_block_matched (G_OBJECT (e),
+                                   G_SIGNAL_MATCH_FUNC,
+                                   0, 0, NULL,
+                                   (gpointer) string_option_menu_changed,
+                                   NULL);
+  if (cpt != count && gtk_combo_box_get_active (GTK_COMBO_BOX (data)) != cpt)
+    gtk_combo_box_set_active (GTK_COMBO_BOX (data), cpt);
+  g_signal_handlers_unblock_matched (G_OBJECT (e),
+                                     G_SIGNAL_MATCH_FUNC,
+                                     0, 0, NULL,
+                                     (gpointer) string_option_menu_changed,
+                                     NULL);
+}
+
 /* Public functions */
 void 
 gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
@@ -1167,6 +1568,7 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
   std::vector <std::string> device_list;
 
   /* The player */
+<<<<<<< HEAD
   get_audiooutput_devices (pw->audiooutput_core, device_list);
   array = vector_of_string_to_array (device_list);
   gnome_prefs_string_option_menu_update (pw->audio_player,
@@ -1186,6 +1588,30 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
                                         (const gchar **)array,
                                         AUDIO_DEVICES_KEY "input_device",
                                         DEFAULT_AUDIO_DEVICE_NAME);
+=======
+  gm_prefs_window_get_audiooutput_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
+  gm_pw_string_option_menu_update (pw->audio_player,
+                                   (const gchar **)array,
+                                   pw->audio_devices_settings,
+                                   "output-device",
+                                   DEFAULT_AUDIO_DEVICE_NAME);
+  gm_pw_string_option_menu_update (pw->sound_events_output,
+                                   (const gchar **)array,
+                                   pw->sound_events_settings,
+                                   "output-device",
+                                   DEFAULT_AUDIO_DEVICE_NAME);
+  g_free (array);
+
+  /* The recorder */
+  gm_prefs_window_get_audioinput_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
+  gm_pw_string_option_menu_update (pw->audio_recorder,
+                                   (const gchar **)array,
+                                   pw->audio_devices_settings,
+                                   "input-device",
+                                   DEFAULT_AUDIO_DEVICE_NAME);
+>>>>>>> GSettings: Migrated sound events, audio output and audio input settins.
   g_free (array);
 
 
diff --git a/lib/gmconf/gmconf-ekiga-keys.h b/lib/gmconf/gmconf-ekiga-keys.h
index a8ff9bf..bb865f1 100644
--- a/lib/gmconf/gmconf-ekiga-keys.h
+++ b/lib/gmconf/gmconf-ekiga-keys.h
@@ -56,7 +56,6 @@
 #define PROTOCOLS_KEY "/apps/" PACKAGE_NAME "/protocols/"
 #define ROSTER_KEY "/apps/" PACKAGE_NAME "/contacts/roster"
 #define SIP_KEY "/apps/" PACKAGE_NAME "/protocols/sip/"
-#define SOUND_EVENTS_KEY "/apps/" PACKAGE_NAME "/general/sound_events/"
 #define URL_HANDLERS_KEY "/desktop/gnome/url-handlers/"
 #define USER_INTERFACE_KEY "/apps/" PACKAGE_NAME "/general/user_interface/"
 #define VIDEO_CODECS_KEY "/apps/" PACKAGE_NAME "/codecs/video/"
diff --git a/lib/gmconf/gmconf-upgrade.c b/lib/gmconf/gmconf-upgrade.c
index 3f7ebd6..27f563f 100644
--- a/lib/gmconf/gmconf-upgrade.c
+++ b/lib/gmconf/gmconf-upgrade.c
@@ -137,36 +137,10 @@ gmconf_upgrade_version ()
   g_slist_foreach (accounts, (GFunc) g_free, NULL);
   g_slist_free (accounts);
 
-  /* Audio devices */
+  /* Video devices */
   gchar *plugin = NULL;
   gchar *device = NULL;
   gchar *new_device = NULL;
-  plugin = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
-  if (plugin && g_strcmp0 (plugin, "")) {
-    device = gm_conf_get_string (AUDIO_DEVICES_KEY "input_device");
-    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
-    gm_conf_set_string (AUDIO_DEVICES_KEY "plugin", "");
-    gm_conf_set_string (AUDIO_DEVICES_KEY "input_device", new_device);
-    g_free (device);
-    g_free (new_device);
-
-    device = gm_conf_get_string (AUDIO_DEVICES_KEY "output_device");
-    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
-    gm_conf_set_string (AUDIO_DEVICES_KEY "plugin", "");
-    gm_conf_set_string (AUDIO_DEVICES_KEY "output_device", new_device);
-    g_free (device);
-    g_free (new_device);
-
-    device = gm_conf_get_string (SOUND_EVENTS_KEY "output_device");
-    new_device = g_strdup_printf ("%s (PTLIB/%s)", device, plugin);
-    gm_conf_set_string (SOUND_EVENTS_KEY "plugin", "");
-    gm_conf_set_string (SOUND_EVENTS_KEY "output_device", new_device);
-    g_free (device);
-    g_free (new_device);
-  }
-  g_free (plugin);
-
-  /* Video devices */
   plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
   if (plugin && g_strcmp0 (plugin, "")) {
     device = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");



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