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



Author: dsandras
Date: Sun Aug 10 19:08:40 2008
New Revision: 6557
URL: http://svn.gnome.org/viewvc/ekiga?rev=6557&view=rev

Log:
Added errors support to the CallCore. Errors are strings and presented
as popups to the user. The engine decides of the error message. 


Modified:
   trunk/ChangeLog
   trunk/lib/engine/engine.cpp
   trunk/lib/engine/protocol/skel/call-core.h
   trunk/src/endpoints/manager.cpp
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Sun Aug 10 19:08:40 2008
@@ -192,11 +192,6 @@
   }
 #endif
 
-  if (!opal_init (*core, &argc, &argv)) {
-    delete core;
-    return;
-  }
-
 #ifdef HAVE_AVAHI
   if (!avahi_init (*core, &argc, &argv)) {
     delete core;
@@ -249,6 +244,11 @@
     return;
   }
 
+  if (!opal_init (*core, &argc, &argv)) {
+    delete core;
+    return;
+  }
+
   videooutput_core->setup_conf_bridge();
   videoinput_core->setup_conf_bridge();
   audiooutput_core->setup_conf_bridge();

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 Aug 10 19:08:40 2008
@@ -37,6 +37,8 @@
 #ifndef __CALL_CORE_H__
 #define __CALL_CORE_H__
 
+#include "form-request.h"
+#include "chain-of-responsibility.h"
 #include "services.h"
 #include "call.h"
 
@@ -151,6 +153,10 @@
       sigc::signal<void, CallManager &> manager_ready;
       sigc::signal<void> ready;
 
+      /** This chain allows the CallCore to report errors to the user
+       */
+      ChainOfResponsibility<std::string> errors;
+
   private:
       void on_new_call (Call *call, CallManager *manager);
       void on_ringing_call (Call *call, CallManager *manager);

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sun Aug 10 19:08:40 2008
@@ -49,6 +49,7 @@
 #include "videoinput-info.h"
 
 #include "call-manager.h"
+#include "form-request-simple.h"
 
 static void
 manager_ready_in_main (Ekiga::CallManager* manager)
@@ -69,10 +70,12 @@
 public:
 
   StunDetector (const std::string & _server, 
+                Ekiga::CallCore & _core,
                 Opal::CallManager & _manager,
                 Ekiga::Runtime & _runtime) 
     : PThread (1000, AutoDeleteThread), 
       server (_server),
+      core (_core),
       manager (_manager),
       runtime (_runtime)
   {
@@ -84,8 +87,17 @@
     PSTUNClient::NatTypes type = manager.SetSTUNServer (server);
     if (type == PSTUNClient::SymmetricNat 
         || type == PSTUNClient::BlockedNat 
-        || type == PSTUNClient::PartialBlockedNat)
-      std::cout << "Bad NAT Type" << std::endl << std::flush;
+        || type == PSTUNClient::PartialBlockedNat) {
+
+      std::string nat_error =  _("The type of NAT that has been detected is not compatible "
+                                 "with Ekiga. "
+                                 "Please refer to our WIKI on http://wiki.ekiga.org to solve that problem.");
+
+      // FIXME: this is a hack
+      while (!core.errors.handle_request (nat_error)) {
+        PThread::Current ()->Sleep (100);
+      }
+    }
 
     for (Ekiga::CallManager::iterator iter = manager.begin ();
          iter != manager.end ();
@@ -98,6 +110,7 @@
 
 private:
   const std::string server;
+  Ekiga::CallCore & core;
   Opal::CallManager & manager;
   Ekiga::Runtime & runtime;
 };
@@ -160,7 +173,7 @@
 void CallManager::start ()
 {
   // Ready
-  new StunDetector ("stun.voxgratia.org", *this, runtime);
+  new StunDetector ("stun.voxgratia.org", *call_core, *this, runtime);
 }
 
 

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Sun Aug 10 19:08:40 2008
@@ -96,6 +96,7 @@
 #include "account.h"
 #include "gtk-frontend.h"
 #include "services.h"
+#include "form-dialog-gtk.h"
 
 #include "../devices/videooutput.h"
 
@@ -965,6 +966,30 @@
 }
 
 
+static bool on_handle_errors (std::string error,
+                              gpointer data)
+{
+  g_return_val_if_fail (data != NULL, false);
+
+  GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (data), 
+                                              GTK_DIALOG_MODAL, 
+                                              GTK_MESSAGE_ERROR,
+                                              GTK_BUTTONS_OK, NULL);
+
+  gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
+  gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), error.c_str ());
+  
+  g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
+                            G_CALLBACK (gtk_widget_destroy),
+                            GTK_OBJECT (dialog));
+  
+  gtk_widget_show_all (dialog);
+
+  return true;
+}
+
+
+
 /* 
  * Display Engine Callbacks 
  */
@@ -1697,7 +1722,7 @@
       
       GTK_MENU_THEME_ENTRY("address_book", _("_Find Contacts"),
 			   _("Find contacts"),
-			   GTK_STOCK_FIND, 0,
+			   GTK_STOCK_FIND, 'F',
 			   GTK_SIGNAL_FUNC (show_widget_cb),
 			   (gpointer) addressbook_window, TRUE),
       
@@ -3925,6 +3950,9 @@
   conn = call_core->stream_resumed.connect (sigc::bind (sigc::ptr_fun (on_stream_resumed_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  conn = call_core->errors.add_handler (sigc::bind (sigc::ptr_fun (on_handle_errors), (gpointer) window));
+  mw->connections.push_back (conn);
+
   /* Notifiers */
   gm_conf_notifier_add (USER_INTERFACE_KEY "main_window/panel_section",
 			panel_section_changed_nt, window);
@@ -4366,8 +4394,8 @@
   gm_conf_watch ();
 
   GnomeMeeting::Process ()->InitEngine ();
-  GnomeMeeting::Process ()->DetectInterfaces ();
   GnomeMeeting::Process ()->BuildGUI ();
+  GnomeMeeting::Process ()->DetectInterfaces ();
   
   /* Add depreciated notifiers */
   gnomemeeting_conf_init ();



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