denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Is there a point to denemo.conf?


From: Roy Rankin
Subject: Re: [Denemo-devel] Is there a point to denemo.conf?
Date: Mon, 04 Aug 2008 10:19:43 +1000
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Jeremiah,

My reaction is that it is better style to have the information in a configuration file rather then placed in the code. Also it means system administrators can set appropriate system defaults. Currently we have a foot in both hard-code and configuration file (the worst of all worlds).

My suggestion is get the current release to read /etc/denemo/denemo.conf. In the next release remove the hard-coded fields and move them into the denemo.conf file.

In regards to denemorc.xml, I am concerned that if we do not remove it now it will haunt us from all time to come, and to remove it, only requires.

1> removing the line
"%config(noreplace) %{_sysconfdir}/denemo/denemorc.xml"
from the denemo.spec.in

2> change the line
dist_pkgdata_DATA = denemo.conf denemorc.xml
to
dist_pkgdata_DATA = denemo.conf
in Makefile.am

Your new function has a small error, the following version compiles in Linux and seemed to work.

diff --git a/src/utils.c b/src/utils.c
index 30b07e2..f900c30 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -542,6 +542,24 @@ get_data_dir ()
 }

 const gchar *
+get_conf_dir ()
+{
+  static gchar *confdir = NULL;
+  if (confdir == NULL)
+  {
+#ifdef G_OS_WIN32
+    gchar *rootdir = g_win32_get_package_installation_directory (NULL,
+NULL);
+    confdir = g_build_filename (rootdir, "etc", "denemo", NULL);
+    g_free (rootdir);
+#else /* not G_OS_WIN32 */
+  confdir = gbr_find_etc_dir(SYSCONFDIR);
+#endif /* not G_OS_WIN32 */
+  }
+  return confdir;
+}
+
+const gchar *
 get_plugin_dir ()
 {
   static gchar *plugindir = NULL;

Also required is

diff --git a/src/prefops.c b/src/prefops.c
index fd52442..df24107 100644
--- a/src/prefops.c
+++ b/src/prefops.c
@@ -64,7 +64,7 @@ locatedotdenemo ()
 void
 initprefs ()
 {
- gchar *systemwide = g_build_filename (get_data_dir (), "denemo.conf", NULL); + gchar *systemwide = g_build_filename (get_conf_dir (), "denemo.conf", NULL);
   DenemoPrefs *ret = &Denemo.prefs;
   gchar * dotdenemo = locatedotdenemo ();
gchar *localrc = dotdenemo?g_build_filename (dotdenemo, "denemorc", NULL):NULL;

Roy

Jeremiah Benham wrote:
denemo does not need denemo.conf to launch because all the default
values are already set in denemo itself without the need of a
denemo.conf in /etc. After the first launch a ~/.denemo/denemorc is
created and denemo configuration is read from there anyway. denemorc.xml
is installed but denemo does not even use it. I vote we just
eliminate /etc/denemo all together. The only thing I can image that
would make it useful is if users had no home directory and the admin of
the system wanted to set some default values. Normally though if a user
has a ~/.denemo then the configuration would be read from that. Or we
can keep it as it is in /etc/denemo. Opinions?

Jeremiah


_______________________________________________
Denemo-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/denemo-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]