[ekiga] Ekiga: Moved PTRACE intialization to OPAL.



commit 929abf7e9a81582901f3746f966ffd63807a6b8e
Author: Damien Sandras <dsandras seconix com>
Date:   Tue Dec 30 13:17:05 2014 +0100

    Ekiga: Moved PTRACE intialization to OPAL.
    
    This must be done before the GmApplication arguments parsing. Moreover,
    it has nothing to do in the generic code. It belongs to the Opal
    component.

 lib/engine/components/opal/opal-main.cpp  |   44 ++++++++++++++++++++++++++++-
 lib/engine/components/opal/opal-main.h    |    3 +-
 lib/engine/engine.cpp                     |    3 +-
 lib/engine/gui/gtk-frontend/ekiga-app.cpp |   37 +-----------------------
 4 files changed, 47 insertions(+), 40 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 1253867..e6953c8 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -148,10 +148,52 @@ struct OPALSpark: public Ekiga::Spark
 };
 
 void
-opal_init_pprocess ()
+opal_init_pprocess (int argc,
+                    char *argv [])
 {
   /* Ekiga PTLIB Process initialisation */
   static GnomeMeeting instance;
+  instance.GetArguments ().SetArgs (argc, argv);
+  PArgList & args = instance.GetArguments ();
+  args.Parse ("d-debug:", false);
+
+  if (args.IsParsed ()) {
+    int debug_level = args.GetOptionAs ('d', 0);
+    if (debug_level == 0)
+      return;
+#ifndef WIN32
+    char* text_label =  g_strdup_printf ("%d", debug_level);
+    setenv ("PTLIB_TRACE_CODECS", text_label, TRUE);
+    g_free (text_label);
+#else
+    char* text_label =  g_strdup_printf ("PTLIB_TRACE_CODECS=%d", debug_level);
+    _putenv (text_label);
+    g_free (text_label);
+    if (debug_level != 0) {
+      std::string desk_path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+      if (!desk_path.empty ())
+        std::freopen((desk_path + "\\ekiga-stderr.txt").c_str (), "w", stderr);
+    }
+#endif
+
+#if PTRACING
+    PTrace::Initialise (PMAX (PMIN (8, debug_level), 0), NULL,
+                        PTrace::Timestamp | PTrace::Thread
+                        | PTrace::Blocks | PTrace::DateAndTime);
+    PTRACE (1, "Ekiga version "
+            << MAJOR_VERSION << "." << MINOR_VERSION << "." << BUILD_NUMBER);
+#ifdef EKIGA_REVISION
+    PTRACE (1, "Ekiga git revision: " << EKIGA_REVISION);
+#endif
+    PTRACE (1, "PTLIB version " << PTLIB_VERSION);
+    PTRACE (1, "OPAL version " << OPAL_VERSION);
+#ifdef HAVE_DBUS
+    PTRACE (1, "DBUS support enabled");
+#else
+    PTRACE (1, "DBUS support disabled");
+#endif
+#endif
+  }
 }
 
 void
diff --git a/lib/engine/components/opal/opal-main.h b/lib/engine/components/opal/opal-main.h
index bbc575e..f8b9b4e 100644
--- a/lib/engine/components/opal/opal-main.h
+++ b/lib/engine/components/opal/opal-main.h
@@ -40,7 +40,8 @@
 
 #include "kickstart.h"
 
-void opal_init_pprocess ();
+void opal_init_pprocess (int argc,
+                         char *argv[]);
 
 // Must be called after opal_init_pprocess.
 void opal_init (Ekiga::KickStart& kickstart);
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 9150aa3..8bc04c4 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -92,8 +92,7 @@ engine_init (Ekiga::ServiceCorePtr service_core,
              char *argv [])
 {
   // AT THE VERY FIRST, create the PProcess
-
-  opal_init_pprocess ();
+  opal_init_pprocess (argc, argv);
 
   // FIRST we add a few things by hand
   // (for speed and because that's less code)
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.cpp b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
index f1a5268..9825b45 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.cpp
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
@@ -397,12 +397,11 @@ ekiga_main (int argc,
   }
 
   Ekiga::ServiceCorePtr core(new Ekiga::ServiceCore);
+  gm_application_set_core (app, core);
 
   Ekiga::Runtime::init ();
   engine_init (core, argc, argv);
 
-  gm_application_set_core (app, core);
-
   /* Create the main application window */
   app->priv->main_window = gm_main_window_new (app);
   gm_application_show_main_window (app);
@@ -679,40 +678,6 @@ gm_application_command_line (GApplication *app,
     g_print (g_option_context_get_help (context, TRUE, NULL));
     g_application_quit (app);
   }
-  else if (debug_level > 0) {
-#ifndef WIN32
-    char* text_label =  g_strdup_printf ("%d", debug_level);
-    setenv ("PTLIB_TRACE_CODECS", text_label, TRUE);
-    g_free (text_label);
-#else
-    char* text_label =  g_strdup_printf ("PTLIB_TRACE_CODECS=%d", debug_level);
-    _putenv (text_label);
-    g_free (text_label);
-    if (debug_level != 0) {
-      std::string desk_path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
-      if (!desk_path.empty ())
-        std::freopen((desk_path + "\\ekiga-stderr.txt").c_str (), "w", stderr);
-    }
-#endif
-
-#if PTRACING
-    PTrace::Initialise (PMAX (PMIN (8, debug_level), 0), NULL,
-                        PTrace::Timestamp | PTrace::Thread
-                        | PTrace::Blocks | PTrace::DateAndTime);
-    PTRACE (1, "Ekiga version "
-            << MAJOR_VERSION << "." << MINOR_VERSION << "." << BUILD_NUMBER);
-#ifdef EKIGA_REVISION
-    PTRACE (1, "Ekiga git revision: " << EKIGA_REVISION);
-#endif
-    PTRACE (1, "PTLIB version " << PTLIB_VERSION);
-    PTRACE (1, "OPAL version " << OPAL_VERSION);
-#ifdef HAVE_DBUS
-    PTRACE (1, "DBUS support enabled");
-#else
-    PTRACE (1, "DBUS support disabled");
-#endif
-#endif
-  }
 
   g_strfreev (arguments);
   g_option_context_free (context);


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