vfmg: VFMG/e17-desktop_out.pm (NEW) - backend for new e17, using d...

sparky sparky at pld-linux.org
Sat Dec 2 03:54:24 CET 2006


Author: sparky                       Date: Sat Dec  2 02:54:24 2006 GMT
Module: vfmg                          Tag: HEAD
---- Log message:
- backend for new e17, using desktop-like files

---- Files affected:
vfmg/VFMG:
   e17-desktop_out.pm (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: vfmg/VFMG/e17-desktop_out.pm
diff -u /dev/null vfmg/VFMG/e17-desktop_out.pm:1.1
--- /dev/null	Sat Dec  2 03:54:24 2006
+++ vfmg/VFMG/e17-desktop_out.pm	Sat Dec  2 03:54:19 2006
@@ -0,0 +1,115 @@
+package VFMG::Output;
+
+use strict;
+use warnings;
+use File::Path qw(mkpath);
+
+sub decode_tags() {
+	return qw(GenericName Comment);
+}
+
+sub destdir() {
+	return "$ENV{'HOME'}/.e/e/applications/menu/all";
+}
+
+sub icons_dir() {
+	return "$ENV{'HOME'}/.e/e/applications/all";
+}
+
+=example e17 desktop
+[Desktop Entry]
+Encoding=UTF-8
+Name=<name>
+GenericName=<generic>
+Comment=<comment>
+Exec=<exec>
+StartupWMClass=<class>
+X-Enlightenment-WindowName=
+X-Enlightenment-WindowTitle=
+X-Enlightenment-WindowRole=
+Icon=<icon>
+StartupNotify=true
+Type=Application
+=cut
+
+my %DR;
+
+sub e17($$$);
+sub e17($$$) {
+	my ($no, $dir, $tab) = @_;
+	my $dirs = "";
+	my $apps = "";
+	foreach my $entry (sort main::cmpdname keys %{$main::menu[$no]}) {
+		my $icon_exists = 0;
+		my $d = $main::desktop[$entry];
+		my $icon = "";
+		$icon = main::scale_icon($$d{Icon}) if $main::opt{icons};
+
+		my $common_desk = "[Desktop Entry]\n" .
+				"Encoding=UTF-8\n" .
+				"Name=$$d{Name}\n";
+		$common_desk .= "Comment=$$d{Comment}\n" if exists $$d{Comment};
+		$common_desk .= "Icon=$icon\n" if length $icon;
+
+		if ($main::menu[$no]{$entry} < 0) {
+			open F_OUT, ">", "$main::opt{destdir}/../../all/$$d{file}.desktop"
+				or die "Can't create .desktop $main::opt{destdir}/../../all/$$d{file}.desktop file: $!\n";
+			print F_OUT $common_desk;
+			print F_OUT "GenericName=$$d{GenericName}\n"
+				if exists $$d{GenericName};
+			print F_OUT "StartupNotify=true\n" if exists $$d{StartupNotify}
+				and $$d{StartupNotify} =~ /^(1|true)$/;
+			print F_OUT "Exec=$$d{Exec}\n",
+				"Type=Application\n";
+			close F_OUT;
+
+			$apps .= "$$d{file}.desktop\n";
+		} else {
+			my $subdir = sprintf "$dir/$$d{file}";
+			mkpath($subdir,0,0700);
+			open F_OUT, "> $subdir/.directory";
+			print F_OUT $common_desk;
+			print F_OUT "Type=Directory\n";
+			close F_OUT;
+
+			e17($main::menu[$no]{$entry},$subdir,"$tab\t");
+			$dirs .= "$$d{file}\n";
+		}
+	}
+	open F_OUT, ">> $dir/.order" or warn "$dir/.order: $!\n";
+	print F_OUT $dirs;
+	print F_OUT $apps;
+	close F_OUT;	
+}
+
+sub do_menu() {
+=to implement later
+	$main::opt{wcnt_file} = "" unless defined $main::opt{wcnt_file};
+	$DR{wcnt} = {};
+	foreach my $wcnt_file (split /\s*;\s*/, $main::opt{wcnt_file}) {
+		unless (open F_IN, $wcnt_file) {
+			warn "Can't open WCNT file '$wcnt_file': $!\n";
+			next;
+		}
+		while ( <F_IN> ) {
+			next if /^\s*#/;
+			next unless s/^\s*(\S+)//;
+			my $name = $1;
+			$DR{wcnt}{$name} = [undef, undef, undef];
+			foreach my $num (0..3) {
+				last unless s/^\s*"(([^"]|\")*?[^\\])"// or s/^\s*(\S+)//;
+				$DR{wcnt}{$name}[$num] = $1 unless $1 eq "*";
+			}
+			warn "Omitted: $_\n" if length($_) and $main::o_verbose;
+		}
+		close F_IN;
+	}
+	$DR{wcnt} = undef unless %{$DR{wcnt}};
+=cut
+	
+	e17($main::opt{strip}, $main::opt{destdir}, "");
+}
+
+1;
+
+# vi: ts=4 sw=4
================================================================


More information about the pld-cvs-commit mailing list