[MPlayer-dev-eng] [PATCH] [RFC] rename default skin directory

Diego Biurrun diego at biurrun.de
Sat Mar 4 13:15:52 CET 2006


Hey,

I've always disliked the fact that gmplayer looks in subdirectories
named 'Skin' for skins.  Capitalized names feel very non-Unixish to me
and it's a bit misleading as well, since the directory can contain
multiple skins and not just one.

So the attached patch changes this behavior in a backwards-compatible
fashion.  It's not very elegant, but tested to work.

Comments, thoughts?

Diego
-------------- next part --------------
--- Gui/app.c	8 Dec 2005 22:12:56 -0000	1.25
+++ Gui/app.c	4 Mar 2006 12:09:46 -0000
@@ -75,7 +75,9 @@
 listItems   appMPlayer;
 
 char      * skinDirInHome=NULL;
+char      * skinDirInHome_obsolete=NULL;
 char      * skinMPlayerDir=NULL;
+char      * skinMPlayerDir_obsolete=NULL;
 char      * skinName = NULL;
 
 void appClearItem( wItem * item )
--- Gui/app.h	25 Jan 2005 12:44:37 -0000	1.19
+++ Gui/app.h	4 Mar 2006 12:09:46 -0000
@@ -171,7 +171,9 @@
 extern listItems   appMPlayer;
 
 extern char      * skinDirInHome;
+extern char      * skinDirInHome_obsolete;
 extern char      * skinMPlayerDir;
+extern char      * skinMPlayerDir_obsolete;
 extern char      * skinName;
 
 extern void appInitStruct( listItems * item );
--- Gui/interface.c	8 Dec 2005 22:12:56 -0000	1.107
+++ Gui/interface.c	4 Mar 2006 12:09:46 -0000
@@ -215,10 +215,14 @@
 // --- initialize X 
  wsXInit( (void *)mDisplay );
 // --- load skin
- skinDirInHome=get_path("Skin");
- skinMPlayerDir=MPLAYER_DATADIR "/Skin";
+ skinDirInHome=get_path("skins") ;
+ skinDirInHome_obsolete=get_path("Skin") ;
+ skinMPlayerDir=MPLAYER_DATADIR "/skins";
+ skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin";
  mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome);
+ mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete);
  mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir);
+ mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete);
  if ( !skinName ) skinName=strdup( "default" );
  i = skinRead( skinName );
  if ((i == -1) && strcmp(skinName,"default"))
--- Gui/mplayer/widgets.c	8 Dec 2005 22:12:56 -0000	1.47
+++ Gui/mplayer/widgets.c	4 Mar 2006 12:09:46 -0000
@@ -168,7 +168,10 @@
    case evSkinBrowser:
 	ShowSkinBrowser();
 //        gtkClearList( SkinList );
-        if ( gtkFillSkinList( sbMPlayerPrefixDir ) && gtkFillSkinList( sbMPlayerDirInHome ) )
+        if ( gtkFillSkinList( sbMPlayerPrefixDir ) && \
+             gtkFillSkinList( sbMPlayerPrefixDir_obsolete ) && \
+             gtkFillSkinList( sbMPlayerDirInHome ) && \
+             gtkFillSkinList( sbMPlayerDirInHome_obsolete )  )
          {
           gtkSetDefaultToCList( SkinList,param );
 	  gtk_clist_sort( GTK_CLIST( SkinList ) );
--- Gui/mplayer/gtk/sb.c	8 Dec 2005 22:12:56 -0000	1.18
+++ Gui/mplayer/gtk/sb.c	4 Mar 2006 12:09:46 -0000
@@ -19,7 +19,9 @@
 GtkWidget * SkinList = NULL;
 char      * sbSelectedSkin=NULL;
 char      * sbMPlayerDirInHome=NULL;
+char      * sbMPlayerDirInHome_obsolete=NULL;
 char      * sbMPlayerPrefixDir=NULL;
+char      * sbMPlayerPrefixDir_obsolete=NULL;
 
 char * gtkOldSkin;
 static char * prev;
@@ -173,8 +175,12 @@
  gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 );
  gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 );
 
+ if ( ( sbMPlayerDirInHome_obsolete=(char *)calloc( 1,strlen( skinDirInHome_obsolete ) + 4 ) ) != NULL )
+  { strcpy( sbMPlayerDirInHome_obsolete,skinDirInHome_obsolete ); strcat( sbMPlayerDirInHome_obsolete,"/*" ); }
  if ( ( sbMPlayerDirInHome=(char *)calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL )
   { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); }
+ if ( ( sbMPlayerPrefixDir_obsolete=(char *)calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL )
+  { strcpy( sbMPlayerPrefixDir_obsolete,skinMPlayerDir ); strcat( sbMPlayerPrefixDir_obsolete,"/*" ); }
  if ( ( sbMPlayerPrefixDir=(char *)calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL )
   { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); }
 
--- Gui/mplayer/gtk/sb.h	20 May 2002 13:56:16 -0000	1.9
+++ Gui/mplayer/gtk/sb.h	4 Mar 2006 12:09:46 -0000
@@ -6,7 +6,9 @@
 extern GtkWidget * SkinList;
 extern char      * sbSelectedSkin;
 extern char      * sbMPlayerDirInHome;
+extern char      * sbMPlayerDirInHome_obsolete;
 extern char      * sbMPlayerPrefixDir;
+extern char      * sbMPlayerPrefixDir_obsolete;
 extern GtkWidget * SkinBrowser;
 
 extern void ShowSkinBrowser( void );
--- Gui/skin/skin.c	8 Dec 2005 22:12:57 -0000	1.29
+++ Gui/skin/skin.c	4 Mar 2006 12:09:46 -0000
@@ -676,8 +676,16 @@
    setname( skinMPlayerDir,dname );
    if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
     {
-     mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
-     return -1;
+     setname( skinDirInHome_obsolete,dname );
+     if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
+      {
+       setname( skinMPlayerDir_obsolete,dname );
+       if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
+        {
+         mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
+         return -1;
+        }
+      }
     }
   }
 


More information about the MPlayer-dev-eng mailing list