using empty instead of size

This commit is contained in:
fluxgen 2004-01-21 13:36:09 +00:00
parent 5685dc9195
commit 9c0272004e
3 changed files with 17 additions and 18 deletions

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: SystemTray.cc,v 1.5 2004/01/19 18:22:57 fluxgen Exp $ // $Id: SystemTray.cc,v 1.6 2004/01/21 13:35:10 fluxgen Exp $
#include "SystemTray.hh" #include "SystemTray.hh"
@ -215,7 +215,7 @@ void SystemTray::addClient(Window win) {
#ifdef DEBUG #ifdef DEBUG
cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl; cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl;
#endif // DEBUG #endif // DEBUG
if (m_clients.size() == 0) if (m_clients.empty())
show(); show();
FbTk::FbWindow *traywin = new TrayWindow(win); FbTk::FbWindow *traywin = new TrayWindow(win);
@ -244,7 +244,7 @@ void SystemTray::removeClient(Window win) {
delete traywin; delete traywin;
resize(width(), height()); resize(width(), height());
rearrangeClients(); rearrangeClients();
if (m_clients.size() == 0) { if (m_clients.empty()) {
// so we send configurenotify signal to parent // so we send configurenotify signal to parent
m_window.resize(1, 1); m_window.resize(1, 1);
hide(); hide();

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Toolbar.cc,v 1.137 2004/01/16 11:41:38 fluxgen Exp $ // $Id: Toolbar.cc,v 1.138 2004/01/21 13:36:09 fluxgen Exp $
#include "Toolbar.hh" #include "Toolbar.hh"
@ -370,7 +370,7 @@ void Toolbar::reconfigure() {
tools.begin(), tools.begin(),
FbTk::StringUtil::toLower); FbTk::StringUtil::toLower);
if (tools.size() == m_tools.size() && tools.size() != 0) { if (!tools.empty() && tools.size() == m_tools.size()) {
StringList::const_iterator tool_it = tools.begin(); StringList::const_iterator tool_it = tools.begin();
StringList::const_iterator current_tool_it = m_tools.begin(); StringList::const_iterator current_tool_it = m_tools.begin();
StringList::const_iterator tool_it_end = tools.end(); StringList::const_iterator tool_it_end = tools.end();

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.227 2004/01/19 18:33:05 fluxgen Exp $ // $Id: fluxbox.cc,v 1.228 2004/01/21 13:33:50 fluxgen Exp $
#include "fluxbox.hh" #include "fluxbox.hh"
@ -508,8 +508,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
char scrname[128], altscrname[128]; char scrname[128], altscrname[128];
sprintf(scrname, "session.screen%d", i); sprintf(scrname, "session.screen%d", i);
sprintf(altscrname, "session.Screen%d", i); sprintf(altscrname, "session.Screen%d", i);
BScreen *screen = new BScreen(m_screen_rm.lock(), BScreen *screen = new BScreen(m_screen_rm.lock(),
scrname, altscrname, scrname, altscrname,
i, getNumberOfLayers()); i, getNumberOfLayers());
if (! screen->isScreenManaged()) { if (! screen->isScreenManaged()) {
@ -563,7 +562,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
m_keyscreen = m_mousescreen = m_screen_list.front(); m_keyscreen = m_mousescreen = m_screen_list.front();
if (m_screen_list.size() == 0) { if (m_screen_list.empty()) {
//!! TODO: NLS //!! TODO: NLS
throw string("Couldn't find screens to manage.\n" throw string("Couldn't find screens to manage.\n"
"Make sure you don't have another window manager running."); "Make sure you don't have another window manager running.");
@ -1544,7 +1543,7 @@ void Fluxbox::save_rc() {
string dbfile(getRcFilename()); string dbfile(getRcFilename());
if (dbfile.size() != 0) { if (!dbfile.empty()) {
m_resourcemanager.save(dbfile.c_str(), dbfile.c_str()); m_resourcemanager.save(dbfile.c_str(), dbfile.c_str());
m_screen_rm.save(dbfile.c_str(), dbfile.c_str()); m_screen_rm.save(dbfile.c_str(), dbfile.c_str());
} else } else
@ -1593,7 +1592,7 @@ void Fluxbox::save_rc() {
/// @return filename of resource file /// @return filename of resource file
string Fluxbox::getRcFilename() { string Fluxbox::getRcFilename() {
if (m_rc_file.size() == 0) { // set default filename if (m_rc_file.empty()) { // set default filename
string defaultfile(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + m_RC_INIT_FILE); string defaultfile(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + m_RC_INIT_FILE);
return defaultfile; return defaultfile;
} }
@ -1612,7 +1611,7 @@ void Fluxbox::load_rc() {
//get resource filename //get resource filename
string dbfile(getRcFilename()); string dbfile(getRcFilename());
if (dbfile.size() != 0) { if (!dbfile.empty()) {
if (!m_resourcemanager.load(dbfile.c_str())) { if (!m_resourcemanager.load(dbfile.c_str())) {
cerr<<"Failed to load database:"<<dbfile<<endl; cerr<<"Failed to load database:"<<dbfile<<endl;
cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl; cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl;
@ -1624,10 +1623,10 @@ void Fluxbox::load_rc() {
cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl; cerr<<"Failed to load database: "<<DEFAULT_INITFILE<<endl;
} }
if (m_rc_menufile->size() == 0) if (m_rc_menufile->empty())
m_rc_menufile.setDefaultValue(); m_rc_menufile.setDefaultValue();
if (m_rc_slitlistfile->size() != 0) { if (!m_rc_slitlistfile->empty()) {
*m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile); *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);
} else { } else {
string filename; string filename;
@ -1640,7 +1639,7 @@ void Fluxbox::load_rc() {
else if (*m_rc_colors_per_channel > 6) else if (*m_rc_colors_per_channel > 6)
*m_rc_colors_per_channel = 6; *m_rc_colors_per_channel = 6;
if (m_rc_stylefile->size() == 0) if (m_rc_stylefile->empty())
*m_rc_stylefile = DEFAULTSTYLE; *m_rc_stylefile = DEFAULTSTYLE;
else // expand tilde else // expand tilde
*m_rc_stylefile = StringUtil::expandFilename(*m_rc_stylefile); *m_rc_stylefile = StringUtil::expandFilename(*m_rc_stylefile);
@ -1711,7 +1710,7 @@ void Fluxbox::load_rc(BScreen &screen) {
FbTk::Image::addSearchPath(paths[i]); FbTk::Image::addSearchPath(paths[i]);
} }
if (dbfile.size() != 0) { if (!dbfile.empty()) {
if (!m_screen_rm.load(dbfile.c_str())) { if (!m_screen_rm.load(dbfile.c_str())) {
cerr<<"Failed to load database:"<<dbfile<<endl; cerr<<"Failed to load database:"<<dbfile<<endl;
cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl; cerr<<"Trying with: "<<DEFAULT_INITFILE<<endl;
@ -1948,7 +1947,7 @@ void Fluxbox::setFocusedWindow(WinClient *client) {
if (screen != 0) { if (screen != 0) {
screen->updateNetizenWindowFocus(); screen->updateNetizenWindowFocus();
for (int i=0; i < m_atomhandler.size(); ++i) { for (size_t i=0; i < m_atomhandler.size(); ++i) {
m_atomhandler[i]->updateFocusedWindow(*screen, (m_focused_window ? m_atomhandler[i]->updateFocusedWindow(*screen, (m_focused_window ?
m_focused_window->window() : m_focused_window->window() :
@ -1958,7 +1957,7 @@ void Fluxbox::setFocusedWindow(WinClient *client) {
if (old_screen && old_screen != screen) { if (old_screen && old_screen != screen) {
old_screen->updateNetizenWindowFocus(); old_screen->updateNetizenWindowFocus();
for (int i=0; i < m_atomhandler.size(); ++i) for (size_t i=0; i < m_atomhandler.size(); ++i)
m_atomhandler[i]->updateFocusedWindow(*old_screen, 0); m_atomhandler[i]->updateFocusedWindow(*old_screen, 0);
} }