Move ELDbus init & shutdown to DALi::Application 25/101625/3
authorTom Robinson <tom.robinson@samsung.com>
Thu, 1 Dec 2016 16:44:08 +0000 (16:44 +0000)
committerTom Robinson <tom.robinson@samsung.com>
Thu, 1 Dec 2016 18:06:03 +0000 (18:06 +0000)
Change-Id: I13ddbd40fb3e1f3e00fbdf906c357d3c29236d55

adaptors/common/application-impl.cpp
adaptors/ecore/wayland/event-handler-ecore-wl.cpp

index c3cdd1e..dece482 100644 (file)
 #include <singleton-service-impl.h>
 #include <lifecycle-controller-impl.h>
 
+// CONDITIONAL INCLUDES
+#ifdef DALI_ELDBUS_AVAILABLE
+#include <Eldbus.h>
+#endif // DALI_ELDBUS_AVAILABLE
+
 namespace Dali
 {
 
@@ -47,6 +52,13 @@ namespace Internal
 namespace Adaptor
 {
 
+#if defined(DEBUG_ENABLED)
+namespace
+{
+Integration::Log::Filter* gDBusLogging = Integration::Log::Filter::New( Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DBUS" );
+} // anonymous namespace
+#endif
+
 ApplicationPtr Application::New(
   int* argc,
   char **argv[],
@@ -104,6 +116,13 @@ Application::~Application()
   delete mFramework;
   delete mCommandLineOptions;
   delete mAdaptor;
+
+#ifdef DALI_ELDBUS_AVAILABLE
+  // Shutdown ELDBus.
+  DALI_LOG_INFO( gDBusLogging, Debug::General, "Shutting down DBus\n" );
+  eldbus_shutdown();
+#endif
+
   mWindow.Reset();
 }
 
@@ -173,9 +192,15 @@ void Application::OnInit()
   mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
 
   CreateWindow();
-  CreateAdaptor();
 
-  // Run the adaptor
+#ifdef DALI_ELDBUS_AVAILABLE
+  // Initialize ElDBus.
+  DALI_LOG_INFO( gDBusLogging, Debug::General, "Starting DBus Initialization\n" );
+  eldbus_init();
+#endif
+
+  // Start the adaptor
+  CreateAdaptor();
   mAdaptor->Start();
 
   // Check if user requires no vsyncing and set on X11 Adaptor
index 1b3012d..1186afe 100644 (file)
@@ -307,10 +307,6 @@ struct EventHandler::Impl
 
 #ifdef DALI_ELDBUS_AVAILABLE
 
-      // Initialize ElDBus.
-      DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
-      eldbus_init();
-
       mSessionConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SESSION );
 
       Eldbus_Object *a11yObject = eldbus_object_get( mSessionConnection, A11Y_BUS, A11Y_PATH );
@@ -341,7 +337,8 @@ struct EventHandler::Impl
     }
 
 #ifdef DALI_ELDBUS_AVAILABLE
-    // Close down ElDBus
+
+    // Close down ElDBus connections.
     if( mA11yConnection )
     {
       eldbus_connection_unref( mA11yConnection );
@@ -352,7 +349,6 @@ struct EventHandler::Impl
       eldbus_connection_unref( mSessionConnection );
     }
 
-    eldbus_shutdown();
 #endif // DALI_ELDBUS_AVAILABLE
   }