Author: sparky                       Date: Tue Apr 18 15:23:10 2006 GMT
Module: vfmg                          Tag: DEVEL
---- Log message:
- DR17 speedup, now if it has nothing to regenerate is takes only 1.5s

---- Files affected:
vfmg:
   vfmg (1.73.2.57 -> 1.73.2.58) 

---- Diffs:

================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.57 vfmg/vfmg:1.73.2.58
--- vfmg/vfmg:1.73.2.57 Sat Jan 28 16:39:51 2006
+++ vfmg/vfmg   Tue Apr 18 17:23:05 2006
@@ -910,23 +910,79 @@
        my $apps = "";
        my @edje = qw(edje_cc -id . -fd . icon.edc);
        foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
+               my $icon_exists = 0;
                my $d = $desktop[$entry];
                my $name = $$d{Name};
                print $tab.$name.".." if $o_verbose;
-               
-               unlink $$dr{icon};
                my $icon = $$d{Icon};
-               if ( not -r $icon and defined $$dr{text_icon} ) {
-                       ( my $exe = $$dr{text_icon} ) =~ s/%1/"$name"/;
-                       system($exe);
-               } else {
-                       $icon = $$dr{tmp}."/blank.xpm" unless -r $icon;
-                       scale_icon($icon);
+
+               if ( defined $dr->{existing}->{$$d{file}} ) {
+                       my $e = $dr->{existing}->{$$d{file}};
+                       if ( 
+                               (
+                                       (not defined $$e{Name} and not defined 
$$d{Name}) 
+                                               or ($$e{Name} eq $$d{Name})
+                               )
+                               and
+                               (
+                                       (not defined $$e{GenericName} and not 
defined $$d{GenericName})
+                                               or ($$e{GenericName} eq 
$$d{GenericName})
+                               )
+                               and
+                               (
+                                       (not defined $$e{Comment} and not 
defined $$d{Comment})
+                                               or ($$e{Comment} eq 
$$d{Comment})
+                               )
+                               and
+                               (
+                                       (not defined $$e{Exec} and not defined 
$$d{Exec})
+                                               or ($$e{Exec} eq $$d{Exec} )
+                               )
+                       )
+                       {
+                               if ( -r $icon ) {
+                                       (my $md5 = `md5sum $icon`) =~ 
s/\s+.*//s;
+                                       $icon_exists = 1 if ( $md5 eq 
$$e{IconMD5} );
+                               } else {
+                                       $icon_exists = 1 unless defined 
$$e{IconMD5};
+                               }
+                       }
+               }
+               
+               unless ( $icon_exists ) {
+                       delete $dr->{existing}->{$$d{file}}
+                               if exists $dr->{existing}->{$$d{file}};
+                       my $md5;
+                       if ( -r $icon ) {
+                               ($md5 = `md5sum $icon`) =~ s/\s+.*//s;
+                       }
+                       my $e = {
+                               Name    => $$d{Name},
+                               GenericName     => $$d{GenericName},
+                               Comment => $$d{Comment},
+                               Exec    => $$d{Exec},
+                               IconMD5 => $md5
+                       };
+                       $dr->{existing}->{$$d{file}} = $e;
+                       
+                       unlink $$dr{icon};
+                       if ( not -r $icon and defined $$dr{text_icon} ) {
+                               ( my $exe = $$dr{text_icon} ) =~ s/%1/"$name"/;
+                               system($exe);
+                       } else {
+                               $icon = $$dr{tmp}."/blank.xpm" unless -r $icon;
+                               scale_icon($icon);
+                       }
+                       die "No icon $$dr{icon}\n" unless -r $$dr{icon};
+                       print ".." if $o_verbose;
                }
-               die "No icon $$dr{icon}\n" unless -r $$dr{icon};
-               print ".." if $o_verbose;
                
                if($menu[$no]{$entry} < 0) {
+                       if ( $icon_exists ) {
+                               $apps .= $$d{file} . ".eap\n";
+                               print "..EXISTS\n" if $o_verbose;
+                               next;
+                       }
                        my $file = "$opt{icons_dir}/$$d{file}.eap";
 
                        system(@edje,$file);
@@ -974,10 +1030,12 @@
                        my $file = $subdir . "/.directory.eap";
                        mkpath($subdir,0,0700);
                        print ".." if $o_verbose;
-                       system(@edje, $file);
-                       print ".." if $o_verbose;
-                       system("enlightenment_eapp",$file,
-                               "-set-name",$name);
+                       unless ( $icon_exists ) {
+                               system(@edje, $file);
+                               print ".." if $o_verbose;
+                               system("enlightenment_eapp",$file,
+                                       "-set-name",$name);
+                       }
                        
                        print "..DONE\n" if $o_verbose;
                        DR17($menu[$no]{$entry},$subdir,$tab.step,$dr);
@@ -1475,10 +1533,35 @@
                $DR{text_icon} =~ s|\%out|$DR{icon}|g;
        }
 
+       $DR{existing} = {};
+       if (open F_IN, "$opt{icons_dir}/.existing") {
+               my $icon = "broken?";
+               while (my $line = <F_IN>) {
+                       if ( $line =~ /^\[(.*)\]$/ ) {
+                               $icon = $1;
+                               $DR{existing}->{$icon} = {};
+                       } elsif ( $line =~ /^(\S+?):\t(.*)$/ ) {
+                               $DR{existing}->{$icon}->{$1} = $2;
+                       }
+               }
+               close F_IN;
+       }
+
        DR17($opt{strip},$opt{destdir},"",\%DR);
        unlink "blank.xpm";
        unlink "icon.edc";
        unlink $DR{icon};
+
+       open F_OUT, "> $opt{icons_dir}/.existing";
+       foreach my $icon ( keys %{$DR{existing}} ) {
+               print F_OUT "[$icon]\n";
+               foreach my $entry ( keys %{$DR{existing}->{$icon}} ) {
+                       print F_OUT "$entry:    
$DR{existing}->{$icon}->{$entry}\n"
+                               if defined $DR{existing}->{$icon}->{$entry};
+               }
+       }
+       close F_OUT;
+       
        exit;
 } # }}}
 elsif($o_output eq "aewm") {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.57&r2=1.73.2.58&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to