- XrmDatabase homeDB, serverDB, applicationDB;
- wxChar filenamebuf[1024];
-
- wxChar *filename = &filenamebuf[0];
- wxChar *environment;
- char *classname = gdk_progclass; // Robert Roebling ??
- char name[256];
- (void)strcpy(name, "/usr/lib/X11/app-defaults/");
- (void)strcat(name, classname ? classname : "wxWindows");
-
- // Get application defaults file, if any
- if ((applicationDB = XrmGetFileDatabase(name)))
- (void)XrmMergeDatabases(applicationDB, &wxResourceDatabase);
-
- // Merge server defaults, created by xrdb, loaded as a property of the root
- // window when the server initializes and loaded into the display
- // structure on XOpenDisplay;
- // if not defined, use .Xdefaults
- if (XResourceManagerString(GDK_DISPLAY()) != NULL)
- {
- serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
- }
- else
- {
- (void)GetIniFile(filename, (wxChar *) NULL);
- serverDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(filename));
- }
- if (serverDB)
- XrmMergeDatabases(serverDB, &wxResourceDatabase);
-
- // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
- // and merge into existing database
-
- if ((environment = wxGetenv(wxT("XENVIRONMENT"))) == NULL)
- {
- environment = GetIniFile(filename, (const wxChar *) NULL);
- size_t len = wxStrlen(environment);
-
- wxChar hostbuf[1024];
- (void)wxGetHostName(hostbuf, WXSIZEOF(hostbuf) - len);
-
- wxStrcat(environment, hostbuf);
- }
-
- if ((homeDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(environment))))
- XrmMergeDatabases(homeDB, &wxResourceDatabase);
+ wxString filename( file );
+ if (filename.IsEmpty()) filename = wxT(".wxWindows");
+
+ wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
+
+ conf.SetPath( section );
+
+ return conf.Write( entry, value );