Package: slim
Version: 1.3.1-4
Severity: wishlist
Tags: patch

It would be good if slim could read an additional configurations file so
that the user can use various config file tags without having to edit   
/etc/slim.conf as this is a conffile and the user editing it might      
at a later point be a source of confusion or problem for said user if   
the conffile gets edited by the package maintainer.                     

The attached patch will allow slim to first read slim.conf and then
read /etc/slim.d/slim_custom.conf . This way any options specified in 
slim_custom.conf will override said options in slim.conf              

Regards 
Nikolas 

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-1.slh.4-sidux-amd64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages slim depends on:
ii  debconf [debconf-2.0]         1.5.28     Debian configuration management sy
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  libgcc1                       1:4.4.2-5  GCC support library
ii  libjpeg62                     6b-15      The Independent JPEG Group's JPEG 
ii  libpam0g                      1.1.0-4    Pluggable Authentication Modules l
ii  libpng12-0                    1.2.41-1   PNG library - runtime
ii  libstdc++6                    4.4.2-5    The GNU Standard C++ Library v3
ii  libx11-6                      2:1.3.2-1  X11 client-side library
ii  libxft2                       2.1.14-1   FreeType-based font drawing librar
ii  libxmu6                       2:1.0.5-1  X11 miscellaneous utility library

Versions of packages slim recommends:
ii  xterm                         251-1      X terminal emulator

Versions of packages slim suggests:
pn  scrot                         <none>     (no description available)
*** slim-1.3.1.orig/cfg.cpp	2008-09-26 02:54:15.000000000 +0200
--- slim-1.3.1/cfg.cpp	2009-12-22 06:07:01.000000000 +0100
***************
*** 149,154 ****
--- 149,156 ----
              }
          }
          cfgfile.close();
+ 	
+ 	readCustomConfig();
  
          fillSessionList();
  
***************
*** 159,164 ****
--- 161,186 ----
      }
  }
  
+ void Cfg::readCustomConfig()
+ {
+ 	ifstream cfgfileCustom(CFGFILECUSTOM);
+ 	string line;
+ 	string op;
+ 	int n;
+ 	if (cfgfileCustom) {
+ 		while ( ! cfgfileCustom.eof() ) {
+ 			getline (cfgfileCustom, line); 
+ 			int i = line.find_first_of(" ");
+ 			op = line.substr(0, i);
+			// check if op actually exists
+ 			if ( options.find(op) != options.end() )
+				options[op] = parseOption(line, op);
+ 		}
+ 	}
+ 
+ 	cfgfileCustom.close();
+ }
+ 
  /* Returns the option value, trimmed */
  string Cfg::parseOption(string line, string option ) {
      return Trim( line.substr(option.size(), line.size() - option.size()));
*** slim-1.3.1.orig/cfg.h	2008-09-26 02:54:15.000000000 +0200
--- slim-1.3.1/cfg.h	2009-12-22 06:06:40.000000000 +0100
***************
*** 19,24 ****
--- 19,25 ----
  #define INPUT_MAXLENGTH_PASSWD  50
  
  #define CFGFILE SYSCONFDIR"/slim.conf"
+ #define CFGFILECUSTOM SYSCONFDIR"/slim.d/slim_custom.conf"
  #define THEMESDIR PKGDATADIR"/themes"
  #define THEMESFILE "/slim.theme"
  
***************
*** 49,54 ****
--- 50,57 ----
      std::vector<std::string> sessions;
      int currentSession;
      std::string error;
+     
+     void readCustomConfig();
  
  };

Reply via email to