You can easily create a gadget that displays the contents of an RSS feed. This tutorial tells you how, using the RSS Demo gadget that's included in the Google Desktop SDK. You make a few changes to the gadget's code, customize its strings, and optionally customize some images. When the gadget is complete you can submit it, making it available to millions of Google Desktop users.
To create your gadget, you need just two things:
If possible, you should also have these:
You might also want large and small icons for your gadget,
if you don't want to use the default icons shown to the right.
The small icon is a 24x24-pixel PNG image (with transparency)
that's used to represent the gadget,
such as when the gadget is collapsed.
The large icon is 32x32-pixel PNG image used in the gadget's About box.
It's OK if you don't have everything yet. The RSS Demo gadget can run without being customized, so you can get started despite missing pieces.
This tutorial uses the RSS Demo gadget that's included in the Google Desktop SDK. To run the gadget, you must have Google Desktop installed.
Do this:
Do this:
api/samples/gadgets/rss
folder,
giving it a unique name
that reflects the gadget's public name.
(You can change the name later.)
This tutorial uses the folder name
MyCompanyFeed
.The RSS Demo gadget is implemented using many files, but you don't need to know anything about most of them. The following table shows the files you're likely to change.
File Name | Type | Description |
---|---|---|
editme/config_constants.js |
JavaScript source file | Defines RSS gadget constants such as the feed URL, feed refresh interval, directory containing the gadget skin's images, and so on. |
en/strings.xml |
XML file | Defines strings used by the default, English version of this gadget. If you want to specify strings for other languages, see the gadget API documentation's discussion of Internationalization. |
gadget.gmanifest |
Google Desktop manifest file | Specifies the gadget's metadata, such as its ID and version. |
icon_large.png |
image | Your gadget's 32x32-pixel icon. |
icon_small.png |
image | Your gadget's 24x24-pixel icon. |
default/frame_TopLogo.png |
image | The logo that appears at the top of the main view of the RSS gadget. |
default/theme_config.xml |
XML | Specifies the background color of the item currently under the cursor. |
default/title.xml |
XML | Specifies elements — such as title text or a logo — that are displayed in the title area. |
The next step is to run your copy of the RSS Demo gadget, both to make sure it works and to see what it does.
Do this:
MyCompanyFeed
).
gadget.gmanifest
file.
You should see an installation dialog.
api/samples/gadgets/rss
folder.gadget.gmanifest
file.rss
folder.Now that you've seen what the RSS Demo gadget does, it's time to customize it.
The file editme/config_constants.js
defines several constants that you can change
to customize your gadget.
The most important one defines the address of the RSS feed.
It looks like this:
// OLD code
var CONFIG_FEED_URL = 'http://googledesktopapis.blogspot.com/atom.xml';
Do this:
editme/config_constants.js
in a text editor
that can handle UNIX-style line endings.
(WordPad works; NotePad doesn't.)
CONFIG_FEED_URL
is set to the newsfeed's URL.
// NEW code var CONFIG_FEED_URL = 'http://your-feed-address-goes-here';
Launch the gadget by double-clicking its
gadget.gmanifest
file.
Make sure the gadget displays the newsfeed correctly, in both the main view and the details view.
If the gadget doesn't display the newsfeed correctly, please let us know:
sdk/api/tools/gdpconsole.exe
)
to get error messages.
Note:
If you're willing to change JavaScript code,
you can try to fix the problem
by editing the parseFeed()
function
in editme/entry_item_impl.js
.
Optionally, change other configuration parameters.
For example, you can set the value of
CONFIG_REFRESH_FEED_MS
to update your gadget's items
more or less often than the default once per hour.
In this step, you edit two files to customize your gadget's strings and give it a unique ID. Then if you have custom images, you put them in the gadget. Finally, you can adjust the color of your gadget.
Do this:
gadget.gmanifest
in a text editor.<id>
value in gadget.gmanifest
to be the unique identifier you just generated.gadget.gmanifest
values,
such as
<author>
,
<authorWebsite>
,
<copyright>
, and
<authorEmail>
.
For information about these elements, see the
gadget.gmanifest documentation.en
folder,
open the strings.xml
file in your text editor.strings.xml
with the gadget's
new name,
description,
and "about" information.
You can also change other strings, if you like.
Here's an example,
with changed text in orange:
... <strings> <GADGET_NAME>News from My Company</GADGET_NAME> <GADGET_DESCRIPTION>Hear the latest news from My Company</GADGET_DESCRIPTION> <GADGET_ABOUT_TEXT>News from My Company Copyright 2007 Google Inc. Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 Modifications copyright 2007 My Company All Rights Reserved. Keep up with the latest news about My Company. To see a news release's full text, just click its headline. For more information about My Company, go to http://example.com. </GADGET_ABOUT_TEXT> ... <TITLE_TEXT>My Company News</TITLE_TEXT> </strings>
Note:
Because space in the title area is limited,
the value of TITLE_TEXT
, if any,
must be short.
default
folder as frame_TopLogo.png
.icon_large.png
and
icon_small.png
,
respectively.<entryHoverBkg>
element in
the file default/theme_config.xml
.
You can find help with hexadecimal color codes by searching for
[hexadecimal color -safe].
Here's an example of changing the color to light green:
<entryHoverBkg>#e2fcbc</entryHoverBkg>
The following snapshot shows a gadget
that has a custom title, logo, and background color.
The value of <TITLE_TEXT>
is
Developer News
,
the top logo is a transparent Google Desktop icon,
and the value of <entryHoverBkg>
is #e2fcbc
.
Note that the title area isn't wide enough for a longer name,
such as "Google Desktop Developer News".
Fortunately, the logo makes the "Google Desktop" string redundant.
So far, you've been running your gadget
by double-clicking its gadget.gmanifest
file.
That's fine while you're debugging,
but a finished gadget needs to be packaged into a single file
for distribution.
In this step, you create a .gg
package —
a ZIP archive
of the files that define your gadget's appearance and behavior.
You can then double-click the .gg
file
to run the gadget.
Do this:
Thumbs.db
files.
Note:
The structure of the ZIP file should match
the structure of your gadget's folder.
For example, gadget.gmanifest
and main.xml
should be at the top level of the ZIP file,
not in a folder.
.gg
extension
(for example, MyCompanyFeed.gg
).
.gg
file
in a convenient place
outside of your gadget's folder —
for example, on your computer's desktop..gg
file.
If your gadget starts running, you're ready to do final testing.In this step, you make your gadget available for download by users. These instructions tell you how to submit the gadget to Google, so your gadget is available to millions of users.
Do this:
.gg
file and screenshots to
a publicly visible website.
.gg
file.When your gadget submission is received, you get an email from Google. Keep this email — you'll need it later if you need to change the URL or screenshots for your gadget.
If this was your first gadget, don't stop — make another! Follow another tutorial, visit the developer group, or read more about gadgets.