[Author: zork]
[google-gears.git] / gears / sdk / api_desktop.html
blob7a70cc78b757c869356ed8268a0ee86f078533e7
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
3 <!--
4 Copyright 2007, Google Inc.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14 3. Neither the name of Google Inc. nor the names of its contributors may be
15 used to endorse or promote products derived from this software without
16 specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 -->
30 <html>
31 <head>
32 <title>Desktop API</title>
33 <link rel="stylesheet" type="text/css" href="gears.css" />
34 </head>
36 <body>
38 <h1>Desktop API <span class="new">[New in
39 <a href="index.html#relnotes">0.3</a>]</span></h1>
41 <div id="pagecontent">
43 <p>The Desktop module provides an interface for accessing desktop related
44 functionality, such as creating shortcuts.
46 <h2 id="example">Example</h2>
48 <pre><code>&lt;script type="text/javascript" src="<a href=
49 'tools.html#gears_init'>gears_init.js</a>"&gt;&lt;/script&gt;
50 &lt;script type="text/javascript"&gt;
51 var desktop = google.gears.factory.create('beta.desktop');
52 desktop.createShortcut("Test Application",
53 "An application at http://www.test.com/index.html",
54 "http://www.test.com/index.html",
55 [{"16x16": "http://www.test.com/icon16x16.png",
56 "32x32": "http://www.test.com/icon32x32.png",
57 "48x48": "http://www.test.com/icon48x48.png",
58 "128x128": "http://www.test.com/icon128x128.png"]});
59 &lt;/script&gt;</code></pre>
62 <h2 id="classes">Classes</h2>
64 <pre><code><a href="#Desktop">Desktop class</a>
65 bool <b>createShortcut</b>(name, description, url, icons)
66 </code></pre>
67 <br>
70 <br>
71 <a name="Desktop"></a>
72 <h2>Desktop class</h2>
74 <h3>Methods</h3>
76 <table>
77 <tr class="odd">
78 <th colspan="2"><div align="left">
79 <code>createShortcut(name, description, url, icons)</code></div></th>
80 </tr>
81 <tr class="odd">
82 <td>Parameters:</td>
83 <td class="odd"><code>name</code> is the name of the shortcut. It must be
84 under 50 characters, and cannot contain any of the characters below:
85 <pre>"\/:*?&lt;&gt;|</pre><br />
86 <code>description</code> is a text blurb that will be shown in the
87 confirmation dialog.<br />
88 <code>url</code> is the URL that will be launched when the user opens the
89 shortcut.<br />
90 <code>icons</code> is an object containing the URLs of up to four icons on
91 properties named: 16x16, 32x32, 48x48, 128x128. The icons must be
92 .png files with dimensions matching the field they are associated with.
93 At least one of 16x16, 32x32, or 48x48 sizes must be specified.</td>
94 </tr>
95 <tr class="odd">
96 <td>Exceptions:</td>
97 <td class="" >Throws an exception if an error occurs. </td>
98 </tr>
99 <tr class="odd">
100 <td>Description:</td>
101 <td class="odd">
102 Attempts to create a desktop shortcut called 'name' that links to 'url'
103 with an icon built from the images listed in the 'icons' object. A dialog
104 is presented to the user with the text of 'description' and the icon with
105 dimensions closest to 32x32. If the user confirms, a desktop shortcut is
106 created.
107 </td>
108 </tr>
109 </table>
112 </div>
113 </body>
114 </html>