make use of FbTk-api

This commit is contained in:
Mathias Gumz 2014-10-27 13:46:32 +01:00
parent c5fd69cc9d
commit 2309751143

View file

@ -49,17 +49,13 @@
#include "FbTk/App.hh" #include "FbTk/App.hh"
#include "FbTk/MenuSeparator.hh" #include "FbTk/MenuSeparator.hh"
#include "FbTk/FileUtil.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/StringUtil.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/BoolMenuItem.hh" #include "FbTk/BoolMenuItem.hh"
#include "FbTk/IntMenuItem.hh" #include "FbTk/IntMenuItem.hh"
#include "FbTk/RadioMenuItem.hh" #include "FbTk/RadioMenuItem.hh"
#ifdef HAVE_SYS_STAT_H
#include <sys/types.h>
#include <sys/stat.h>
#endif // HAVE_SYS_STAT_H
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <iostream> #include <iostream>
@ -1043,10 +1039,12 @@ void Slit::toggleHidden() {
if (doAutoHide()) { if (doAutoHide()) {
if (!m_slitmenu.isVisible()) { if (!m_slitmenu.isVisible()) {
m_timer.fireOnce(true); m_timer.fireOnce(true);
} else } else {
return; return;
} else }
if (!isHidden()) return; //} else if (!isHidden()) {
// return;
}
m_hidden = ! m_hidden; // toggle hidden state m_hidden = ! m_hidden; // toggle hidden state
if (isHidden()) if (isHidden())
@ -1063,29 +1061,30 @@ void Slit::loadClientList(const char *filename) {
m_filename = filename; m_filename = filename;
string real_filename= FbTk::StringUtil::expandFilename(filename); string real_filename= FbTk::StringUtil::expandFilename(filename);
struct stat buf; if (!FbTk::FileUtil::isRegularFile(real_filename.c_str())) {
if (stat(real_filename.c_str(), &buf) == 0) { return;
ifstream file(real_filename.c_str()); }
string name;
while (! file.eof()) {
name = "";
getline(file, name); // get the entire line
if (name.empty())
continue;
// remove whitespaces from start and end ifstream file(real_filename.c_str());
FbTk::StringUtil::removeFirstWhitespace(name); string name;
while (! file.eof()) {
name.clear();
getline(file, name); // get the entire line
if (name.empty())
continue;
// the cleaned string could still be a comment, or blank // remove whitespaces from start and end
if ( name.empty() || name[0] == '#' || name[0] == '!' ) FbTk::StringUtil::removeFirstWhitespace(name);
continue;
// trailing whitespace won't affect the above test // the cleaned string could still be a comment, or blank
FbTk::StringUtil::removeTrailingWhitespace(name); if ( name.empty() || name[0] == '#' || name[0] == '!' )
continue;
SlitClient *client = new SlitClient(name.c_str()); // trailing whitespace won't affect the above test
m_client_list.push_back(client); FbTk::StringUtil::removeTrailingWhitespace(name);
}
SlitClient *client = new SlitClient(name.c_str());
m_client_list.push_back(client);
} }
} }