summaryrefslogtreecommitdiff
path: root/src/FbTk/Resource.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2009-10-01 05:07:07 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2009-10-01 05:07:07 (GMT)
commit38ef6e515589af7841c577188eb23c5dbe5d11f3 (patch)
tree43cea3086cddfb59c7bfb8ea1e05e7ec93910280 /src/FbTk/Resource.cc
parent69de5b5a00abf131452a8d5153afd0df6e86ce6c (diff)
downloadfluxbox_lack-38ef6e515589af7841c577188eb23c5dbe5d11f3.zip
fluxbox_lack-38ef6e515589af7841c577188eb23c5dbe5d11f3.tar.bz2
made code simpler
Diffstat (limited to 'src/FbTk/Resource.cc')
-rw-r--r--src/FbTk/Resource.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc
index 94b31b2..4be85de 100644
--- a/src/FbTk/Resource.cc
+++ b/src/FbTk/Resource.cc
@@ -42,7 +42,11 @@ ResourceManager::ResourceManager(const char *filename, bool lock_db) :
42 m_database(0), 42 m_database(0),
43 m_filename(filename ? filename : "") 43 m_filename(filename ? filename : "")
44{ 44{
45 ensureXrmIsInitialize(); 45 static bool xrm_initialized = false;
46 if (!xrm_initialized) {
47 XrmInitialize();
48 xrm_initialized = true;
49 }
46 50
47 if (lock_db) 51 if (lock_db)
48 lock(); 52 lock();
@@ -53,7 +57,6 @@ ResourceManager::~ResourceManager() {
53 delete m_database; 57 delete m_database;
54} 58}
55 59
56bool ResourceManager::m_init = false;
57 60
58/** 61/**
59 reloads all resources from resourcefile 62 reloads all resources from resourcefile
@@ -198,13 +201,6 @@ void ResourceManager::setResourceValue(const string &resname, const string &valu
198 201
199} 202}
200 203
201void ResourceManager::ensureXrmIsInitialize() {
202 if (!m_init) {
203 XrmInitialize();
204 m_init = true;
205 }
206}
207
208ResourceManager &ResourceManager::lock() { 204ResourceManager &ResourceManager::lock() {
209 ++m_db_lock; 205 ++m_db_lock;
210 // if the lock was zero, then load the database 206 // if the lock was zero, then load the database