aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2014-10-27 12:46:32 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2014-10-27 12:46:32 (GMT)
commit23097511432d6568e11d04c276310617585b766f (patch)
tree438fb0fa82277f0d052ddedfa041849f03d72461
parentc5fd69cc9de2ed08176d655c1e46e9305c5543df (diff)
downloadfluxbox-23097511432d6568e11d04c276310617585b766f.zip
fluxbox-23097511432d6568e11d04c276310617585b766f.tar.bz2
make use of FbTk-api
-rw-r--r--src/Slit.cc53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 9eaa439..46390c7 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -49,17 +49,13 @@
49 49
50#include "FbTk/App.hh" 50#include "FbTk/App.hh"
51#include "FbTk/MenuSeparator.hh" 51#include "FbTk/MenuSeparator.hh"
52#include "FbTk/FileUtil.hh"
52#include "FbTk/StringUtil.hh" 53#include "FbTk/StringUtil.hh"
53#include "FbTk/I18n.hh" 54#include "FbTk/I18n.hh"
54#include "FbTk/BoolMenuItem.hh" 55#include "FbTk/BoolMenuItem.hh"
55#include "FbTk/IntMenuItem.hh" 56#include "FbTk/IntMenuItem.hh"
56#include "FbTk/RadioMenuItem.hh" 57#include "FbTk/RadioMenuItem.hh"
57 58
58#ifdef HAVE_SYS_STAT_H
59#include <sys/types.h>
60#include <sys/stat.h>
61#endif // HAVE_SYS_STAT_H
62
63#include <X11/Xatom.h> 59#include <X11/Xatom.h>
64 60
65#include <iostream> 61#include <iostream>
@@ -1043,10 +1039,12 @@ void Slit::toggleHidden() {
1043 if (doAutoHide()) { 1039 if (doAutoHide()) {
1044 if (!m_slitmenu.isVisible()) { 1040 if (!m_slitmenu.isVisible()) {
1045 m_timer.fireOnce(true); 1041 m_timer.fireOnce(true);
1046 } else 1042 } else {
1047 return; 1043 return;
1048 } else 1044 }
1049 if (!isHidden()) return; 1045 //} else if (!isHidden()) {
1046 // return;
1047 }
1050 1048
1051 m_hidden = ! m_hidden; // toggle hidden state 1049 m_hidden = ! m_hidden; // toggle hidden state
1052 if (isHidden()) 1050 if (isHidden())
@@ -1063,29 +1061,30 @@ void Slit::loadClientList(const char *filename) {
1063 m_filename = filename; 1061 m_filename = filename;
1064 string real_filename= FbTk::StringUtil::expandFilename(filename); 1062 string real_filename= FbTk::StringUtil::expandFilename(filename);
1065 1063
1066 struct stat buf; 1064 if (!FbTk::FileUtil::isRegularFile(real_filename.c_str())) {
1067 if (stat(real_filename.c_str(), &buf) == 0) { 1065 return;
1068 ifstream file(real_filename.c_str()); 1066 }
1069 string name;
1070 while (! file.eof()) {
1071 name = "";
1072 getline(file, name); // get the entire line
1073 if (name.empty())
1074 continue;
1075 1067
1076 // remove whitespaces from start and end 1068 ifstream file(real_filename.c_str());
1077 FbTk::StringUtil::removeFirstWhitespace(name); 1069 string name;
1070 while (! file.eof()) {
1071 name.clear();
1072 getline(file, name); // get the entire line
1073 if (name.empty())
1074 continue;
1075
1076 // remove whitespaces from start and end
1077 FbTk::StringUtil::removeFirstWhitespace(name);
1078 1078
1079 // the cleaned string could still be a comment, or blank 1079 // the cleaned string could still be a comment, or blank
1080 if ( name.empty() || name[0] == '#' || name[0] == '!' ) 1080 if ( name.empty() || name[0] == '#' || name[0] == '!' )
1081 continue; 1081 continue;
1082 1082
1083 // trailing whitespace won't affect the above test 1083 // trailing whitespace won't affect the above test
1084 FbTk::StringUtil::removeTrailingWhitespace(name); 1084 FbTk::StringUtil::removeTrailingWhitespace(name);
1085 1085
1086 SlitClient *client = new SlitClient(name.c_str()); 1086 SlitClient *client = new SlitClient(name.c_str());
1087 m_client_list.push_back(client); 1087 m_client_list.push_back(client);
1088 }
1089 } 1088 }
1090} 1089}
1091 1090