[PC-BSD Commits] r18933 - pcbsd-projects/PCDM

svn at pcbsd.org svn at pcbsd.org
Fri Sep 7 08:05:05 PDT 2012


Author: kenmoore
Date: 2012-09-07 15:05:05 +0000 (Fri, 07 Sep 2012)
New Revision: 18933

Modified:
   pcbsd-projects/PCDM/main.cpp
   pcbsd-projects/PCDM/pcdm-backend.cpp
Log:
Clean up the logging a bit as well as an alternate command to startup a DE (to try out and see if we can get the proper permissions to also allow the DE to shut down the computer, not just log out).



Modified: pcbsd-projects/PCDM/main.cpp
===================================================================
--- pcbsd-projects/PCDM/main.cpp	2012-09-07 14:45:32 UTC (rev 18932)
+++ pcbsd-projects/PCDM/main.cpp	2012-09-07 15:05:05 UTC (rev 18933)
@@ -17,6 +17,7 @@
   bool Debug_Mode = TRUE;
   bool runRestartLoop = TRUE;
   int returnCode;  
+  Backend::openLogFile("/usr/local/share/PCDM/PCDM.log");   
   
   while(runRestartLoop){
     QString changeLang; 
@@ -25,8 +26,7 @@
     // Load the Desired Theme
     Theme::loadTheme(Config::themeFile());
     // Startup the main application
-    QApplication a(argc,argv);
-    Backend::openLogFile("/usr/local/share/PCDM/PCDM.log");  
+    QApplication a(argc,argv); 
     // Check what directory our app is in
     QString appDir;
     if ( QFile::exists("/usr/local/bin/PCDM") ){
@@ -98,7 +98,6 @@
       }
       */
     // Startup the desktop environment if possible
-    Backend::log("Trying to start up the desired desktop environment");
     Backend::startXSession();
     // Check for whether to stay in the restart loop or not
     if(Debug_Mode){

Modified: pcbsd-projects/PCDM/pcdm-backend.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-backend.cpp	2012-09-07 14:45:32 UTC (rev 18932)
+++ pcbsd-projects/PCDM/pcdm-backend.cpp	2012-09-07 15:05:05 UTC (rev 18933)
@@ -83,14 +83,19 @@
 }
 
 void Backend::startXSession(){
+  // WARNING!! This function should *never* be called within the GUI
+  // It should only be called as part of the main event loop
+  
   //Check that there is a username/session that needs to be started
   if( saveX.isEmpty() || saveUsername.isEmpty() ){
     Backend::log("No information to start XSession - skipping");
     return;
   }
+  Backend::log("Starting up Desktop environment ("+saveX+") as user ("+saveUsername+")");
   //Use the saved information and clear it
   QString username = saveUsername;
   QString cmd = "su "+username+" -c "+saveX; //switch user command to start the DE
+  QString cmd1 = "saveX &; su "+username;
   saveUsername.clear(); 
   saveX.clear();
   
@@ -103,7 +108,7 @@
   QProcess* p = new QProcess(0);
   // Setup the process environment
   QProcessEnvironment environ = QProcessEnvironment::systemEnvironment(); //current environment
-  Backend::log("System Environment: " + environ.toStringList().join(" ") );
+  //Backend::log("System Environment: " + environ.toStringList().join(" ") );
   // Setup any specialized environment variables
   // USER, HOME, and SHELL are set by the "su" login
   environ.insert("LOGNAME",username); //Login name
@@ -121,7 +126,7 @@
   p->start(cmd);
   // Wait for the process to start before continuing
   p->waitForStarted();
-  Backend::log("Startup Environment: " + p->processEnvironment().toStringList().join(" ") );
+  //Backend::log("Startup Environment: " + p->processEnvironment().toStringList().join(" ") );
   // Now Wait for the process to finish
   p->waitForFinished(-1);  //do not time-out
 }



More information about the Commits mailing list