diff options
author | Oliver Tappe | 2008-06-03 01:52:06 +0200 |
---|---|---|
committer | Oliver Tappe | 2008-06-03 01:52:06 +0200 |
commit | 26f2a2855f43cf5d8516b110149247af7b1b3fb7 (patch) | |
tree | 2a4ef4bb54d6967e4720d16c00b63566d89775ef /os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm | |
parent | Implemented a better algorithm for keeping the plugins and the references (diff) | |
download | core-26f2a2855f43cf5d8516b110149247af7b1b3fb7.tar.gz core-26f2a2855f43cf5d8516b110149247af7b1b3fb7.tar.xz core-26f2a2855f43cf5d8516b110149247af7b1b3fb7.zip |
* reorganized the themes-folders of the desktop-plugin as discussed with Michael
recently: now it's kdm/<theme> and gdm/<theme> instead of <theme>/kdm and
<theme>/gdm, as that makes handling of GDM less cumbersome
* renamed actual theme description files to theme.xml instead of being
named like the theme (in this case: openslx.xml)
Tested with GDM and KDM on SUSE-10.2
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1838 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm')
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm index 9a251a86..5c146016 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -33,8 +33,12 @@ sub new name => 'desktop', }; - my $localThemesDir = "$openslxConfig{'config-path'}/plugins/desktop/themes"; - mkpath($localThemesDir) unless -e $localThemesDir; + my $localGDMThemesDir + = "$openslxConfig{'config-path'}/plugins/desktop/themes/gdm"; + mkpath($localGDMThemesDir) unless -e $localGDMThemesDir; + my $localKDMThemesDir + = "$openslxConfig{'config-path'}/plugins/desktop/themes/kdm"; + mkpath($localKDMThemesDir) unless -e $localKDMThemesDir; return bless $self, $class; } @@ -432,6 +436,8 @@ sub _fillUnsetStage1Attrs } if (!defined $self->{'supported_themes'}) { $self->{'supported_themes'} = join ",", $self->_getAvailableThemes(); + $self->{attrs}->{'desktop::supported_themes'} + = $self->{'supported_themes'}; } return 1; @@ -608,15 +614,21 @@ sub _setupSupportedThemes for my $theme (@supportedThemes) { THEME_DIR: foreach my $themeBaseDir (@themeBaseDirs) { - my $themeDir = "$themeBaseDir/$theme"; - next THEME_DIR if !-d $themeDir; + my $gdmThemeDir = "$themeBaseDir/gdm/$theme"; + my $kdmThemeDir = "$themeBaseDir/kdm/$theme"; + next THEME_DIR if !-d $gdmThemeDir && !-d $kdmThemeDir; + # any of both dirs is enough # copy theme into plugin-repo folder - my $themeTargetPath = "$self->{pluginRepositoryPath}/themes"; - mkpath($themeTargetPath); vlog(1, "installing theme '$theme'..."); - slxsystem("cp -a $themeDir $themeTargetPath/$theme") == 0 - or die _tr('unable to copy theme %s (%s)', $theme, $!); + my $gdmThemeTargetPath = "$self->{pluginRepositoryPath}/themes/gdm"; + mkpath($gdmThemeTargetPath); + slxsystem("cp -a $gdmThemeDir $gdmThemeTargetPath/$theme") == 0 + or die _tr('unable to copy GDM-theme %s (%s)', $theme, $!); + my $kdmThemeTargetPath = "$self->{pluginRepositoryPath}/themes/kdm"; + mkpath($kdmThemeTargetPath); + slxsystem("cp -a $kdmThemeDir $kdmThemeTargetPath/$theme") == 0 + or die _tr('unable to copy KDM-theme %s (%s)', $theme, $!); next THEME; } warn _tr('theme "%s" not found - skipped!', $theme); @@ -629,7 +641,7 @@ sub _getAvailableThemes { my $self = shift; - my @availableThemes; + my %availableThemes; # return all themes found in any of these two folders my @themeBaseDirs = ( @@ -637,13 +649,17 @@ sub _getAvailableThemes "$self->{openslxBasePath}/lib/plugins/desktop/themes", ); for my $themeBaseDir (@themeBaseDirs) { - push @availableThemes, - map { basename $_ } grep { -d $_ } glob("$themeBaseDir/*"); + my @foundGDMThemes + = map { basename $_ } grep { -d $_ } glob("$themeBaseDir/gdm/*"); + @availableThemes{@foundGDMThemes} = (); + my @foundKDMThemes + = map { basename $_ } grep { -d $_ } glob("$themeBaseDir/kdm/*"); + @availableThemes{@foundKDMThemes} = (); } - vlog(1, _tr("available themes: %s", join ",", @availableThemes)); + vlog(1, _tr("available themes: %s", join ",", keys %availableThemes)); - return @availableThemes; + return keys %availableThemes; } 1; |