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

List:       kde-core-devel
Subject:    Systemsettings
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2008-04-16 16:00:08
Message-ID: 200804161800.08739.mail () dipe ! org
[Download RAW message or body]

1. attached is a patch that extends ksplashx to read the description.txt also 
from within local appdata what is needed if themes are installed by the user 
else they are just not found. The patch works fine here but I am not sure 
there re the usage of $KDE_HOME :-/

2. Systemsettings=>Theme Manager still seems to be broken in a way that makes 
it at it's current stage imho somewhat useless (e.g. colors and backgrounds 
are not working at all and we still have KDE3 themes in there that point to 
themes like Plastik or Keramik that don't got ported (yet)). So, disable it 
for 4.1?

["ksplashx.patch" (text/x-diff)]

Index: splash.cpp
===================================================================
--- splash.cpp	(revision 796273)
+++ splash.cpp	(working copy)
@@ -123,6 +123,7 @@
 static QRect geometry;
 static bool scale_on = true;
 static Atom kde_splash_progress;
+static char kdehome[ 1024 ];
 static char theme_name[ 1024 ];
 static char theme_dir[ 1024 ];
 static bool test;
@@ -192,11 +193,6 @@
     if( access( tmp, R_OK ) != 0 )
         {
         // ksplash/<theme>-<resolution>-<file> in 'kde-config --path cache'
-        static char kdehome[ 1024 ];
-        if( getenv( "KDEHOME" ) && getenv( "KDEHOME" )[ 0 ] )
-            snprintf( kdehome, 1024, "%s", getenv( "KDEHOME" ));
-        else
-            snprintf( kdehome, 1024, "%s/.kde", getenv( "HOME" ) ? getenv( "HOME" ) : "" );
         static char hostname[ 1024 ];
         if( getenv("XAUTHLOCALHOSTNAME"))
             strncpy( hostname, getenv("XAUTHLOCALHOSTNAME"), 1023 );
@@ -796,8 +792,18 @@
 void runSplash( const char* them, bool t, int p )
     {
     geometry = screenGeometry();
+
+    // fetch the $KDEHOME environment variable that may point to e.g. "~/.kde4"
+    if( getenv( "KDEHOME" ) && getenv( "KDEHOME" )[ 0 ] )
+        snprintf( kdehome, 1024, "%s", getenv( "KDEHOME" ));
+    else
+        snprintf( kdehome, 1024, "%s/.kde", getenv( "HOME" ) ? getenv( "HOME" ) : "" );
+
+    // fetch the name of the theme which is also used as directory name.
     snprintf( theme_name, 1024, "%s", them );
+    // fetch the theme-directory,e.g. "/opt/kde4/share/apps/ksplash/Themes/MyKSplashXThemeName"
     snprintf( theme_dir, 1024, "%s/ksplash/Themes/%s", KDE_DATADIR, them );
+
     test = t;
     parent_pipe = p;
     anim_count = 0;
@@ -807,9 +813,25 @@
     splash_pixmap = None;
     final_time = time( NULL ) + 60;
     int desc_w, desc_h;
+
+    // try to load the themes description.txt file from within the theme_dir
     FILE* datafile = fopen( findFile( "description.txt", &desc_w, &desc_h ), "r" );
+    if( datafile == NULL )
+        {
+            // if we failed to read it, try it with $KDEHOME as theme_dir. This
+            // is needed to be able to load local (aka by the user in his local
+            // home-directory) installed themes.
+            snprintf( theme_dir, 1024, "%s/share/apps/ksplash/Themes/%s", kdehome, them );
+            datafile = fopen( findFile( "description.txt", &desc_w, &desc_h ), "r" );
+            if( datafile == NULL )
+                {
+                fprintf( stderr, "Cannot find description.txt file.\n" );
+                exit( 2 );
+                }
+        }
+
     struct stat stat_buf;
-    if( datafile == NULL || fstat( fileno( datafile ), &stat_buf ) != 0 )
+    if( fstat( fileno( datafile ), &stat_buf ) != 0 )
         {
         fprintf( stderr, "Cannot read description.txt file.\n" );
         exit( 2 );


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

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