ekiga r6862 - in trunk: . lib/engine/account/skel lib/engine/protocol/skel src/endpoints src/gui



Author: dsandras
Date: Sun Sep  7 16:58:33 2008
New Revision: 6862
URL: http://svn.gnome.org/viewvc/ekiga?rev=6862&view=rev

Log:
Moved the mwi_event where it should belong, ie to the AccountCore.
Dropped bonobo.h include.
Resurrected display of voicemail waiting indications with the
associated sound event in the accounts window.
Cleaned unuseful notifications from the statusbar, we have a tray icon
for that.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/account/skel/account-core.cpp
   trunk/lib/engine/account/skel/account-core.h
   trunk/lib/engine/account/skel/account.h
   trunk/lib/engine/account/skel/bank-impl.h
   trunk/lib/engine/account/skel/bank.h
   trunk/lib/engine/protocol/skel/call-core.cpp
   trunk/lib/engine/protocol/skel/call-core.h
   trunk/lib/engine/protocol/skel/call-manager.h
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/manager.h
   trunk/src/endpoints/sip-endpoint.cpp
   trunk/src/endpoints/sip-endpoint.h
   trunk/src/gui/accounts.cpp
   trunk/src/gui/accounts.h
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/account/skel/account-core.cpp
==============================================================================
--- trunk/lib/engine/account/skel/account-core.cpp	(original)
+++ trunk/lib/engine/account/skel/account-core.cpp	Sun Sep  7 16:58:33 2008
@@ -90,6 +90,7 @@
 
   bank.questions.add_handler (questions.make_slot ());
   bank.registration_event.connect (sigc::mem_fun (this, &Ekiga::AccountCore::on_registration_event));
+  bank.mwi_event.connect (sigc::mem_fun (this, &Ekiga::AccountCore::on_mwi_event));
 }
 
 
@@ -126,3 +127,10 @@
 {
   registration_event.emit (*account, state, info);
 }
+
+
+void Ekiga::AccountCore::on_mwi_event (const Ekiga::Account *account,
+                                       const std::string & info)
+{
+  mwi_event.emit (*account, info);
+}

Modified: trunk/lib/engine/account/skel/account-core.h
==============================================================================
--- trunk/lib/engine/account/skel/account-core.h	(original)
+++ trunk/lib/engine/account/skel/account-core.h	Sun Sep  7 16:58:33 2008
@@ -181,6 +181,12 @@
     sigc::signal<void, const Ekiga::Account &, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
 
 
+    /** This signal is emitted when there is a new message waiting event
+     * @param: account is the account 
+     *         info contains information about the indication 
+     */
+    sigc::signal<void, const Ekiga::Account &, std::string> mwi_event;
+
 
     /*** Account Subscriber API ***/
   public:
@@ -200,6 +206,8 @@
     void on_registration_event (const Ekiga::Account *account,
                                 Ekiga::AccountCore::RegistrationState state,
                                 const std::string & info);
+    void on_mwi_event (const Ekiga::Account *account,
+                       const std::string & info);
   };
 
 

Modified: trunk/lib/engine/account/skel/account.h
==============================================================================
--- trunk/lib/engine/account/skel/account.h	(original)
+++ trunk/lib/engine/account/skel/account.h	Sun Sep  7 16:58:33 2008
@@ -187,6 +187,12 @@
     sigc::signal<void, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
 
 
+    /** This signal is emitted when there is a new message waiting indication
+     * @param: mwi is the message waiting indication
+     */
+    sigc::signal<void, std::string> mwi_event;
+
+
     /** This chain allows the Account to present forms to the user
      */
     ChainOfResponsibility<FormRequest*> questions;

Modified: trunk/lib/engine/account/skel/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/skel/bank-impl.h	(original)
+++ trunk/lib/engine/account/skel/bank-impl.h	Sun Sep  7 16:58:33 2008
@@ -157,6 +157,7 @@
 
   private:
     void on_registration_event (Ekiga::AccountCore::RegistrationState, std::string info, Ekiga::Account *account);
+    void on_mwi_event (std::string info, Ekiga::Account *account);
   };
 
 /**
@@ -296,6 +297,7 @@
   account.questions.add_handler (questions.make_slot ());
   account.trigger_saving.connect (sigc::mem_fun (this, &Ekiga::BankImpl<T>::save));
   account.registration_event.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::BankImpl<T>::on_registration_event), &account));
+  account.mwi_event.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::BankImpl<T>::on_mwi_event), &account));
 }
 
 
@@ -306,10 +308,19 @@
   remove_object (account);
 }
 
+
 template<typename T>
 void
 Ekiga::BankImpl<T>::on_registration_event (Ekiga::AccountCore::RegistrationState state, std::string info, Ekiga::Account *account)
 {
   registration_event.emit (account, state, info);
 }
+
+
+template<typename T>
+void
+Ekiga::BankImpl<T>::on_mwi_event (std::string info, Ekiga::Account *account)
+{
+  mwi_event.emit (account, info);
+}
 #endif

Modified: trunk/lib/engine/account/skel/bank.h
==============================================================================
--- trunk/lib/engine/account/skel/bank.h	(original)
+++ trunk/lib/engine/account/skel/bank.h	Sun Sep  7 16:58:33 2008
@@ -100,6 +100,12 @@
      */
     sigc::signal<void, const Ekiga::Account *, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
 
+    /** This signal is emitted when there is a new message waiting event
+     * @param: account is the account 
+     *         info contains information about the indication 
+     */
+    sigc::signal<void, const Ekiga::Account *, std::string> mwi_event;
+
     /** This chain allows the BankImpl to present forms to the user
      */
     ChainOfResponsibility<FormRequest*> questions;

Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp	(original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp	Sun Sep  7 16:58:33 2008
@@ -51,7 +51,6 @@
   managers.insert (&manager);
   manager_added.emit (manager);
 
-  manager.mwi_event.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_mwi_event), &manager));
   manager.ready.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_manager_ready), &manager));
 }
 
@@ -175,12 +174,6 @@
 }
 
 
-void CallCore::on_mwi_event (std::string account, std::string info, CallManager *manager)
-{
-  mwi_event.emit (*manager, account, info);
-}
-
-
 void CallCore::on_manager_ready (CallManager *manager)
 {
   manager_ready.emit (*manager);

Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h	(original)
+++ trunk/lib/engine/protocol/skel/call-core.h	Sun Sep  7 16:58:33 2008
@@ -144,11 +144,6 @@
       sigc::signal<void, CallManager &, Call &, std::string, Call::StreamType> stream_paused;
       sigc::signal<void, CallManager &, Call &, std::string, Call::StreamType> stream_resumed;
 
-
-      /*** Accounts ***/
-      // TODO Should move too
-      sigc::signal<void, CallManager &, std::string, std::string> mwi_event;
-
       /*** Misc ***/
       sigc::signal<void, CallManager &> manager_ready;
       sigc::signal<void> ready;
@@ -176,8 +171,6 @@
       void on_im_received (std::string, std::string, std::string, CallManager *manager);
       void on_new_chat (std::string, std::string, CallManager *manager);
 
-      void on_mwi_event (std::string, std::string, CallManager *manager);
-
       void on_manager_ready (CallManager *manager);
       
       std::set<CallManager *> managers;

Modified: trunk/lib/engine/protocol/skel/call-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-manager.h	(original)
+++ trunk/lib/engine/protocol/skel/call-manager.h	Sun Sep  7 16:58:33 2008
@@ -193,19 +193,6 @@
        */
       virtual unsigned get_reject_delay () const = 0;
 
-
-      /*
-       * ACCOUNT INDICATIONS
-       */
-
-      /** This signal is emitted when there is a new message waiting indication
-       * @param: account is the voicemail account
-       *         mwi is the message waiting indication
-       */
-      sigc::signal<void, std::string, std::string> mwi_event;
-      //FIXME
-
-
       /*
        * MISC
        */

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sun Sep  7 16:58:33 2008
@@ -651,19 +651,6 @@
 }
 
 
-void 
-CallManager::OnMWIReceived (const PString & _acc,
-                            MessageWaitingType /*type*/,
-                            const PString & _msgs)
-{
-  std::string account = (const char *) _acc;
-  std::string summary = (const char *) _msgs;
-
-  runtime.run_in_main (sigc::bind (mwi_event.make_slot (), account, summary));
-}
-
-
-
 void CallManager::GetAllowedFormats (OpalMediaFormatList & full_list)
 {
   OpalMediaFormatList list = OpalTranscoder::GetPossibleFormats (pcssEP->GetMediaFormats ());

Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h	(original)
+++ trunk/src/endpoints/manager.h	Sun Sep  7 16:58:33 2008
@@ -154,10 +154,6 @@
 
     void OnClosedMediaStream (const OpalMediaStream &);
 
-    void OnMWIReceived (const PString & party,
-                        MessageWaitingType type,
-                        const PString & info);
-
     void GetAllowedFormats (OpalMediaFormatList & full_list);
 
     void HandleSTUNResult ();

Modified: trunk/src/endpoints/sip-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/sip-endpoint.cpp	(original)
+++ trunk/src/endpoints/sip-endpoint.cpp	Sun Sep  7 16:58:33 2008
@@ -931,6 +931,15 @@
 }
 
 
+void Opal::Sip::EndPoint::OnMWIReceived (const PString & party, OpalManager::MessageWaitingType /*type*/, const PString & info)
+{
+  /* Signal */
+  Ekiga::Account *account = account_core.find_account (party);
+  if (account)
+    runtime.run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
+}
+
+
 bool Opal::Sip::EndPoint::OnIncomingConnection (OpalConnection &connection,
                                                 unsigned options,
                                                 OpalConnection::StringOptions * stroptions)

Modified: trunk/src/endpoints/sip-endpoint.h
==============================================================================
--- trunk/src/endpoints/sip-endpoint.h	(original)
+++ trunk/src/endpoints/sip-endpoint.h	Sun Sep  7 16:58:33 2008
@@ -144,6 +144,10 @@
                                  SIP_PDU::StatusCodes reason,
                                  bool wasRegistering);
 
+      void OnMWIReceived (const PString & party, 
+                          OpalManager::MessageWaitingType type, 
+                          const PString & info);
+
       bool OnIncomingConnection (OpalConnection &connection,
                                  unsigned options,
                                  OpalConnection::StringOptions * stroptions);

Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp	(original)
+++ trunk/src/gui/accounts.cpp	Sun Sep  7 16:58:33 2008
@@ -42,6 +42,7 @@
 #include "account.h"
 #include "bank.h"
 #include "account-core.h"
+#include "audiooutput-core.h"
 
 #include "callbacks.h"
 #include "misc.h"
@@ -151,11 +152,79 @@
 }
 
 
+bool
+gm_accounts_window_update_account_state (GtkWidget *accounts_window,
+					 gboolean refreshing,
+                                         const Ekiga::Account & _account,
+					 const gchar *status,
+					 const gchar *voicemails)
+{
+  GtkTreeModel *model = NULL;
+
+  GtkTreeIter iter;
+
+  Ekiga::Account *account = NULL;
+  GmAccountsWindow *aw = NULL;
+
+  gchar *error = NULL;
+  gchar *mwi = NULL;
+
+  bool status_modified = false;
+  bool mwi_modified = false;
+
+  g_return_val_if_fail (accounts_window != NULL, false);
+
+  aw = gm_aw_get_aw (accounts_window);
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (aw->accounts_list));
+
+  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)){
+
+    do {
+
+      gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+			  COLUMN_ACCOUNT, &account,
+			  -1);
+
+      if (account == &_account) {
+
+        gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+                            COLUMN_ACCOUNT_ERROR_MESSAGE, &error,
+                            COLUMN_ACCOUNT_VOICEMAILS, &mwi,
+                            -1);
+
+	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+			    COLUMN_ACCOUNT_STATE, refreshing, -1);
+	if (status) {
+
+	  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+			      COLUMN_ACCOUNT_ERROR_MESSAGE, status, -1);
+          status_modified = (error == NULL) || strcmp (status, error);
+        }
+	if (voicemails) {
+
+	  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+			      COLUMN_ACCOUNT_VOICEMAILS, voicemails, -1);
+          mwi_modified = (mwi == NULL) || strcmp (voicemails, mwi);
+        }
+      
+        g_free (error);
+        g_free (mwi);
+      }
+
+    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
+  }
+
+  return (status_modified || mwi_modified);
+}
+
+
 /* Engine callbacks */
-static void on_registration_event (const Ekiga::Account & account,
-                                   Ekiga::AccountCore::RegistrationState state,
-                                   std::string info,
-                                   gpointer window)
+static void 
+on_registration_event (const Ekiga::Account & account,
+                       Ekiga::AccountCore::RegistrationState state,
+                       std::string info,
+                       gpointer window)
 {
   bool is_processing = false;
   std::string status;
@@ -188,8 +257,33 @@
     break;
   }
 
-  gm_accounts_window_update_account_state (GTK_WIDGET (window), is_processing, 
-                                           account, status.c_str (), NULL); 
+  gm_accounts_window_update_account_state (GTK_WIDGET (window), is_processing, account, status.c_str (), NULL); 
+}
+
+
+static void 
+on_mwi_event (const Ekiga::Account & account,
+              std::string mwi,
+              gpointer self)
+{
+  GmAccountsWindow *aw = NULL;
+
+  aw = gm_aw_get_aw (GTK_WIDGET (self));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (aw->core.get ("audiooutput-core"));
+
+  if (gm_accounts_window_update_account_state (GTK_WIDGET (self), false, account, NULL, mwi.c_str ())) {
+
+    std::string::size_type loc = mwi.find ("/", 0);
+    if (loc != std::string::npos) {
+
+      std::stringstream new_messages;
+      int i;
+      new_messages << mwi.substr (0, loc);
+      new_messages >> i;
+      if (i > 0)
+        audiooutput_core->play_event ("new_voicemail_sound");
+    }
+  }
 }
 
 
@@ -666,52 +760,7 @@
   account_core->account_removed.connect (sigc::bind (sigc::ptr_fun (on_account_removed), window));
   account_core->questions.add_handler (sigc::bind (sigc::ptr_fun (on_handle_questions), (gpointer) window));
   account_core->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event), (gpointer) window));
+  account_core->mwi_event.connect (sigc::bind (sigc::ptr_fun (on_mwi_event), (gpointer) window));
   
   return window;
 }
-
-
-void
-gm_accounts_window_update_account_state (GtkWidget *accounts_window,
-					 gboolean refreshing,
-                                         const Ekiga::Account & _account,
-					 const gchar *status,
-					 const gchar *voicemails)
-{
-  GtkTreeModel *model = NULL;
-
-  GtkTreeIter iter;
-
-  Ekiga::Account *account = NULL;
-  GmAccountsWindow *aw = NULL;
-
-  g_return_if_fail (accounts_window != NULL);
-
-  aw = gm_aw_get_aw (accounts_window);
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (aw->accounts_list));
-
-  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)){
-
-    do {
-
-      gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
-			  COLUMN_ACCOUNT, &account,
-			  -1);
-
-      if (account == &_account) {
-
-	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-			    COLUMN_ACCOUNT_STATE, refreshing, -1);
-	if (status)
-	  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-			      COLUMN_ACCOUNT_ERROR_MESSAGE, status, -1);
-	if (voicemails)
-	  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-			      COLUMN_ACCOUNT_VOICEMAILS, voicemails, -1);
-      }
-
-    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
-  }
-}
-

Modified: trunk/src/gui/accounts.h
==============================================================================
--- trunk/src/gui/accounts.h	(original)
+++ trunk/src/gui/accounts.h	Sun Sep  7 16:58:33 2008
@@ -51,20 +51,4 @@
  */
 GtkWidget *gm_accounts_window_new (Ekiga::ServiceCore &core);
 
-
-/* DESCRIPTION  :  /
- * BEHAVIOR     :  Update the account corresponding to the given domain, and
- * 		   username with the given status message. Enables or not
- * 		   the refreshing state for that account (see below for
- * 		   the implications).
- * PRE          :  /
- */
-//FIXME private
-void gm_accounts_window_update_account_state (GtkWidget *accounts_window,
-					      gboolean refreshing,
-                                              const Ekiga::Account & account,
-					      const gchar *status,
-					      const gchar *voicemails);
-
-
 #endif

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Sun Sep  7 16:58:33 2008
@@ -81,7 +81,6 @@
 #undef _
 #undef N_
 #include <gnome.h>
-#include <libbonobo.h>
 #endif
 
 #if defined(P_FREEBSD) || defined (P_MACOSX)
@@ -168,8 +167,6 @@
 #endif
 
   unsigned int calling_state;
-  unsigned int missed_calls;
-  unsigned int total_mwi;
   bool audio_transmission_active;
   bool audio_reception_active;
   bool video_transmission_active;
@@ -512,8 +509,7 @@
 
 
 /* DESCRIPTION  :  This callback is called when the status bar is clicked.
- * BEHAVIOR     :  Clear all info message, not normal messages. Reset the
- * 		   endpoint missed calls number.
+ * BEHAVIOR     :  Clear all info message, not normal messages.
  * PRE          :  The main window GMObject.
  */
 static gboolean statusbar_clicked_cb (GtkWidget *,
@@ -540,23 +536,6 @@
 /* 
  * Engine Callbacks 
  */
-static void on_mwi_event_cb (G_GNUC_UNUSED Ekiga::CallManager & manager,
-                             G_GNUC_UNUSED std::string account,
-                             G_GNUC_UNUSED std::string mwi,
-                             gpointer self)
-{
-  GmMainWindow *mw = NULL;
-
-  g_return_if_fail (GTK_WIDGET (self) != NULL);
-  mw = gm_mw_get_mw (GTK_WIDGET (self));
-  g_return_if_fail (mw != NULL);
-
-  gm_main_window_push_message (GTK_WIDGET (self),
-                               mw->missed_calls,
-                               mw->total_mwi);
-}
-
-
 static void on_ready_cb (gpointer self)
 {
   gm_main_window_set_busy (GTK_WIDGET (self), false);
@@ -769,9 +748,6 @@
     gm_main_window_hide_call_panel (GTK_WIDGET (self));
   gm_main_window_clear_stats (GTK_WIDGET (self));
   gm_main_window_update_logo_have_window (GTK_WIDGET (self));
-  gm_main_window_push_message (GTK_WIDGET (self), 
-                               mw->missed_calls,
-                               mw->total_mwi);
   gm_main_window_flash_message (GTK_WIDGET (self), "%s", reason.c_str ());
 
   if (mw->current_call && mw->current_call->get_id () == call.get_id ()) {
@@ -853,15 +829,9 @@
   audiooutput_core->stop_play_event("ring_tone_sound");
 
   gchar* info = NULL;
-
-  mw->missed_calls++;
   info = g_strdup_printf (_("Missed call from %s"),
 			  call.get_remote_party_name ().c_str ());
-
-  gm_main_window_push_message (GTK_WIDGET (self), 
-                               mw->missed_calls,
-                               mw->total_mwi);
-  gm_main_window_flash_message (GTK_WIDGET (self), "%s", info);
+  gm_main_window_push_message (GTK_WIDGET (self), "%s", info);
   g_free (info);
 }
 
@@ -3034,8 +3004,6 @@
 		      G_GNUC_UNUSED GdkEventButton *event,
 		      gpointer data)
 {
-  gchar *info = NULL;
-
   GmMainWindow *mw = NULL;
 
   g_return_val_if_fail (data != NULL, TRUE);
@@ -3044,13 +3012,7 @@
 
   g_return_val_if_fail (GTK_WIDGET (data), TRUE);
 
-  mw->missed_calls = 0;
-
-  gm_main_window_push_message (GTK_WIDGET (data), 
-                               mw->missed_calls, 
-                               mw->total_mwi);
-  g_free (info);
-
+  gm_main_window_push_message (GTK_WIDGET (data), NULL);
 
   return FALSE;
 }
@@ -3917,7 +3879,6 @@
   mw->levelmeter_timeout_id = -1;
   mw->x = 0;
   mw->y = 0;
-  mw->missed_calls = mw->total_mwi = 0;
   mw->audio_transmission_active = mw->audio_reception_active 
     = mw->video_transmission_active = mw->video_reception_active = false;
   g_object_set_data_full (G_OBJECT (window), "GMObject", 
@@ -4108,9 +4069,6 @@
   conn = account_core->registration_event.connect (sigc::bind (sigc::ptr_fun (on_registration_event), (gpointer) window));
   mw->connections.push_back (conn);
 
-  conn = call_core->mwi_event.connect (sigc::bind (sigc::ptr_fun (on_mwi_event_cb), (gpointer) window));
-  mw->connections.push_back (conn);
-
   conn = call_core->ready.connect (sigc::bind (sigc::ptr_fun (on_ready_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
@@ -4188,21 +4146,6 @@
 
 void 
 gm_main_window_push_message (GtkWidget *main_window, 
-			     unsigned int missed,
-			     unsigned int mwi)
-{
-  gchar *info = NULL;
-  
-  g_return_if_fail (main_window != NULL);
-  
-  info = g_strdup_printf (_("Missed calls: %d - Voice Mails: %d"), missed, mwi);
-  gm_main_window_push_info_message (main_window, "%s", info);
-  g_free (info);
-}
-
-
-void 
-gm_main_window_push_message (GtkWidget *main_window, 
 			     const char *msg, 
 			     ...)
 {



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