From: Dana Jansens Date: Fri, 12 Apr 2002 06:11:31 +0000 (+0000) Subject: real_reconfigure now using obResource instead of teh XrmDatabase calls. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=456cf2d5065b6939516194c896ccc6f443c08a8c;p=chaz%2Fopenbox real_reconfigure now using obResource instead of teh XrmDatabase calls. obResource class calls XrmInitialize(). --- diff --git a/src/Resource.cc b/src/Resource.cc index b3605218..1f6f8438 100644 --- a/src/Resource.cc +++ b/src/Resource.cc @@ -35,17 +35,27 @@ #include +bool obResource::m_initialized = false; + obResource::obResource(const std::string &file) { setFile(file); m_modified = false; m_database = NULL; m_autosave = true; + if (!m_initialized) { + XrmInitialize(); + m_initialized = true; + } } obResource::obResource() { m_modified = false; m_database = NULL; m_autosave = true; + if (!m_initialized) { + XrmInitialize(); + m_initialized = true; + } } obResource::~obResource() { diff --git a/src/Resource.h b/src/Resource.h index 985e29d8..912ae753 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -65,6 +65,7 @@ public: std::string &value) const; private: + static bool m_initialized; std::string m_file; bool m_modified; bool m_autosave; diff --git a/src/openbox.cc b/src/openbox.cc index 2f41fcbb..55c07acd 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -197,7 +197,6 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc) menuTimestamps = new LinkedList; - XrmInitialize(); load_rc(); #ifdef HAVE_GETPID @@ -1491,18 +1490,9 @@ void Openbox::reconfigure(void) { void Openbox::real_reconfigure(void) { grab(); - XrmDatabase new_openboxrc = (XrmDatabase) 0; - char style[MAXPATHLEN + 64]; - - sprintf(style, "session.styleFile: %s", resource.style_file); - XrmPutLineResource(&new_openboxrc, style); - - XrmDatabase old_openboxrc = XrmGetFileDatabase(rc_file); - - XrmMergeDatabases(new_openboxrc, &old_openboxrc); - XrmPutFileDatabase(old_openboxrc, rc_file); - if (old_openboxrc) XrmDestroyDatabase(old_openboxrc); - + config.load(); + config.setValue("session.styleFile", resource.style_file); // autosave's + for (int i = 0, n = menuTimestamps->count(); i < n; i++) { MenuTimestamp *ts = menuTimestamps->remove(0);