]> Dogcows Code - chaz/openbox/commitdiff
allow style options in the rc file to override those found in the style
authorDana Jansens <danakj@orodu.net>
Sun, 7 Jul 2002 21:16:35 +0000 (21:16 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 7 Jul 2002 21:16:35 +0000 (21:16 +0000)
src/Configuration.cc
src/Configuration.hh
src/Screen.cc

index 5517790f862baa9bd6418e9307fd5ea304a215d4..237b4a63670fe4e45ddf97e65a100ceaa1b79863 100644 (file)
@@ -35,21 +35,21 @@ using std::string;
 
 bool Configuration::m_initialized = False;
 
-Configuration::Configuration(const string &file) {
+Configuration::Configuration(const string &file, bool autosave) {
   setFile(file);
   m_modified = False;
   m_database = NULL;
-  m_autosave = True;
+  m_autosave = autosave;
   if (! m_initialized) {
     XrmInitialize();
     m_initialized = True;
   }
 }
 
-Configuration::Configuration() {
+Configuration::Configuration(bool autosave) {
   m_modified = False;
   m_database = NULL;
-  m_autosave = True;
+  m_autosave = autosave;
   if (! m_initialized) {
     XrmInitialize();
     m_initialized = True;
@@ -84,6 +84,15 @@ bool Configuration::load() {
   return True;
 }
 
+bool Configuration::merge(const string &file, bool overwrite) {
+  if (XrmCombineFileDatabase(file.c_str(), &m_database, overwrite) == 0)
+    return False;
+  m_modified = True;
+  if (m_autosave)
+    save();
+  return True;
+}
+
 void Configuration::create() {
   if (m_database != NULL)
     XrmDestroyDatabase(m_database);
index 6909c7993f497075f6f8ad1e7480fa398339c1c2..b26541fd97cd0a5b760373b24845aea75cb3cafc 100644 (file)
@@ -37,8 +37,8 @@
  */
 class Configuration {
 public:
-  explicit Configuration(const std::string &file);
-  Configuration();
+  explicit Configuration(const std::string &file, bool autosave = True);
+  Configuration(bool autosave = True);
   virtual ~Configuration();
 
   inline const std::string &file() const {
@@ -58,6 +58,7 @@ public:
 
   void save();
   bool load();
+  bool merge(const std::string &file, bool overwrite = False);
   void create();
 
   void setValue(const std::string &rname, bool value);
index 3a94a4a57cac901d1f9d75af6bede61c4891a236..ca94e75a17361192a08442aebf50415ac8f45422 100644 (file)
@@ -739,24 +739,10 @@ void BScreen::LoadStyle(void) {
     }
   }
 
-  string s;
-
-  if (config->getValue("rootCommand", s))
-    printf("config.rootCommand: %s\n", s.c_str());
-  
-  if (style.getValue("rootCommand", s))
-    printf("style.rootCommand: %s\n", s.c_str());
-
   // merge in the rc file
-  style.merge(config, True);
+  style.merge(config->file(), True);
 
-  printf("merged databases\n");
-
-  if (style.getValue("rootCommand", s))
-    printf("style.rootCommand: %s\n", s.c_str());
-
-  if (style.getValue("session.cacheMax", s))
-    printf("session.cacheMax: %s\n", s.c_str());
+  string s;
 
   // load fonts/fontsets
   if (resource.wstyle.font)
This page took 0.028804 seconds and 4 git commands to generate.