r485 - in trunk: . scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 13 04:36:16 EST 2008


Author: icculus
Date: 2008-02-13 04:36:04 -0500 (Wed, 13 Feb 2008)
New Revision: 485

Modified:
   trunk/docs.txt
   trunk/scripts/config.lua
   trunk/scripts/mojosetup_init.lua
   trunk/scripts/mojosetup_mainline.lua
Log:
More menu item work.


Modified: trunk/docs.txt
===================================================================
--- trunk/docs.txt	2008-02-13 08:52:23 UTC (rev 484)
+++ trunk/docs.txt	2008-02-13 09:36:04 UTC (rev 485)
@@ -706,6 +706,83 @@
     non-nil permission, the filter takes precedence.
 
 
+ Setup.DesktopMenuItem:
+
+  This element specifies a menu item that will be installed in the system
+  desktop menu: this might be the "Applications" dropdown in the Gnome panel,
+  or the "Start" bar on Windows, for example. This can be a child of
+  Setup.Option (in which case it is only considered for installation if the
+  option itself is too), or Setup.Package (in which case it is always
+  considered for installation). Some of this element's properties are ignored
+  on some operating systems, but they are still required both for
+  cross-platform safety and future expansion.
+
+  Setup.DesktopMenuItem attributes:
+
+   disabled (no default, mustBeBool)
+
+    If this is true, the menu item will be skipped by the installer. You
+    probably want this to be true, but you might need to programmatically shut
+    off specific menu items.
+
+
+   name (no default, mustExist, mustBeString, cantBeEmpty)
+
+    This is the proper name of the item to be installed ("Firefox").
+
+
+   genericname (no default, mustExist, mustBeString, cantBeEmpty)
+
+    This is a generic name for the item to be installed ("Web Browser").
+
+
+   tooltip (no default, mustExist, mustBeString, cantBeEmpty)
+
+    This is used as a tooltip for the item by the OS when the user hovers
+    the mouse pointer over it.
+
+   builtin_icon (no default, mustBeBool)
+
+    If this is true, then "icon" refers to a platform-dependent standard
+    icon. Currently, this only makes sense on Unix systems that follow
+    the freedesktop.org standards. If this is false, then "icon" refers
+    to a file, relative to the installation's destination directory, which
+    the must be installed through a Setup.File. Most installers should set
+    this to false (the default) unless they know what they are doing.
+
+   icon (no default, mustExist, mustBeString, cantBeEmpty)
+
+    The icon to use with this menu item. Please see builtin_icon for info
+    on what this string means. The format of files that may be used as icons
+    varies from platform to platform; you may need to install a different
+    file programmatically, based on the value of MojoSetup.info.platform.
+
+   commandline (no default, mustExist, mustBeString, cantBeEmpty)
+
+    This is the command line that will be used to launch the application
+    when the end user clicks on the desktop menu item.
+
+   category (no default, mustExist, mustBeStringOrTableOfStrings)
+
+    This is a category (or array of categories) that the menu item applies
+    to. You can choose several, but one is usually less confusing. Valid
+    choices are currently: AudioVideo, Development, Education, Game, Graphics, Network,
+    Office, Settings, System, Utility.
+
+   mimetype (no default, mustBeStringOrTableOfStrings)
+
+    This is a MIME type (or array of MIME types) that the menu item can handle.
+    For example, if you are installing an image viewer, you might specify:
+    mimetype={"image/jpeg", "image/png"}; ... this is optional, you don't
+    have to specify any mimetypes at all.
+
+    !!! FIXME: there is currently no way for an installer to inform the system
+    !!! FIXME:  of associations between new file extensions and mimetypes.
+    !!! FIXME:  Things that collect mime info themselves, like web browsers
+    !!! FIXME:  and email clients, can use new apps this way, however.
+
+
+
 Add any localized strings:
 
 If you added strings to the installer or your config file that you want

Modified: trunk/scripts/config.lua
===================================================================
--- trunk/scripts/config.lua	2008-02-13 08:52:23 UTC (rev 484)
+++ trunk/scripts/config.lua	2008-02-13 09:36:04 UTC (rev 485)
@@ -96,7 +96,21 @@
         bytes = megabytes(600),
         description = "Base Install",
 
-        -- File(s) to install.
+        -- Install a desktop menu item with the base install.
+        Setup.DesktopMenuItem
+        {
+            disabled = false,
+            name = "My Game",
+            genericname = "Shoot-em up",
+            tooltip = "A game of alien hunting.",
+            builtin_icon = false,
+            icon = "icon.png",  -- relative to the dest; you must install it!
+            commandline = "command-line",
+            categories = "Game",
+            mimetype = { 'application/x-mygame-map', 'application/x-mygame-url' },
+        },
+
+        -- File(s) to install with this option.
         Setup.File
         {
             -- source can be a directory, an archive, or a supported URL.
@@ -132,20 +146,7 @@
             end
         },
 
-        Setup.DesktopMenuItem
-        {
-            disabled = false,
-            name = "My Game",
-            genericname = "Shoot-em up",
-            comment = "A game for shooting aliens.",
-            builtin_icon = false,
-            icon = "icon.png",  -- relative to the dest; you must install it!
-            commandline = "command-line",
-            categories = "Game",
-            mimetype = { 'application/x-mygame-map', 'application/x-mygame-url' },
-        },
-
-        -- Here's an option that has it's own EULA.
+        -- Here's a suboption that has it's own EULA.
         Setup.Option
         {
             value = true,

Modified: trunk/scripts/mojosetup_init.lua
===================================================================
--- trunk/scripts/mojosetup_init.lua	2008-02-13 08:52:23 UTC (rev 484)
+++ trunk/scripts/mojosetup_init.lua	2008-02-13 09:36:04 UTC (rev 485)
@@ -413,7 +413,7 @@
         { "disabled", nil, mustBeBool },
         { "name", nil, mustExist, mustBeString, cantBeEmpty },
         { "genericname", nil, mustExist, mustBeString, cantBeEmpty },
-        { "comment", nil, mustExist, mustBeString, cantBeEmpty },
+        { "tooltip", nil, mustExist, mustBeString, cantBeEmpty },
         { "builtin_icon", nil, mustBeBool },
         { "icon", nil, mustExist, mustBeString, cantBeEmpty },
         { "commandline", nil, mustExist, mustBeString, cantBeEmpty },

Modified: trunk/scripts/mojosetup_mainline.lua
===================================================================
--- trunk/scripts/mojosetup_mainline.lua	2008-02-13 08:52:23 UTC (rev 484)
+++ trunk/scripts/mojosetup_mainline.lua	2008-02-13 09:36:04 UTC (rev 485)
@@ -1029,7 +1029,7 @@
                 "Type=Application\n" ..
                 "Name=" .. item.name .. "\n" ..
                 "GenericName=" .. item.genericname .. "\n" ..
-                "Comment=" .. item.comment .. "\n" ..
+                "Comment=" .. item.tooltip .. "\n" ..
                 "Icon=" .. icon .. "\n" ..
                 "Exec=" .. item.commandline .. "\n" ..
                 "Categories=" .. flatten_list(item.categories) .. "\n"
@@ -1114,6 +1114,7 @@
 
     -- Desktop icons should probably require uninstall so we don't clutter
     --  the system with no option for reversal later.
+    -- !!! FIXME: will miss menu items that are Setup.Option children...
     if (install.desktopmenuitems ~= nil) and (not install.support_uninstall) then
         MojoSetup.fatal(_("BUG: Setup.DesktopMenuItem requires support_uninstall"))
     end
@@ -1349,6 +1350,15 @@
                     process_file(option, v)
                 end
             end
+
+            if option.desktopmenuitems ~= nil then
+                for i,item in ipairs(option.desktopmenuitems) do
+                    if install.desktopmenuitems == nil then
+                        install.desktopmenuitems = {}
+                    end
+                    install.desktopmenuitems[#install.desktopmenuitems] = item
+                end
+            end
         end
 
         local function build_source_tables(opts)




More information about the mojosetup-commits mailing list