Re: Adding sub-menus to GNOME 2.x
- From: Jens Askengren <jensus linux nu>
- To: gnome devel <gnome-devel-list gnome org>
- Subject: Re: Adding sub-menus to GNOME 2.x
- Date: 05 Dec 2002 02:04:16 +0100
ons 2002-12-04 klockan 16.18 skrev Steve Fox:
> Apparently editing /etc/gnome-vfs-2.0/vfolders/preferences.vfolder-info
> is the only way to do this? Is there a reasonable way to add entries to
> this with a command and parameters or does one need to say write a Perl
> script to parse the XML?
Why parse?
Just style it! ;)
The attached stylesheets probably does what you want.
They are allmost untested, but does work on my box.
Improvements are welcome of course!
- Jens
<?xml version="1.0" encoding="utf-8"?>
<!--
vfolder-create-folder.xsl
Jens Askengren <jensus linux nu>
Add a folder to the gnome2 menu
Parameters:
===========
folder-name
Create a new folder with this name
after
Insert the new folder after an existing folder with a matching
Parent or ParentLink. Note: Parent is used to identify
folders, since the names are internationalized.
Example:
========
xsltproc -stringparam folder-name 'My stuff' \
-stringparam after 'applications-all-users:///Multimedia' \
vfolder-create-folder.xsl \
~/.gnome2/vfolders/applications.vfolder-info
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="xml" indent="yes"/>
<xsl:variable name="folder-name">New folder</xsl:variable>
<xsl:variable name="after">apa</xsl:variable>
<xsl:template match="/VFolderInfo">
<VFolderInfo>
<xsl:copy-of select="WriteDir"/>
<xsl:apply-templates select="Folder"/>
</VFolderInfo>
</xsl:template>
<xsl:template match="Folder">
<Folder>
<xsl:apply-templates/>
</Folder>
<xsl:if test="(ParentLink = $after) or (Parent = $after)">
<Folder>
<Name><xsl:value-of select="$folder-name"/></Name>
</Folder>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!--
vfolder-add-launcher.xsl
Jens Askengren <jensus linux nu>
Add a launcher to a folder in the gnome2 menu
Parameters:
===========
launcher
Path to the launcher
parent
Insert the launcher in a folder with a matching
Parent or ParentLink. Note: Parent is used to identify
folders, since the names are internationalized.
folder
Insert the launcher in a folder with a matching Name.
Use the parameter "parent" instead if possible.
Example:
========
xsltproc -stringparam launcher '/home/user/.gnome2/vfolders/applications/App.desktop' \
-stringparam parent 'applications-all-users:///Multimedia' \
vfolder-add-launcher.xsl \
~/.gnome2/vfolders/applications.vfolder-info
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="xml" indent="yes"/>
<xsl:variable name="launcher">none</xsl:variable>
<xsl:variable name="parent">apa</xsl:variable>
<xsl:variable name="folder">apa</xsl:variable>
<xsl:template match="/VFolderInfo">
<VFolderInfo>
<xsl:copy-of select="WriteDir"/>
<xsl:apply-templates select="Folder"/>
</VFolderInfo>
</xsl:template>
<xsl:template match="Folder">
<Folder>
<xsl:apply-templates/>
<xsl:if test="(ParentLink = $parent) or (Parent = $parent) or (Name = $folder)">
<Include><xsl:value-of select="$launcher"/></Include>
</xsl:if>
</Folder>
</xsl:template>
<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]