[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kdm
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2007-11-14 20:15:14
Message-ID: 1195071314.311367.20098.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 736775 by ossi:

support relocation of SessionsDirs into new prefix.
also, make the default config already contain a shadow dir.


 M  +6 -3      config.def  
 M  +63 -0     kfrontend/genkdmconf.c  


--- trunk/KDE/kdebase/workspace/kdm/config.def #736774:736775
@@ -1932,14 +1932,17 @@
 
 Key: SessionsDirs
 Type: list
-Default: KDMDATA "/sessions"
+Default: *KDMDATA "/sessions"
 User: core
 User: greeter-c
-Instance: #*/"/etc/X11/sessions,/usr/share/xsessions"
+Instance: */KDMCONF "/sessions," KDMDATA "/sessions"
+Update: upd_sessionsdirs
 Comment:
- The directories containing session type definitions in .desktop format.
+ The directories containing session type definitions in .desktop format,
+ ordered by falling priority.
 Description:
  A list of directories containing session type definitions.
+ Ordered by falling priority.
 # See <xref linkend="kdmrc-sessions"> for details.
 
 Key: ClientLogFile
--- trunk/KDE/kdebase/workspace/kdm/kfrontend/genkdmconf.c #736774:736775
@@ -827,6 +827,40 @@
 	ASPrintf( (char **)&(*sp)->str, "%s", s );
 }
 
+static StrList *
+splitList( const char *str )
+{
+	StrList *sp = 0, **spp = &sp;
+	const char *e;
+	if (!*str)
+		return 0;
+	for (;;) {
+		*spp = mcalloc( sizeof(**spp) );
+		if (!(e = strchr( str, ',' )))
+			break;
+		ASPrintf( (char **)&(*spp)->str, "%.*s", (int)(e - str), str );
+		str = e + 1;
+		spp = &(*spp)->next;
+	}
+	(*spp)->str = mstrdup( str );
+	return sp;
+}
+
+static char *
+joinList( StrList *sp )
+{
+	char *s = 0;
+	if (!sp)
+		return mstrdup( "" );
+	s = mstrdup( sp->str );
+	for (;;) {
+		sp = sp->next;
+		if (!sp)
+			return s;
+		strCat( &s, ",%s", sp->str );
+	}
+}
+
 StrMap *cfmap;
 StrList *aflist, *uflist, *eflist, *cflist, *lflist;
 
@@ -1978,6 +2012,35 @@
 }
 
 static void
+upd_sessionsdirs( Entry *ce, Section *cs ATTR_UNUSED )
+{
+	StrList *sl, *sp;
+	int olen;
+	char olddir[PATH_MAX];
+
+	if (ce->written) {
+		sprintf( olddir, "%s/share/apps/kdm/sessions", oldkdepfx );
+		olen = strlen( oldkde );
+		sl = splitList( ce->value );
+		for (sp = sl; sp; sp = sp->next) {
+			if (!strcmp( sp->str, olddir ))
+				sp->str = def_SessionsDirs;
+			else if (!memcmp( sp->str, oldkde, olen ) &&
+			         !memcmp( sp->str + olen, "/kdm/", 5 ))
+			{
+				char newdir[PATH_MAX];
+				sprintf( newdir, KDMCONF "%s", sp->str + olen + 4 );
+				mkdirp( newdir, 0755, "sessions", 0 );
+				copyDir( sp->str, newdir );
+				sp->str = newdir;
+			}
+		}
+		ce->value = joinList( sl );
+	} else
+		mkdirp( KDMCONF "/sessions", 0755, "sessions", 0 );
+}
+
+static void
 upd_preloader( Entry *ce, Section *cs ATTR_UNUSED )
 {
 	if (ce->written) { /* implies oldkde != 0 */
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic