diff options
author | fluxgen <fluxgen> | 2002-07-20 09:51:26 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-07-20 09:51:26 (GMT) |
commit | a18a6b0994292668db09b4c7af0c4e1199b308f8 (patch) | |
tree | 778e993c5d8109fb602b46312ca462ab19623aab /src/Resource.cc | |
parent | cd7b6d1fd5b1ac1614b1431126f266d8651c890c (diff) | |
download | fluxbox_pavel-a18a6b0994292668db09b4c7af0c4e1199b308f8.zip fluxbox_pavel-a18a6b0994292668db09b4c7af0c4e1199b308f8.tar.bz2 |
comments and other minor stuff
Diffstat (limited to 'src/Resource.cc')
-rw-r--r-- | src/Resource.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Resource.cc b/src/Resource.cc index 8bd4e26..cb871f1 100644 --- a/src/Resource.cc +++ b/src/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 2002/02/04 06:47:34 fluxgen Exp $ | 22 | // $Id: Resource.cc,v 1.3 2002/07/20 09:51:26 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Resource.hh" | 24 | #include "Resource.hh" |
25 | #include "XrmDatabaseHelper.hh" | 25 | #include "XrmDatabaseHelper.hh" |
@@ -55,11 +55,11 @@ bool ResourceManager::load(const char *filename) { | |||
55 | for (; i != i_end; ++i) { | 55 | for (; i != i_end; ++i) { |
56 | 56 | ||
57 | Resource_base *resource = *i; | 57 | Resource_base *resource = *i; |
58 | if (XrmGetResource(*database, resource->getName().c_str(), | 58 | if (XrmGetResource(*database, resource->name().c_str(), |
59 | resource->getAltName().c_str(), &value_type, &value)) | 59 | resource->altName().c_str(), &value_type, &value)) |
60 | resource->setFromString(value.addr); | 60 | resource->setFromString(value.addr); |
61 | else { | 61 | else { |
62 | cerr<<"Faild to read: "<<resource->getName()<<endl; | 62 | cerr<<"Failed to read: "<<resource->name()<<endl; |
63 | cerr<<"Setting default value"<<endl; | 63 | cerr<<"Setting default value"<<endl; |
64 | resource->setDefaultValue(); | 64 | resource->setDefaultValue(); |
65 | } | 65 | } |
@@ -87,7 +87,7 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) { | |||
87 | //write all resources to database | 87 | //write all resources to database |
88 | for (; i != i_end; ++i) { | 88 | for (; i != i_end; ++i) { |
89 | Resource_base *resource = *i; | 89 | Resource_base *resource = *i; |
90 | rc_string = resource->getName() + string(": ") + resource->getString(); | 90 | rc_string = resource->name() + string(": ") + resource->getString(); |
91 | XrmPutLineResource(&*database, rc_string.c_str()); | 91 | XrmPutLineResource(&*database, rc_string.c_str()); |
92 | } | 92 | } |
93 | 93 | ||
@@ -97,13 +97,14 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) { | |||
97 | //check if we want to merge a database | 97 | //check if we want to merge a database |
98 | if (mergefilename) { | 98 | if (mergefilename) { |
99 | XrmDatabaseHelper olddatabase(mergefilename); | 99 | XrmDatabaseHelper olddatabase(mergefilename); |
100 | if (olddatabase == 0) | 100 | if (olddatabase == 0) // did we load the file? |
101 | return false; | 101 | return false; |
102 | 102 | ||
103 | XrmMergeDatabases(*database, &*olddatabase); | 103 | XrmMergeDatabases(*database, &*olddatabase); // merge databases |
104 | XrmPutFileDatabase(*olddatabase, filename); //save database to file | 104 | XrmPutFileDatabase(*olddatabase, filename); // save database to file |
105 | *database=0; //don't try to destroy the database | 105 | |
106 | } else //save database to file | 106 | *database = 0; // don't try to destroy the database |
107 | } else // save database to file | ||
107 | XrmPutFileDatabase(*database, filename); | 108 | XrmPutFileDatabase(*database, filename); |
108 | 109 | ||
109 | return true; | 110 | return true; |