You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/x11-misc/slim/files/slim-1.3.6-session-chooser....

116 lines
3.9 KiB

--- a/cfg.cpp 2013-10-01 18:38:05.000000000 -0400
+++ b/cfg.cpp 2013-10-24 12:12:20.584103253 -0400
@@ -274,14 +274,14 @@
while (true) {
string::const_iterator begin = s;
while (*s != c && s != str.end()) { ++s; }
- tmp = string(begin, s);
- if (useEmpty || tmp.size() > 0)
+ tmp = string(begin, s);
+ if (useEmpty || tmp.size() > 0)
v.push_back(tmp);
if (s == str.end()) {
break;
}
if (++s == str.end()) {
- if (useEmpty)
+ if (useEmpty)
v.push_back("");
break;
}
@@ -289,6 +289,7 @@
}
void Cfg::fillSessionList(){
+ string strSessionList = getOption("sessions");
string strSessionDir = getOption("sessiondir");
sessions.clear();
@@ -307,29 +308,29 @@
struct stat oFileStat;
if (stat(strFile.c_str(), &oFileStat) == 0) {
- if (S_ISREG(oFileStat.st_mode) &&
- access(strFile.c_str(), R_OK) == 0){
- ifstream desktop_file( strFile.c_str() );
- if (desktop_file){
- string line, session_name = "", session_exec = "";
- while (getline( desktop_file, line )) {
- if (line.substr(0, 5) == "Name=") {
- session_name = line.substr(5);
- if (!session_exec.empty())
- break;
- } else
- if (line.substr(0, 5) == "Exec=") {
- session_exec = line.substr(5);
- if (!session_name.empty())
- break;
- }
- }
- desktop_file.close();
- pair<string,string> session(session_name,session_exec);
- sessions.push_back(session);
- cout << session_exec << " - " << session_name << endl;
- }
-
+ if (S_ISREG(oFileStat.st_mode) &&
+ access(strFile.c_str(), R_OK) == 0){
+ ifstream desktop_file( strFile.c_str() );
+ if (desktop_file){
+ string line, session_name = "", session_exec = "";
+ while (getline( desktop_file, line )) {
+ if (line.substr(0, 5) == "Name=") {
+ session_name = line.substr(5);
+ if (!session_exec.empty()) break;
+ } else if (line.substr(0, 5) == "Exec=") {
+ session_exec = line.substr(5);
+ if (!session_name.empty()) break;
+ }
+ }
+ desktop_file.close();
+ if (!session_name.empty() && !session_exec.empty()) {
+ pair<string,string> session(session_name,session_exec);
+ sessions.push_back(session);
+ } else if (access(strFile.c_str(), X_OK) == 0) {
+ pair<string,string> session(string(pDirent->d_name),strFile);
+ sessions.push_back(session);
+ }
+ }
}
}
}
@@ -338,8 +339,18 @@
}
if (sessions.empty()){
- pair<string,string> session("","");
- sessions.push_back(session);
+ if (strSessionList.empty()) {
+ pair<string,string> session("","");
+ sessions.push_back(session);
+ } else {
+ // iterate through the split of the session list
+ vector<string> sessit;
+ split(sessit,strSessionList,',',false);
+ for (vector<string>::iterator it = sessit.begin(); it != sessit.end(); ++it) {
+ pair<string,string> session(*it,*it);
+ sessions.push_back(session);
+ }
+ }
}
}
--- a/app.cpp 2013-10-24 12:16:59.870111072 -0400
+++ b/app.cpp 2013-10-24 12:29:59.899132910 -0400
@@ -377,10 +377,6 @@
LoginPanel->SetName(cfg->getOption("default_user") );
}
- if (firstloop) {
- LoginPanel->SwitchSession();
- }
-
if (!AuthenticateUser(focuspass && firstloop)){
panelclosed = 0;
firstloop = false;