[ekiga] Call Window: Moved around remaining bits.



commit d33cd4858d681f07c4b3de24dfd84cfbab6ad120
Author: Damien Sandras <dsandras beip be>
Date:   Sun Jan 29 16:07:00 2012 +0100

    Call Window: Moved around remaining bits.
    
    The main window should be totally independant from the call window
    from now on.

 src/gui/call_window.cpp |  114 ++++++++++++++++++++++++++++++++++++
 src/gui/main_window.cpp |  149 -----------------------------------------------
 2 files changed, 114 insertions(+), 149 deletions(-)
---
diff --git a/src/gui/call_window.cpp b/src/gui/call_window.cpp
index 67d7d65..1d4f852 100644
--- a/src/gui/call_window.cpp
+++ b/src/gui/call_window.cpp
@@ -169,6 +169,16 @@ struct _EkigaCallWindowPrivate
   GtkObject *adj_contrast;
 #endif
 
+  bool audio_transmission_active;
+  bool audio_reception_active;
+  bool video_transmission_active;
+  bool video_reception_active;
+  std::string transmitted_video_codec;
+  std::string transmitted_audio_codec;
+  std::string received_video_codec;
+  std::string received_audio_codec;
+
+
   /* Statusbar */
   GtkWidget *statusbar;
   GtkWidget *statusbar_ebox;
@@ -374,6 +384,19 @@ static void on_retrieved_call_cb (boost::shared_ptr<Ekiga::CallManager>  /*manag
                                   boost::shared_ptr<Ekiga::Call>  /*call*/,
                                   gpointer self);
 
+static void on_stream_opened_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
+                                 boost::shared_ptr<Ekiga::Call>  /* call */,
+                                 std::string name,
+                                 Ekiga::Call::StreamType type,
+                                 bool is_transmitting,
+                                 gpointer self);
+
+static void on_stream_closed_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
+                                 boost::shared_ptr<Ekiga::Call>  /* call */,
+                                 std::string name,
+                                 Ekiga::Call::StreamType type,
+                                 bool is_transmitting,
+                                 gpointer self);
 
 static void on_stream_paused_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
                                  boost::shared_ptr<Ekiga::Call>  /*call*/,
@@ -1289,6 +1312,93 @@ on_retrieved_call_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
 }
 
 static void
+on_stream_opened_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
+                     boost::shared_ptr<Ekiga::Call>  /* call */,
+                     std::string name,
+                     Ekiga::Call::StreamType type,
+                     bool is_transmitting,
+                     gpointer self)
+{
+  EkigaCallWindow *cw = EKIGA_CALL_WINDOW (self);
+
+  bool is_closing = false;
+  bool is_encoding = is_transmitting;
+  bool is_video = (type == Ekiga::Call::Video);
+
+  /* FIXME: This should not be needed anymore */
+  if (type == Ekiga::Call::Video) {
+
+    is_closing ?
+      (is_encoding ? cw->priv->video_transmission_active = false : cw->priv->video_reception_active = false)
+      :(is_encoding ? cw->priv->video_transmission_active = true : cw->priv->video_reception_active = true);
+
+    if (is_encoding)
+      is_closing ? cw->priv->transmitted_video_codec = "" : cw->priv->transmitted_video_codec = name;
+    else
+      is_closing ? cw->priv->received_video_codec = "" : cw->priv->received_video_codec = name;
+  }
+  else {
+
+    is_closing ?
+      (is_encoding ? cw->priv->audio_transmission_active = false : cw->priv->audio_reception_active = false)
+      :(is_encoding ? cw->priv->audio_transmission_active = true : cw->priv->audio_reception_active = true);
+
+    if (is_encoding)
+      is_closing ? cw->priv->transmitted_audio_codec = "" : cw->priv->transmitted_audio_codec = name;
+    else
+      is_closing ? cw->priv->received_audio_codec = "" : cw->priv->received_audio_codec = name;
+  }
+
+  ekiga_call_window_channels_menu_update_sensitivity (cw, is_video,
+                                                      is_video ? cw->priv->video_reception_active : cw->priv->audio_reception_active,
+                                                      is_video ? cw->priv->video_transmission_active : cw->priv->audio_transmission_active);
+}
+
+
+static void
+on_stream_closed_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
+                                 boost::shared_ptr<Ekiga::Call>  /* call */,
+                                 std::string name,
+                                 Ekiga::Call::StreamType type,
+                                 bool is_transmitting,
+                                 gpointer self)
+{
+  EkigaCallWindow *cw = EKIGA_CALL_WINDOW (self);
+
+  bool is_closing = true;
+  bool is_encoding = is_transmitting;
+  bool is_video = (type == Ekiga::Call::Video);
+
+  /* FIXME: This should not be needed anymore */
+  if (type == Ekiga::Call::Video) {
+
+    is_closing ?
+      (is_encoding ? cw->priv->video_transmission_active = false : cw->priv->video_reception_active = false)
+      :(is_encoding ? cw->priv->video_transmission_active = true : cw->priv->video_reception_active = true);
+
+    if (is_encoding)
+      is_closing ? cw->priv->transmitted_video_codec = "" : cw->priv->transmitted_video_codec = name;
+    else
+      is_closing ? cw->priv->received_video_codec = "" : cw->priv->received_video_codec = name;
+  }
+  else {
+
+    is_closing ?
+      (is_encoding ? cw->priv->audio_transmission_active = false : cw->priv->audio_reception_active = false)
+      :(is_encoding ? cw->priv->audio_transmission_active = true : cw->priv->audio_reception_active = true);
+
+    if (is_encoding)
+      is_closing ? cw->priv->transmitted_audio_codec = "" : cw->priv->transmitted_audio_codec = name;
+    else
+      is_closing ? cw->priv->received_audio_codec = "" : cw->priv->received_audio_codec = name;
+  }
+
+  ekiga_call_window_channels_menu_update_sensitivity (cw, is_video,
+                                                      is_video ? cw->priv->video_reception_active : cw->priv->audio_reception_active,
+                                                      is_video ? cw->priv->video_transmission_active : cw->priv->audio_transmission_active);
+}
+
+static void
 on_stream_paused_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
                      boost::shared_ptr<Ekiga::Call>  /*call*/,
                      std::string /*name*/,
@@ -2682,6 +2792,10 @@ ekiga_call_window_init (EkigaCallWindow *cw)
   cw->priv->timeout_id = -1;
   cw->priv->levelmeter_timeout_id = -1;
   cw->priv->calling_state = Standby;
+  cw->priv->audio_transmission_active = false;
+  cw->priv->audio_reception_active = false;
+  cw->priv->video_transmission_active = false;
+  cw->priv->video_reception_active = false;
 #ifndef WIN32
   cw->priv->video_widget_gc = NULL;
 #endif
diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp
index 984bbe8..3468041 100644
--- a/src/gui/main_window.cpp
+++ b/src/gui/main_window.cpp
@@ -142,14 +142,6 @@ struct _EkigaMainWindowPrivate
   /* Calls */
   boost::shared_ptr<Ekiga::Call> current_call;
   unsigned calling_state;
-  bool audio_transmission_active;
-  bool audio_reception_active;
-  bool video_transmission_active;
-  bool video_reception_active;
-  std::string transmitted_video_codec;
-  std::string transmitted_audio_codec;
-  std::string received_video_codec;
-  std::string received_audio_codec;
 
   gulong roster_selection_connection_id;
   std::vector<boost::signals::connection> connections;
@@ -333,23 +325,6 @@ static void ekiga_main_window_add_device_dialog_show (EkigaMainWindow *main_wind
                                                       DeviceType device_type);
 
 
-/* DESCRIPTION  :  /
- * BEHAVIOR     :  Update the main window sensitivity following the opened
- *                 and closed audio and video channels. It also updates
- *                 the state of the video preview button.
- * PRE          :  The main window GMObject.
- * 		   The first parameter is TRUE if we are updating video
- *                 channels related items, FALSE if we are updating audio
- *                 channels related items. The second parameter is TRUE
- *                 if we are transmitting audio (or video), the third is TRUE
- *                 if we are receiving audio (or video).
- */
-static void ekiga_main_window_update_sensitivity (EkigaMainWindow *main_window,
-					   bool is_video,
-					   bool is_receiving,
-					   bool is_transmitting);
-
-
 /* DESCRIPTION   :  /
  * BEHAVIOR      : Flashes a message on the statusbar during a few seconds.
  *                 Removes the previous message.
@@ -682,93 +657,6 @@ static void on_missed_call_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*
 }
 
 
-static void on_stream_opened_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
-                                 boost::shared_ptr<Ekiga::Call>  /* call */,
-                                 std::string name,
-                                 Ekiga::Call::StreamType type,
-                                 bool is_transmitting,
-                                 gpointer self)
-{
-  EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
-
-  bool is_closing = false;
-  bool is_encoding = is_transmitting;
-  bool is_video = (type == Ekiga::Call::Video);
-
-  /* FIXME: This should not be needed anymore */
-  if (type == Ekiga::Call::Video) {
-
-    is_closing ?
-      (is_encoding ? mw->priv->video_transmission_active = false : mw->priv->video_reception_active = false)
-      :(is_encoding ? mw->priv->video_transmission_active = true : mw->priv->video_reception_active = true);
-
-    if (is_encoding)
-      is_closing ? mw->priv->transmitted_video_codec = "" : mw->priv->transmitted_video_codec = name;
-    else
-      is_closing ? mw->priv->received_video_codec = "" : mw->priv->received_video_codec = name;
-  }
-  else {
-    
-    is_closing ?
-      (is_encoding ? mw->priv->audio_transmission_active = false : mw->priv->audio_reception_active = false)
-      :(is_encoding ? mw->priv->audio_transmission_active = true : mw->priv->audio_reception_active = true);
-
-    if (is_encoding)
-      is_closing ? mw->priv->transmitted_audio_codec = "" : mw->priv->transmitted_audio_codec = name;
-    else
-      is_closing ? mw->priv->received_audio_codec = "" : mw->priv->received_audio_codec = name;
-  }
-
-  ekiga_main_window_update_sensitivity (mw,
-                                        is_video,
-                                        is_video ? mw->priv->video_reception_active : mw->priv->audio_reception_active,
-                                        is_video ? mw->priv->video_transmission_active : mw->priv->audio_transmission_active);
-}
-
-
-static void on_stream_closed_cb (boost::shared_ptr<Ekiga::CallManager>  /*manager*/,
-                                 boost::shared_ptr<Ekiga::Call>  /* call */,
-                                 std::string name,
-                                 Ekiga::Call::StreamType type,
-                                 bool is_transmitting,
-                                 gpointer self)
-{
-  EkigaMainWindow *mw = EKIGA_MAIN_WINDOW (self);
-
-  bool is_closing = true;
-  bool is_encoding = is_transmitting;
-  bool is_video = (type == Ekiga::Call::Video);
-
-  /* FIXME: This should not be needed anymore */
-  if (type == Ekiga::Call::Video) {
-    
-    is_closing ?
-      (is_encoding ? mw->priv->video_transmission_active = false : mw->priv->video_reception_active = false)
-      :(is_encoding ? mw->priv->video_transmission_active = true : mw->priv->video_reception_active = true);
-
-    if (is_encoding)
-      is_closing ? mw->priv->transmitted_video_codec = "" : mw->priv->transmitted_video_codec = name;
-    else
-      is_closing ? mw->priv->received_video_codec = "" : mw->priv->received_video_codec = name;
-  }
-  else {
-    
-    is_closing ?
-      (is_encoding ? mw->priv->audio_transmission_active = false : mw->priv->audio_reception_active = false)
-      :(is_encoding ? mw->priv->audio_transmission_active = true : mw->priv->audio_reception_active = true);
-
-    if (is_encoding)
-      is_closing ? mw->priv->transmitted_audio_codec = "" : mw->priv->transmitted_audio_codec = name;
-    else
-      is_closing ? mw->priv->received_audio_codec = "" : mw->priv->received_audio_codec = name;
-  }
-
-  ekiga_main_window_update_sensitivity (mw,
-                                        is_video,
-                                        is_video ? mw->priv->video_reception_active : mw->priv->audio_reception_active,
-                                        is_video ? mw->priv->video_transmission_active : mw->priv->audio_transmission_active);
-}
-
 static bool on_handle_errors (std::string error,
                               gpointer data)
 {
@@ -792,7 +680,6 @@ static bool on_handle_errors (std::string error,
 }
 
 
-
 /*
  * Display Engine Callbacks
  */
@@ -1197,32 +1084,6 @@ statusbar_clicked_cb (G_GNUC_UNUSED GtkWidget *widget,
 
 
 static void
-ekiga_main_window_update_sensitivity (EkigaMainWindow *mw,
-				      bool is_video,
-				      bool /*is_receiving*/,
-				      bool is_transmitting)
-{
-  g_return_if_fail (EKIGA_IS_MAIN_WINDOW (mw));
-
-  if (is_transmitting) {
-
-    if (!is_video)
-      gtk_menu_set_sensitive (mw->priv->main_menu, "suspend_audio", TRUE);
-    else
-      gtk_menu_set_sensitive (mw->priv->main_menu, "suspend_video", TRUE);
-  }
-  else {
-
-    if (!is_video)
-      gtk_menu_set_sensitive (mw->priv->main_menu, "suspend_audio", FALSE);
-    else
-      gtk_menu_set_sensitive (mw->priv->main_menu, "suspend_video", FALSE);
-
-  }
-}
-
-
-static void
 ekiga_main_window_incoming_call_dialog_show (EkigaMainWindow *mw,
                                              boost::shared_ptr<Ekiga::Call>  call)
 {
@@ -1817,10 +1678,6 @@ ekiga_main_window_init (EkigaMainWindow *mw)
 
   mw->priv->current_call = boost::shared_ptr<Ekiga::Call>();
   mw->priv->calling_state = Standby;
-  mw->priv->audio_transmission_active = false;
-  mw->priv->audio_reception_active = false;
-  mw->priv->video_transmission_active = false;
-  mw->priv->video_reception_active = false;
 }
 
 static GObject *
@@ -2020,12 +1877,6 @@ ekiga_main_window_connect_engine_signals (EkigaMainWindow *mw)
   conn = call_core->missed_call.connect (boost::bind (&on_missed_call_cb, _1, _2, (gpointer) mw));
   mw->priv->connections.push_back (conn);
 
-  conn = call_core->stream_opened.connect (boost::bind (&on_stream_opened_cb, _1, _2, _3, _4, _5, (gpointer) mw));
-  mw->priv->connections.push_back (conn);
-  
-  conn = call_core->stream_closed.connect (boost::bind (&on_stream_closed_cb, _1, _2, _3, _4, _5, (gpointer) mw));
-  mw->priv->connections.push_back (conn);
-
   conn = call_core->errors.connect (boost::bind (&on_handle_errors, _1, (gpointer) mw));
   mw->priv->connections.push_back (conn);
 



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