aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-19 17:08:25 (GMT)
committerfluxgen <fluxgen>2003-12-19 17:08:25 (GMT)
commitffc8cb9443d4ec44cd05c0cb82a27c597ef53888 (patch)
tree372ac82bfbf3c73eab5ac3d59e6261e0bcbdc544 /src/FbTk
parentbfd09dc88ceeda456f93bb85e1a328bb1e2e42e0 (diff)
downloadfluxbox-ffc8cb9443d4ec44cd05c0cb82a27c597ef53888.zip
fluxbox-ffc8cb9443d4ec44cd05c0cb82a27c597ef53888.tar.bz2
setResourceValue function and a dump
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Resource.cc15
-rw-r--r--src/FbTk/Resource.hh12
2 files changed, 24 insertions, 3 deletions
diff --git a/src/FbTk/Resource.cc b/src/FbTk/Resource.cc
index c21e55d..ad30b57 100644
--- a/src/FbTk/Resource.cc
+++ b/src/FbTk/Resource.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Resource.cc,v 1.2 2003/07/18 15:40:55 rathnor Exp $ 22// $Id: Resource.cc,v 1.3 2003/12/19 17:08:25 fluxgen Exp $
23 23
24#include "XrmDatabaseHelper.hh" 24#include "XrmDatabaseHelper.hh"
25#include "Resource.hh" 25#include "Resource.hh"
@@ -143,6 +143,19 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) {
143 return true; 143 return true;
144} 144}
145 145
146void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) {
147 // find resource name
148 ResourceList::iterator i = m_resourcelist.begin();
149 ResourceList::iterator i_end = m_resourcelist.end();
150 for (; i != i_end; ++i) {
151 if ((*i)->name() == resname ||
152 (*i)->altName() == resname) {
153 (*i)->setFromString(value.c_str());
154 return;
155 }
156 }
157}
158
146void ResourceManager::ensureXrmIsInitialize() { 159void ResourceManager::ensureXrmIsInitialize() {
147 if (!m_init) { 160 if (!m_init) {
148 XrmInitialize(); 161 XrmInitialize();
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh
index 06d4b67..93cfc9e 100644
--- a/src/FbTk/Resource.hh
+++ b/src/FbTk/Resource.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Resource.hh,v 1.5 2003/12/16 17:06:52 fluxgen Exp $ 22// $Id: Resource.hh,v 1.6 2003/12/19 17:08:25 fluxgen Exp $
23 23
24#ifndef FBTK_RESOURCE_HH 24#ifndef FBTK_RESOURCE_HH
25#define FBTK_RESOURCE_HH 25#define FBTK_RESOURCE_HH
@@ -97,6 +97,8 @@ public:
97 m_resourcelist.remove(&r); 97 m_resourcelist.remove(&r);
98 } 98 }
99 99
100 void setResourceValue(const std::string &resourcename, const std::string &value);
101
100 // this marks the database as "in use" and will avoid reloading 102 // this marks the database as "in use" and will avoid reloading
101 // resources unless it is zero. 103 // resources unless it is zero.
102 // It returns this resource manager. Useful for passing to 104 // It returns this resource manager. Useful for passing to
@@ -105,7 +107,13 @@ public:
105 void unlock(); 107 void unlock();
106 // for debugging 108 // for debugging
107 inline int lockDepth() const { return m_db_lock; } 109 inline int lockDepth() const { return m_db_lock; }
108 110 void dump() {
111 ResourceList::iterator it = m_resourcelist.begin();
112 ResourceList::iterator it_end = m_resourcelist.end();
113 for (; it != it_end; ++it) {
114 std::cerr<<(*it)->name()<<std::endl;
115 }
116 }
109protected: 117protected:
110 static void ensureXrmIsInitialize(); 118 static void ensureXrmIsInitialize();
111 119