[ekiga] Factor some device listing code out of the preferences and assistant



commit fdccea7fb3f7b38e38102a9516dd6c7a4900cb05
Author: Julien Puydt <jpuydt free fr>
Date:   Wed Jun 19 14:56:43 2013 +0200

    Factor some device listing code out of the preferences and assistant

 lib/Makefile.am                                    |    2 +
 lib/engine/gui/gtk-frontend/assistant.cpp          |  107 +-------------
 lib/engine/gui/gtk-frontend/device-lists.cpp       |  112 ++++++++++++++
 lib/engine/gui/gtk-frontend/device-lists.h         |   59 ++++++++
 lib/engine/gui/gtk-frontend/preferences-window.cpp |  153 ++++----------------
 5 files changed, 211 insertions(+), 222 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index aa14282..22a88a0 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -417,6 +417,8 @@ libekiga_la_SOURCES += \
 ##
 
 libekiga_la_SOURCES += \
+       $(engine_dir)/gui/gtk-frontend/device-lists.h \
+       $(engine_dir)/gui/gtk-frontend/device-lists.cpp \
        $(engine_dir)/gui/gtk-frontend/addressbook-window.h \
        $(engine_dir)/gui/gtk-frontend/addressbook-window.cpp \
        $(engine_dir)/gui/gtk-frontend/accounts-window.h \
diff --git a/lib/engine/gui/gtk-frontend/assistant.cpp b/lib/engine/gui/gtk-frontend/assistant.cpp
index 670784e..42aba32 100644
--- a/lib/engine/gui/gtk-frontend/assistant.cpp
+++ b/lib/engine/gui/gtk-frontend/assistant.cpp
@@ -52,6 +52,8 @@
 #include "videoinput-core.h"
 #include "audioinput-core.h"
 #include "audiooutput-core.h"
+#include "device-lists.h"
+
 #include <gdk/gdkkeysyms.h>
 
 G_DEFINE_TYPE (EkigaAssistant, ekiga_assistant, GTK_TYPE_ASSISTANT);
@@ -146,16 +148,6 @@ set_current_page_complete (GtkAssistant *assistant,
   gtk_assistant_set_page_complete (assistant, current_page, complete);
 }
 
-static void get_audiooutput_devices_list (boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core,
-                                         std::vector<std::string> & device_list);
-static void get_audioinput_devices_list (boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
-                                        std::vector<std::string> & device_list);
-static void get_videoinput_devices_list (boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core,
-                                        std::vector<std::string> & device_list);
-
-static gchar**
-convert_string_list (const std::vector<std::string> & list);
-
 static void
 update_combo_box (GtkComboBox         *combo_box,
                   const gchar * const *options,
@@ -1119,15 +1111,15 @@ prepare_audio_devices_page (EkigaAssistant *assistant)
    */
   std::vector <std::string> device_list;
 
-  get_audiooutput_devices_list (assistant->priv->audiooutput_core, device_list);
-  array = convert_string_list(device_list);
+  get_audiooutput_devices (assistant->priv->audiooutput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_ringer), array, ringer);
   update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_player), array, player);
   g_free (array);
 
 
-  get_audioinput_devices_list (assistant->priv->audioinput_core, device_list);
-  array = convert_string_list(device_list);
+  get_audioinput_devices (assistant->priv->audioinput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_recorder), array, recorder);
   g_free (array);
 
@@ -1213,8 +1205,8 @@ prepare_video_devices_page (EkigaAssistant *assistant)
   gchar** array;
   gchar* current_plugin;
 
-  get_videoinput_devices_list (assistant->priv->videoinput_core, device_list);
-  array = convert_string_list (device_list);
+  get_videoinput_devices (assistant->priv->videoinput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
   if (current_plugin == NULL || !current_plugin[0]) {
     g_free (current_plugin);
@@ -1240,89 +1232,6 @@ apply_video_devices_page (EkigaAssistant *assistant)
 }
 
 
-// FIXME: duplicate to gm_prefs_window_get_video_devices_list
-static void
-get_audiooutput_devices_list (boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core,
-                              std::vector<std::string> & device_list)
-{
-  std::vector <Ekiga::AudioOutputDevice> devices;
-
-  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"));
-  }
-}
-
-
-static void
-get_audioinput_devices_list (boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
-                             std::vector<std::string> & device_list)
-{
-  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"));
-  }
-}
-
-
-static void
-get_videoinput_devices_list (boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core,
-                            std::vector<std::string> & device_list)
-{
-  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"));
-  }
-}
-
-
-// FIXME: duplicate to gm_prefs_window_convert_string_list
-static gchar**
-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
 create_summary_page (EkigaAssistant *assistant)
 {
diff --git a/lib/engine/gui/gtk-frontend/device-lists.cpp b/lib/engine/gui/gtk-frontend/device-lists.cpp
new file mode 100644
index 0000000..a903007
--- /dev/null
+++ b/lib/engine/gui/gtk-frontend/device-lists.cpp
@@ -0,0 +1,112 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2013 Damien Sandras <dsandras seconix com>
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         device-lists.cpp  -  description
+ *                         -------------------------------
+ *   description          : This file contains functions to get device lists
+ */
+
+#include "config.h"
+
+#include "device-lists.h"
+
+gchar**
+vector_of_string_to_array (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;
+}
+
+void
+get_audiooutput_devices (boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core,
+                        std::vector<std::string>& device_list)
+{
+  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
+get_audioinput_devices (boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
+                       std::vector<std::string>& device_list)
+{
+  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"));
+}
+
+void
+get_videoinput_devices (boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core,
+                       std::vector<std::string>& device_list)
+{
+  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"));
+  }
+}
diff --git a/lib/engine/gui/gtk-frontend/device-lists.h b/lib/engine/gui/gtk-frontend/device-lists.h
new file mode 100644
index 0000000..b0b0bda
--- /dev/null
+++ b/lib/engine/gui/gtk-frontend/device-lists.h
@@ -0,0 +1,59 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2013 Damien Sandras <dsandras seconix com>
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         device-lists.h  -  description
+ *                         -------------------------------
+ *   description          : This file declares functions to get device lists
+ */
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "audiooutput-core.h"
+#include "audioinput-core.h"
+#include "videoinput-core.h"
+
+G_BEGIN_DECLS
+
+gchar**
+vector_of_string_to_array (const std::vector<std::string>& list);
+
+void
+get_audiooutput_devices (boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core,
+                        std::vector<std::string>& device_list);
+
+void
+get_audioinput_devices (boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
+                       std::vector<std::string>& device_list);
+
+void
+get_videoinput_devices (boost::shared_ptr<Ekiga::VideoInputCore> videooinput_core,
+                       std::vector<std::string>& device_list);
+
+G_END_DECLS
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp 
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index 2e71370..bb4ee0c 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -54,13 +54,14 @@
 #include "audioinput-core.h"
 #include "audiooutput-core.h"
 
+#include "device-lists.h"
+
 #ifdef WIN32
 #include "platform/winpaths.h"
 #endif
 
 typedef struct _GmPreferencesWindow
 {
-  _GmPreferencesWindow(Ekiga::ServiceCore &_core);
   ~_GmPreferencesWindow();
 
   GtkWidget *audio_codecs_list;
@@ -71,17 +72,15 @@ typedef struct _GmPreferencesWindow
   GtkWidget *video_device;
   GtkWidget *iface;
   GtkWidget *fsbutton;
-  Ekiga::ServiceCore& core;
+  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core;
+  boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core;
+  boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
   Ekiga::scoped_connections connections;
   std::list<gpointer> notifiers;
 } GmPreferencesWindow;
 
 #define GM_PREFERENCES_WINDOW(x) (GmPreferencesWindow *) (x)
 
-_GmPreferencesWindow::_GmPreferencesWindow(Ekiga::ServiceCore &_core): core(_core)
-{
-}
-
 _GmPreferencesWindow::~_GmPreferencesWindow()
 {
   for (std::list<gpointer>::iterator iter = notifiers.begin ();
@@ -299,17 +298,6 @@ static void sound_events_list_changed_nt (gpointer id,
 static void audioev_filename_browse_play_cb (GtkWidget *playbutton,
                                              gpointer data);
 
-static void
-gm_prefs_window_get_audiooutput_devices_list (Ekiga::ServiceCore& core,
-                                        std::vector<std::string> & device_list);
-
-static void
-gm_prefs_window_get_audioinput_devices_list (Ekiga::ServiceCore& core,
-                                             std::vector<std::string> & device_list);
-
-gchar**
-gm_prefs_window_convert_string_list (const std::vector<std::string> & list);
-
 void 
 gm_prefs_window_update_devices_list (GtkWidget *prefs_window);
 
@@ -741,8 +729,8 @@ gm_pw_init_audio_devices_page (GtkWidget *prefs_window,
   /* Add all the fields for the audio manager */
   std::vector <std::string> device_list;
 
-  gm_prefs_window_get_audiooutput_devices_list (pw->core, device_list);
-  array = gm_prefs_window_convert_string_list(device_list);
+  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);
   pw->audio_player =
@@ -750,8 +738,8 @@ gm_pw_init_audio_devices_page (GtkWidget *prefs_window,
   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);
+  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);
   g_free (array);
@@ -762,83 +750,6 @@ gm_pw_init_audio_devices_page (GtkWidget *prefs_window,
 
 
 static void
-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
 gm_pw_init_video_devices_page (GtkWidget *prefs_window,
                                GtkWidget *container)
 {
@@ -886,8 +797,8 @@ gm_pw_init_video_devices_page (GtkWidget *prefs_window,
                                            _("Video Devices"), 5, 3);
 
   /* The video device */
-  gm_prefs_window_get_videoinput_devices_list (pw->core, device_list);
-  array = gm_prefs_window_convert_string_list(device_list);
+  get_videoinput_devices (pw->videoinput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   pw->video_device =
     gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, 
VIDEO_DEVICES_KEY "input_device", _("Select the video input device to use. If an error occurs when using this 
device a test picture will be transmitted."), 0, NULL);
   g_free (array);
@@ -1094,10 +1005,8 @@ sound_event_play_cb (G_GNUC_UNUSED GtkWidget *widget,
 
     gtk_tree_model_get (GTK_TREE_MODEL (model), &selected_iter, 4, &sound_event, -1);
 
-    boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = pw->core.get<Ekiga::AudioOutputCore> 
("audiooutput-core");
-
     if (sound_event) {
-      audiooutput_core->play_event(sound_event);
+      pw->audiooutput_core->play_event(sound_event);
       g_free (sound_event);
     }
   }
@@ -1143,11 +1052,9 @@ audioev_filename_browse_play_cb (GtkWidget* /* playbutton */,
 
   pw = gm_pw_get_pw (GTK_WIDGET (data));
 
-  boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = pw->core.get<Ekiga::AudioOutputCore> 
("audiooutput-core");
-
   gchar* file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pw->fsbutton));
   std::string file_name_string = file_name;
-  audiooutput_core->play_file(file_name_string);
+  pw->audiooutput_core->play_file(file_name_string);
 
   g_free (file_name);
 }
@@ -1216,8 +1123,8 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
   std::vector <std::string> device_list;
 
   /* The player */
-  gm_prefs_window_get_audiooutput_devices_list (pw->core, device_list);
-  array = gm_prefs_window_convert_string_list(device_list);
+  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,
                                         (const gchar **)array,
                                         AUDIO_DEVICES_KEY "output_device",
@@ -1229,8 +1136,8 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
   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);
+  get_audioinput_devices (pw->audioinput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   gnome_prefs_string_option_menu_update (pw->audio_recorder,
                                         (const gchar **)array,
                                         AUDIO_DEVICES_KEY "input_device",
@@ -1239,8 +1146,8 @@ gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
 
 
   /* The Video player */
-  gm_prefs_window_get_videoinput_devices_list (pw->core, device_list);
-  array = gm_prefs_window_convert_string_list(device_list);
+  get_videoinput_devices (pw->videoinput_core, device_list);
+  array = vector_of_string_to_array (device_list);
   gnome_prefs_string_option_menu_update (pw->video_device,
                                         (const gchar **)array,
                                         VIDEO_DEVICES_KEY "input_device",
@@ -1277,7 +1184,11 @@ preferences_window_new (Ekiga::ServiceCore& core)
 
 
   /* The GMObject data */
-  pw = new GmPreferencesWindow (core);
+  pw = new GmPreferencesWindow;
+
+  pw->audioinput_core = core.get<Ekiga::AudioInputCore> ("audioinput-core");
+  pw->audiooutput_core = core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
+  pw->videoinput_core = core.get<Ekiga::VideoInputCore> ("videoinput-core");
 
   g_object_set_data_full (G_OBJECT (window), "GMObject",
                          pw, (GDestroyNotify) gm_pw_destroy);
@@ -1343,26 +1254,22 @@ preferences_window_new (Ekiga::ServiceCore& core)
   gm_window_hide_on_delete (window);
 
   boost::signals::connection conn;
-  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core = core.get<Ekiga::VideoInputCore> 
("videoinput-core");
-  boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core = core.get<Ekiga::AudioInputCore> 
("audioinput-core");
-  boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = core.get<Ekiga::AudioOutputCore> 
("audiooutput-core");
 
-  conn = videoinput_core->device_added.connect (boost::bind (&on_videoinput_device_added_cb, _1, _2, 
window));
+  conn = pw->videoinput_core->device_added.connect (boost::bind (&on_videoinput_device_added_cb, _1, _2, 
window));
   pw->connections.add (conn);
-  conn = videoinput_core->device_removed.connect (boost::bind (&on_videoinput_device_removed_cb, _1, _2, 
window));
+  conn = pw->videoinput_core->device_removed.connect (boost::bind (&on_videoinput_device_removed_cb, _1, _2, 
window));
   pw->connections.add (conn);
 
-  conn = audioinput_core->device_added.connect (boost::bind (&on_audioinput_device_added_cb, _1, _2, 
window));
+  conn = pw->audioinput_core->device_added.connect (boost::bind (&on_audioinput_device_added_cb, _1, _2, 
window));
   pw->connections.add (conn);
-  conn = audioinput_core->device_removed.connect (boost::bind (&on_audioinput_device_removed_cb, _1, _2, 
window));
+  conn = pw->audioinput_core->device_removed.connect (boost::bind (&on_audioinput_device_removed_cb, _1, _2, 
window));
   pw->connections.add (conn);
 
-  conn = audiooutput_core->device_added.connect (boost::bind (&on_audiooutput_device_added_cb, _1, _2, 
window));
+  conn = pw->audiooutput_core->device_added.connect (boost::bind (&on_audiooutput_device_added_cb, _1, _2, 
window));
   pw->connections.add(conn);
-  conn = audiooutput_core->device_removed.connect (boost::bind (&on_audiooutput_device_removed_cb, _1, _2, 
window));
+  conn = pw->audiooutput_core->device_removed.connect (boost::bind (&on_audiooutput_device_removed_cb, _1, 
_2, window));
   pw->connections.add (conn);
 
-
   /* Connect notifiers for SOUND_EVENTS_KEY keys */
   notifier =
     gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_incoming_call_sound", 


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