ekiga r6572 - in trunk: . lib/engine/audioinput/skel lib/engine/audiooutput/skel lib/engine/videoinput/skel lib/gui src/gui



Author: dsandras
Date: Mon Aug 11 19:34:25 2008
New Revision: 6572
URL: http://svn.gnome.org/viewvc/ekiga?rev=6572&view=rev

Log:
Hotplug notifications support thanks to Mr M.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/audioinput/skel/audioinput-core.cpp
   trunk/lib/engine/audioinput/skel/audioinput-core.h
   trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp
   trunk/lib/engine/audiooutput/skel/audiooutput-core.h
   trunk/lib/engine/videoinput/skel/videoinput-core.cpp
   trunk/lib/engine/videoinput/skel/videoinput-core.h
   trunk/lib/gui/gmpreferences.c
   trunk/lib/gui/gmpreferences.h
   trunk/src/gui/assistant.cpp
   trunk/src/gui/main.cpp
   trunk/src/gui/preferences.cpp

Modified: trunk/lib/engine/audioinput/skel/audioinput-core.cpp
==============================================================================
--- trunk/lib/engine/audioinput/skel/audioinput-core.cpp	(original)
+++ trunk/lib/engine/audioinput/skel/audioinput-core.cpp	Mon Aug 11 19:34:25 2008
@@ -220,7 +220,7 @@
 
 void AudioInputCore::add_device (const std::string & source, const std::string & device_name, HalManager* /*manager*/)
 {
-  PTRACE(0, "AudioInputCore\tAdding Device " << device_name);
+  PTRACE(4, "AudioInputCore\tAdding Device " << device_name);
   yield = true;
   PWaitAndSignal m(core_mutex);
 
@@ -233,14 +233,14 @@
        if ( desired_device == device)
          internal_set_device(desired_device);
 
-       device_added.emit (device);
+       device_added.emit (device, desired_device == device);
      }
   }
 }
 
 void AudioInputCore::remove_device (const std::string & source, const std::string & device_name, HalManager* /*manager*/)
 {
-  PTRACE(0, "AudioInputCore\tRemoving Device " << device_name);
+  PTRACE(4, "AudioInputCore\tRemoving Device " << device_name);
   yield = true;
   PWaitAndSignal m(core_mutex);
 
@@ -258,7 +258,7 @@
             new_device.name = AUDIO_INPUT_FALLBACK_DEVICE_NAME;
             internal_set_device( new_device);
        }
-       device_removed.emit (device);
+       device_removed.emit (device,  current_device == device);
      }
   }
 }

Modified: trunk/lib/engine/audioinput/skel/audioinput-core.h
==============================================================================
--- trunk/lib/engine/audioinput/skel/audioinput-core.h	(original)
+++ trunk/lib/engine/audioinput/skel/audioinput-core.h	Mon Aug 11 19:34:25 2008
@@ -271,14 +271,14 @@
        * a manager claimed support for this device.
        * @param device the audio input device that was added.
        */
-      sigc::signal<void, AudioInputDevice> device_added;
+      sigc::signal<void, AudioInputDevice, bool> device_added;
 
       /** This signal is emitted when an audio input device has been removed from the system.
        * This signal will be emitted if remove_device was called with a device name and
        * a manager claimed support for this device.
        * @param device the audio input device that was removed.
        */
-      sigc::signal<void, AudioInputDevice> device_removed;
+      sigc::signal<void, AudioInputDevice, bool> device_removed;
 
   private:
       void on_device_opened (AudioInputDevice device,  

Modified: trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp	(original)
+++ trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp	Mon Aug 11 19:34:25 2008
@@ -195,7 +195,7 @@
 
 void AudioOutputCore::add_device (const std::string & sink, const std::string & device_name, HalManager* /*manager*/)
 {
-  PTRACE(0, "AudioOutputCore\tAdding Device " << device_name);
+  PTRACE(4, "AudioOutputCore\tAdding Device " << device_name);
   yield = true;
   PWaitAndSignal m_pri(core_mutex[primary]);
 
@@ -209,14 +209,14 @@
          internal_set_primary_device(desired_primary_device);
        }
 
-       device_added.emit(device);
+       device_added.emit(device, desired_primary_device == device);
      }
   }
 }
 
 void AudioOutputCore::remove_device (const std::string & sink, const std::string & device_name, HalManager* /*manager*/)
 {
-  PTRACE(0, "AudioOutputCore\tRemoving Device " << device_name);
+  PTRACE(4, "AudioOutputCore\tRemoving Device " << device_name);
   yield = true;
   PWaitAndSignal m_pri(core_mutex[primary]);
 
@@ -234,7 +234,7 @@
          internal_set_primary_device(new_device);
        }
 
-       device_removed.emit(device);
+       device_removed.emit(device, device == current_device[primary]);
      }
   }
 }

Modified: trunk/lib/engine/audiooutput/skel/audiooutput-core.h
==============================================================================
--- trunk/lib/engine/audiooutput/skel/audiooutput-core.h	(original)
+++ trunk/lib/engine/audiooutput/skel/audiooutput-core.h	Mon Aug 11 19:34:25 2008
@@ -315,14 +315,14 @@
        * a manager claimed support for this device.
        * @param device the audio output device that was added.
        */
-      sigc::signal<void, AudioOutputDevice> device_added;
+      sigc::signal<void, AudioOutputDevice, bool> device_added;
 
       /** This signal is emitted when an audio output device has been removed from the system.
        * This signal will be emitted if remove_device was called with a device name and
        * a manager claimed support for this device.
        * @param device the audio output device that was removed.
        */
-      sigc::signal<void, AudioOutputDevice> device_removed;
+      sigc::signal<void, AudioOutputDevice, bool> device_removed;
 
   private:
       void on_device_opened (AudioOutputPS ps, 

Modified: trunk/lib/engine/videoinput/skel/videoinput-core.cpp
==============================================================================
--- trunk/lib/engine/videoinput/skel/videoinput-core.cpp	(original)
+++ trunk/lib/engine/videoinput/skel/videoinput-core.cpp	Mon Aug 11 19:34:25 2008
@@ -215,7 +215,7 @@
 
 void VideoInputCore::add_device (const std::string & source, const std::string & device_name, unsigned capabilities, HalManager* /*manager*/)
 {
-  PTRACE(0, "VidInputCore\tAdding Device " << device_name);
+  PTRACE(4, "VidInputCore\tAdding Device " << device_name);
   PWaitAndSignal m(core_mutex);
 
   VideoInputDevice device;
@@ -227,14 +227,14 @@
       if ( desired_device == device )
         internal_set_device(device, current_channel, current_format);
 
-      device_added.emit(device);
+      device_added.emit(device, desired_device == device);
     }
   }
 }
 
 void VideoInputCore::remove_device (const std::string & source, const std::string & device_name, unsigned capabilities, HalManager* /*manager*/)
 {
-  PTRACE(0, "VidInputCore\tRemoving Device " << device_name);
+  PTRACE(4, "VidInputCore\tRemoving Device " << device_name);
   PWaitAndSignal m(core_mutex);
 
   VideoInputDevice device;
@@ -251,7 +251,7 @@
             internal_set_device(new_device, current_channel, current_format);
        }
 
-       device_removed.emit(device);
+       device_removed.emit(device, current_device == device);
      }
   }
 }

Modified: trunk/lib/engine/videoinput/skel/videoinput-core.h
==============================================================================
--- trunk/lib/engine/videoinput/skel/videoinput-core.h	(original)
+++ trunk/lib/engine/videoinput/skel/videoinput-core.h	Mon Aug 11 19:34:25 2008
@@ -290,14 +290,14 @@
        * a manager claimed support for this device.
        * @param device the video input device that was added.
        */
-      sigc::signal<void, VideoInputDevice> device_added;
+      sigc::signal<void, VideoInputDevice, bool> device_added;
 
       /** This signal is emitted when a video input has been removed from the system.
        * This signal will be emitted if remove_device was called with a device name and
        * a manager claimed support for this device.
        * @param device the video input device that was removed.
        */
-      sigc::signal<void, VideoInputDevice> device_removed;
+      sigc::signal<void, VideoInputDevice, bool> device_removed;
 
   private:
       void on_device_opened (VideoInputDevice device,  

Modified: trunk/lib/gui/gmpreferences.c
==============================================================================
--- trunk/lib/gui/gmpreferences.c	(original)
+++ trunk/lib/gui/gmpreferences.c	Mon Aug 11 19:34:25 2008
@@ -757,7 +757,8 @@
 
 void
 gnome_prefs_string_option_menu_add (GtkWidget *option_menu,
-				    const gchar *option)
+				    const gchar *option,
+				    gboolean active)
 {
   GtkTreeModel *model = NULL;
   GtkTreeIter iter;
@@ -772,7 +773,8 @@
   gtk_list_store_set (GTK_LIST_STORE (model), &iter, 
                              COLUMN_STRING_RAW, option,
                             COLUMN_STRING_TRANSLATED, option_string, -1);
-
+  if (active == TRUE)
+    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (option_menu), &iter);
   g_free (option_string);
 }
 

Modified: trunk/lib/gui/gmpreferences.h
==============================================================================
--- trunk/lib/gui/gmpreferences.h	(original)
+++ trunk/lib/gui/gmpreferences.h	Mon Aug 11 19:34:25 2008
@@ -218,7 +218,8 @@
 
 
 void gnome_prefs_string_option_menu_add (GtkWidget *option_menu,
-	    			         const gchar *option);
+	    			         const gchar *option,
+	    			         gboolean active);
 
 void gnome_prefs_string_option_menu_remove (GtkWidget *option_menu,
 	 			            const gchar *option);

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Mon Aug 11 19:34:25 2008
@@ -211,38 +211,38 @@
   }
 }
 
-void on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, EkigaAssistant *assistant)
+void on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, bool, EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   add_combo_box (GTK_COMBO_BOX (assistant->priv->video_device), device_string.c_str());
 }
 
-void on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, EkigaAssistant *assistant)
+void on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, bool,  EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   remove_combo_box (GTK_COMBO_BOX (assistant->priv->video_device),  device_string.c_str());
 }
 
-void on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & device, EkigaAssistant *assistant)
+void on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & device, bool, EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   add_combo_box (GTK_COMBO_BOX (assistant->priv->audio_recorder), device_string.c_str());
 }
 
-void on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & device, EkigaAssistant *assistant)
+void on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & device, bool, EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   remove_combo_box (GTK_COMBO_BOX (assistant->priv->audio_recorder),  device_string.c_str());
 }
 
-void on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & device, EkigaAssistant *assistant)
+void on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & device, bool, EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   add_combo_box (GTK_COMBO_BOX (assistant->priv->audio_player), device_string.c_str());
   add_combo_box (GTK_COMBO_BOX (assistant->priv->audio_ringer), device_string.c_str());
 }
 
-void on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & device, EkigaAssistant *assistant)
+void on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & device, bool, EkigaAssistant *assistant)
 {
   std::string device_string = device.GetString();
   remove_combo_box (GTK_COMBO_BOX (assistant->priv->audio_player),  device_string.c_str());

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Mon Aug 11 19:34:25 2008
@@ -102,6 +102,12 @@
 
 enum CallingState {Standby, Calling, Connected, Called};
 
+enum DeviceType { AudioInput, AudioOutput, VideoInput} ;
+struct deviceStruct {
+  char name[256];
+  DeviceType deviceType;
+};
+
 /* Declarations */
 struct _GmMainWindow
 {
@@ -792,6 +798,10 @@
   gtk_widget_destroy (GTK_WIDGET (self));
 }
 
+void 
+gm_main_window_add_device_dialog_show (GtkWidget *main_window,
+                                       const Ekiga::Device & device,
+                                       DeviceType deviceType);
 
 static void on_held_call_cb (Ekiga::CallManager & /*manager*/,
                              Ekiga::Call & /*call*/,
@@ -1102,6 +1112,30 @@
 }
 
 void 
+on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, bool isDesired, gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("added video input device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+  if (!isDesired && !mw->current_call) 
+    gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device, VideoInput);
+}
+
+void 
+on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, bool, gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("removed video input device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+}
+
+void 
 on_videoinput_device_error_cb (Ekiga::VideoInputManager & /* manager */, 
                                Ekiga::VideoInputDevice & device, 
                                Ekiga::VideoInputErrorCodes error_code, 
@@ -1190,6 +1224,35 @@
 }
 
 void 
+on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & device, 
+                               bool isDesired,
+                               gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("added audio input device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+  if (!isDesired  && !mw->current_call)
+    gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device,  AudioInput);
+    
+}
+
+void 
+on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & device, 
+                                 bool,
+                                 gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("removed audio input device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+}
+
+void 
 on_audioinput_device_error_cb (Ekiga::AudioInputManager & /* manager */, 
                                Ekiga::AudioInputDevice & device, 
                                Ekiga::AudioInputErrorCodes error_code, 
@@ -1271,6 +1334,34 @@
 }
 
 void 
+on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & device, 
+                                bool isDesired,
+                                gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("added audio output device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+  if (!isDesired && !mw->current_call)
+    gm_main_window_add_device_dialog_show (GTK_WIDGET (self), device, AudioOutput);
+}
+
+void 
+on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & device, 
+                                  bool,
+                                  gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+  std::string message = _("removed audio output device ") + device.GetString();
+  gm_main_window_flash_message (GTK_WIDGET (self), "%s", message.c_str ());
+}
+
+void 
 on_audiooutput_device_error_cb (Ekiga::AudioOutputManager & /*manager */, 
                                 Ekiga::AudioOutputPS ps,
                                 Ekiga::AudioOutputDevice & device, 
@@ -1365,6 +1456,32 @@
   }
 }
 
+static void
+add_device_response_cb (GtkDialog *add_device_popup,
+                           gint response,
+                           gpointer data)
+{
+  deviceStruct *device_struct = (deviceStruct*) data;
+
+  gtk_widget_hide (GTK_WIDGET (add_device_popup));
+
+  if (response == 2) {
+
+    switch (device_struct->deviceType)
+    {
+     case AudioInput:
+       gm_conf_set_string (AUDIO_DEVICES_KEY "input_device", device_struct->name);
+       break;
+     case AudioOutput:
+       gm_conf_set_string (AUDIO_DEVICES_KEY "output_device", device_struct->name);
+       break;
+     case VideoInput:
+       gm_conf_set_string (VIDEO_DEVICES_KEY "input_device", device_struct->name);
+       break;	                
+     default:;
+    }
+  }
+}
 
 static void
 place_call_cb (GtkWidget * /*widget*/,
@@ -3694,6 +3811,100 @@
                                    (gpointer) incoming_call_popup));
 }
 
+void 
+gm_main_window_add_device_dialog_show (GtkWidget *main_window,
+                                       const Ekiga::Device & device,
+                                       DeviceType deviceType)
+{
+  GmMainWindow *mw = NULL;
+  
+  GtkWidget *label = NULL;
+  GtkWidget *vbox = NULL;
+  GtkWidget *b1 = NULL;
+  GtkWidget *b2 = NULL;
+  GtkWidget *add_device_popup = NULL;
+
+  g_return_if_fail (main_window);
+  mw = gm_mw_get_mw (main_window);
+  g_return_if_fail (mw != NULL);
+
+
+  add_device_popup = gtk_dialog_new ();
+  b2 = gtk_dialog_add_button (GTK_DIALOG (add_device_popup),
+			      _("No"), 0);
+  b1 = gtk_dialog_add_button (GTK_DIALOG (add_device_popup),
+			      _("Yes"), 2);
+
+  gtk_dialog_set_default_response (GTK_DIALOG (add_device_popup), 2);
+
+  vbox = GTK_DIALOG (add_device_popup)->vbox;
+
+  std::string msg;
+
+  switch (deviceType) {
+    case AudioInput:
+      msg = _("Detected new audio input device:");
+      break;
+    case AudioOutput:
+      msg = _("Detected new audio output device:");
+      break;
+    case VideoInput:
+      msg = _("Detected new video input device:");
+      break;
+    default:
+      break;
+  }
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+  
+  msg  = "<b>" + device.GetString() + "</b>";
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+  msg  = _("Do you want to use it as default device?");
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), msg.c_str());
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+  gtk_window_set_title (GTK_WINDOW (add_device_popup), "New device");
+  gtk_window_set_modal (GTK_WINDOW (add_device_popup), TRUE);
+  gtk_window_set_keep_above (GTK_WINDOW (add_device_popup), TRUE);
+  gtk_window_set_urgency_hint (GTK_WINDOW (main_window), TRUE);
+  gtk_window_set_transient_for (GTK_WINDOW (add_device_popup),
+				GTK_WINDOW (main_window));
+
+  gtk_widget_show_all (add_device_popup);
+
+
+//  g_signal_connect (G_OBJECT (add_device_popup), "delete_event",
+//                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+//  g_signal_connect (G_OBJECT (add_device_popup), "response",
+//                    GTK_SIGNAL_FUNC (add_device_response_cb), &device);
+
+  deviceStruct* device_struct = g_new(deviceStruct, 1);
+  snprintf (device_struct->name, sizeof (device_struct->name), "%s", (device.GetString()).c_str());
+  device_struct->deviceType = deviceType;
+
+  g_signal_connect_data (G_OBJECT (add_device_popup), "delete_event",
+                         G_CALLBACK (gtk_widget_hide_on_delete), 
+                         (gpointer) device_struct,
+                         (GClosureNotify) g_free,
+                         (GConnectFlags) 0);
+
+  g_signal_connect_data (G_OBJECT (add_device_popup), "response",
+                         G_CALLBACK (add_device_response_cb), 
+                         (gpointer) device_struct,
+                         (GClosureNotify) g_free,
+                         (GConnectFlags) 0);
+}
 
 GtkWidget *
 gm_main_window_new (Ekiga::ServiceCore & core)
@@ -3877,6 +4088,12 @@
   conn = videoinput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_closed_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  conn = videoinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_added_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = videoinput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_removed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
   conn = videoinput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_videoinput_device_error_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
@@ -3889,6 +4106,12 @@
   conn = audioinput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_closed_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  conn = audioinput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_added_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audioinput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_removed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
   conn = audioinput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_audioinput_device_error_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
@@ -3901,6 +4124,12 @@
   conn = audiooutput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_closed_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  conn = audiooutput_core->device_added.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_added_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audiooutput_core->device_removed.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_removed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
   conn = audiooutput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_audiooutput_device_error_cb), (gpointer) window));
   mw->connections.push_back (conn);
     

Modified: trunk/src/gui/preferences.cpp
==============================================================================
--- trunk/src/gui/preferences.cpp	(original)
+++ trunk/src/gui/preferences.cpp	Mon Aug 11 19:34:25 2008
@@ -1258,16 +1258,16 @@
    g_free (file_name);
 }
 
-void on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, GtkWidget *prefs_window)
+void on_videoinput_device_added_cb (const Ekiga::VideoInputDevice & device, bool isDesired, GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);
   pw = gm_pw_get_pw (prefs_window);
   std::string device_string = device.type + "/" + device.source + "/" + device.name;
-  gnome_prefs_string_option_menu_add (pw->video_device, device_string.c_str());
+  gnome_prefs_string_option_menu_add (pw->video_device, device_string.c_str(),  isDesired ? TRUE : FALSE);
 }
 
-void on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, GtkWidget *prefs_window)
+void on_videoinput_device_removed_cb (const Ekiga::VideoInputDevice & device, bool, GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);
@@ -1276,17 +1276,17 @@
   gnome_prefs_string_option_menu_remove(pw->video_device, device_string.c_str());
 }
 
-void on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & audioinput_device, GtkWidget *prefs_window)
+void on_audioinput_device_added_cb (const Ekiga::AudioInputDevice & audioinput_device, bool isDesired, GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);
   pw = gm_pw_get_pw (prefs_window);
   std::string device = audioinput_device.type + "/" + audioinput_device.source + "/" + audioinput_device.name;
-  gnome_prefs_string_option_menu_add (pw->audio_recorder, device.c_str());
+  gnome_prefs_string_option_menu_add (pw->audio_recorder, device.c_str(),  isDesired ? TRUE : FALSE);
 
 }
 
-void on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & audioinput_device, GtkWidget *prefs_window)
+void on_audioinput_device_removed_cb (const Ekiga::AudioInputDevice & audioinput_device, bool, GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);
@@ -1295,17 +1295,17 @@
   gnome_prefs_string_option_menu_remove(pw->audio_recorder, device.c_str());
 }
 
-void on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & audiooutput_device, GtkWidget *prefs_window)
+void on_audiooutput_device_added_cb (const Ekiga::AudioOutputDevice & audiooutput_device, bool isDesired,  GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);
   pw = gm_pw_get_pw (prefs_window);
   std::string device = audiooutput_device.type + "/" + audiooutput_device.source + "/" + audiooutput_device.name;
-  gnome_prefs_string_option_menu_add (pw->audio_player, device.c_str());
-  gnome_prefs_string_option_menu_add (pw->sound_events_output, device.c_str());
+  gnome_prefs_string_option_menu_add (pw->audio_player, device.c_str(), isDesired ? TRUE : FALSE);
+  gnome_prefs_string_option_menu_add (pw->sound_events_output, device.c_str(), FALSE);
 }
 
-void on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & audiooutput_device, GtkWidget *prefs_window)
+void on_audiooutput_device_removed_cb (const Ekiga::AudioOutputDevice & audiooutput_device, bool, GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
   g_return_if_fail (prefs_window != NULL);



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