From d7607133e13621661a55efb65d6d20b02901ff40 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 26 Mar 2017 09:15:31 +0200 Subject: Use system-provided Oxygen icons instead of shipping them with the module --- Build.PL | 1 + lib/App/Dthumb.pm | 17 +++++++++++++++++ share/folder-blue.png | Bin 3233 -> 0 bytes share/unknown.png | Bin 6873 -> 0 bytes 4 files changed, 18 insertions(+) delete mode 100644 share/folder-blue.png delete mode 100644 share/unknown.png diff --git a/Build.PL b/Build.PL index 2844668..cc0a9e5 100644 --- a/Build.PL +++ b/Build.PL @@ -23,6 +23,7 @@ my $build = Module::Build->new( 'autodie' => 0, 'Cwd' => 0, 'Data::Section' => 0, + 'File::Copy' => 0, 'Getopt::Long' => 0, 'Image::Imlib2' => 0, 'IO::Handle' => 0, diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index a478c7d..0223016 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -6,6 +6,7 @@ use 5.010; use App::Dthumb::Data; use Cwd; +use File::Copy qw(copy); use File::Slurp qw(read_dir write_file); use Image::Imlib2; @@ -30,6 +31,8 @@ sub new { $conf{names} //= ( $conf{'no-names'} ? 0 : 1 ); + $conf{oxygen_base} //= '/usr/share/icons/oxygen/base'; + $ref->{config} = \%conf; $ref->{data} = App::Dthumb::Data->new(); @@ -90,6 +93,14 @@ sub create_files { my $thumbdir = $self->{config}->{dir_thumbs}; my $datadir = $self->{config}->{dir_data}; my @files = $self->{data}->list_archived; + my @icons; + + if ( $self->{config}{all} ) { + push( @icons, 'mimetypes/unknown.png' ); + } + if ( $self->{config}{recursive} ) { + push( @icons, 'places/folder-blue.png' ); + } for my $dir ( $thumbdir, $datadir, "${datadir}/css", "${datadir}/js" ) { if ( not -d $dir ) { @@ -101,6 +112,12 @@ sub create_files { write_file( "${datadir}/${file}", $self->{data}->get($file) ); } + for my $icon (@icons) { + my ( $dir, $file ) = split( qr{/}, $icon ); + my $base = $self->{config}{oxygen_base}; + copy( "${base}/128x128/${dir}/${file}", "${datadir}/${file}" ); + } + return; } diff --git a/share/folder-blue.png b/share/folder-blue.png deleted file mode 100644 index b083196..0000000 Binary files a/share/folder-blue.png and /dev/null differ diff --git a/share/unknown.png b/share/unknown.png deleted file mode 100644 index 50a2969..0000000 Binary files a/share/unknown.png and /dev/null differ -- cgit v1.2.3