diff --git a/docs/reference/cinnamon-tutorials/write-applet.xml b/docs/reference/cinnamon-tutorials/write-applet.xml index 62219682d4..7462c597e0 100644 --- a/docs/reference/cinnamon-tutorials/write-applet.xml +++ b/docs/reference/cinnamon-tutorials/write-applet.xml @@ -180,7 +180,7 @@ - The third line imports the GLib, which contains the getenv() method to access to the environment variables. Next! + The third line imports the GLib, which contains the get_user_name() method to access to the Linux user name. Next! @@ -213,6 +213,38 @@ + + To be more precise: + + + + + this.set_applet_icon_symbolic_name("bell-notif"); + + + + + Note that set_applet_icon_symbolic_name is a function defined inside Applet.IconApplet, which makes the applet display the corresponding symbolic icon. By using the applet API, we have saved ourselves from the hassle of creating icons and putting them in the right place. (bell-notif is the name of an icon from the user's icon set. The icons available for use can be found in /usr/share/icons/ or in the icons/ folder of this applet) + + + + The next line is: + + + + + this.set_applet_tooltip("Click here to send a notification"); + + + + + which says that the applet should have a tooltip called Click here to send a notification. + + + + There is a way to translate messages such as "Click here to send a notification". Please see Translating applets. + + The class not only defines the constructor, but also methods, which are functions accessible by the instantiated object. Like the on_applet_clicked function, which is all we need. @@ -258,39 +290,11 @@ - Next, in our constructor function, we call the _init (orconstructor) function of Applet.IconApplet. Here we pass on all the information about orientation etc. to this _init (orconstructor) function, and this function will help us sort out all the mess required to make the applet display properly. + Next, in our constructor function, we call the _init (or constructor) function of Applet.IconApplet. Here we pass on all the information about orientation etc. to this _init (orconstructor) function, and this function will help us sort out all the mess required to make the applet display properly. However, contrary to popular belief, the applet API is not psychic. It has no idea what your applet wants to do (apart from displaying an icon). You have to first tell it what icon you want, in the line - - - - this.set_applet_icon_symbolic_name("bell-notif"); - - - - - Note that set_applet_icon_symbolic_name is a function defined inside Applet.IconApplet, which makes the applet display the corresponding icon. By using the applet API, we have saved ourselves from the hassle of creating icons and putting them in the right place. (bell-notif is the name of an icon from the user's icon set. The icons available for use can be found in /usr/share/icons/ or in the icons/ folder of this applet) - - - - The next line is - - - - - this.set_applet_tooltip("Click here to send a notification"); - - - - - which says that the applet should have a tooltip called Click here to send a notification. - - - - There is a way to translate messages such as "Click here to send a notification". Please see Translating applets. -