vfmg (DEVEL): vfmg - added --only-in option, for throwing apps wit...

sparky sparky at pld-linux.org
Thu Dec 8 03:01:03 CET 2005


Author: sparky                       Date: Thu Dec  8 02:01:02 2005 GMT
Module: vfmg                          Tag: DEVEL
---- Log message:
- added --only-in option, for throwing apps with OnlyShowIn=GNOME/KDE

---- Files affected:
vfmg:
   vfmg (1.73.2.42 -> 1.73.2.43) 

---- Diffs:

================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.42 vfmg/vfmg:1.73.2.43
--- vfmg/vfmg:1.73.2.42	Wed Dec  7 02:20:03 2005
+++ vfmg/vfmg	Thu Dec  8 03:00:57 2005
@@ -29,6 +29,7 @@
 	promote		=> 0,
 	strip		=> 0,
 	nomenu		=> 0,
+	only_in		=> "",
 	xterm		=> "xterm -name xterm-%1 -e %2",
 	convert		=> "convert -geometry 16x16 \%in \%out",
 	full_regen	=> 0,
@@ -74,12 +75,14 @@
 	'icons-dir|d=s'	=>	\$opt{icons_dir},
 	'icons-ext|T=s'	=>	\$opt{icons_ext},
 	'text-icon=s'	=>	\$opt{text_icon},
+	
 	'wcnt-file=s'	=>	\$opt{wcnt_file},
 	'termapp-class=s'
 					=>	\$opt{termapp_class},
 	'termapp-name=s'
 					=>	\$opt{termapp_name},
 
+
 	'utf8|u!'		=>	\$opt{utf},
 	'encoding|E=s'	=>	\$opt{encoding},
 	
@@ -87,6 +90,8 @@
 	'promote|p!'	=>	\$opt{promote},
 	'strip|s!'		=>	\$opt{strip},
 	'nomenu|m!'		=>	\$opt{nomenu},
+	'only-in|o=s'
+					=>	\$opt{only_in},
 	'xterm|r=s'		=>	\$opt{xterm},
 	'convert|C=s'	=>	\$opt{convert},
 	'full-regen|f!'	=>	\$opt{full_regen},
@@ -126,6 +131,7 @@
     -s, --strip    - strip 1st level menu
     -m, --nomenu   - don't add additional menu info
                      (valid for blackbox, fluxbox, openbox, xfce4)
+    -o, --only-in  - coma separated list of accepted OnlyShowIn= WMs
 
     -r, --xterm=   - set x terminal application
                      default: "$defopt{xterm}"
@@ -212,6 +218,12 @@
 } else {
 	delete $opt{destdir};
 }
+my @OSI_accept;
+if ( defined $opt{only_in} ) {
+	foreach my $cat ( split /[,\s]+/, $opt{only_in} ) {
+		push @OSI_accept, $cat;
+	}
+}
 # header }}}
 
 # search dirs {{{
@@ -322,7 +334,8 @@
 			/^\s*
 			(Name(?:\[(?:$langs)\])?
 			 |GenericName(?:\[(?:$langs)\])?
-			 |Icon|Exec|Categories|Terminal|Type|Encoding|NoDisplay)
+			 |Icon|Exec|Categories|Terminal|Type|Encoding|NoDisplay
+			 |OnlyShowIn)
 			\s* = \s* (.+?)
 			\s*$/ox
 		  } <F_IN>,
@@ -331,6 +344,13 @@
 
 	return unless lc $tags{Type} eq 'application';
 	return if lc $tags{NoDisplay} eq 'true';
+	if ( defined $tags{OnlyShowIn} ) {
+		my $found = 0;
+		foreach my $cat ( split /;+/, $tags{OnlyShowIn} ) {
+			$found++ if grep {$cat eq $_} @OSI_accept;
+		}
+		return unless $found;
+	}
 	$tags{_name} =
 	  (sort findfirstlang grep /^Name/, keys %tags)[0];
 	$tags{name} = $tags{ $tags{_name} };
================================================================

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




More information about the pld-cvs-commit mailing list