AWN API

From AWN Wiki

Jump to: navigation, search

Contents

[edit] C API

[edit] libawn/awn-applet-dialog.h

[edit] libawn/awn-applet-gconf.h

[edit] libawn/awn-applet.h

[edit] libawn/awn-applet-simple.h

[edit] libawn/awn-cairo-utils.h

[edit] libawn/awn-config-client.h

Only in the desktop-agnostic branch. See Blueprint for details.

[edit] libawn/awn-defines.h

[edit] libawn/awn-desktop-item.h

Note: only in the desktop-agnostic branch.

This is a read-write wrapper for implementations of the Desktop Entry specification. The name is derived from the Gnome implementation.

[edit] AwnDesktopItem *awn_desktop_item_new (gchar *uri);

If the URI exists, opens a desktop entry file and parses it. Otherwise, Creates a new desktop entry file.

[edit] AwnDesktopItem *awn_desktop_item_copy (const AwnDesktopItem *item);

Creates a copy of the AwnDesktopEntry object. Exists mostly because it is a requirement of a boxed object.

[edit] gchar *awn_desktop_item_get_filename (AwnDesktopItem *item);

Retrieves the filename of the desktop entry.

[edit] gchar *awn_desktop_item_get_item_type (AwnDesktopItem *item);

Retrieves the type of desktop entry (corresponds to the entry key "Type").

[edit] void awn_desktop_item_set_item_type (AwnDesktopItem *item, gchar *item_type);

[edit] gchar *awn_desktop_item_get_icon (AwnDesktopItem *item, GtkIconTheme *icon_theme);

[edit] void awn_desktop_item_set_icon (AwnDesktopItem *item, gchar *icon);

[edit] gchar *awn_desktop_item_get_name (AwnDesktopItem *item);

[edit] void awn_desktop_item_set_name (AwnDesktopItem *item, gchar *name);

[edit] gchar *awn_desktop_item_get_exec (AwnDesktopItem *item);

[edit] void awn_desktop_item_set_exec (AwnDesktopItem *item, gchar *exec);

[edit] gchar *awn_desktop_item_get_string (AwnDesktopItem *item, gchar *key);

[edit] void awn_desktop_item_set_string (AwnDesktopItem *item, gchar *key, gchar *value);

[edit] gchar *awn_desktop_item_get_localestring (AwnDesktopItem *item, gchar *key);

[edit] void awn_desktop_item_set_localestring (AwnDesktopItem *item, gchar *key, gchar *locale, gchar *value);

[edit] gboolean awn_desktop_item_exists (AwnDesktopItem *item);

[edit] gint awn_desktop_item_launch (AwnDesktopItem *item, GList *documents, GError **err);

[edit] void awn_desktop_item_save (AwnDesktopItem *item, GError **err);

[edit] void awn_desktop_item_unref (AwnDesktopItem *item);

[edit] libawn/awn-effects.h

Note: The complete documentation can be generated from awn-effects.h using gtk-doc.

[edit] void awn_effects_init (GObject *obj, AwnEffects *fx);

Initializes AwnEffects structure.

[edit] void awn_effects_finalize (AwnEffects *fx);

Finalizes AwnEffects usage and frees internally allocated memory. (also calls awn_unregister_effects()).

[edit] void awn_register_effects (GObject *obj, AwnEffects *fx);

Registers enter-notify and leave-notify events for managed window.

[edit] void awn_unregister_effects (AwnEffects *fx);

Unregisters events for managed window.

[edit] void awn_effect_start (AwnEffects *fx, const AwnEffect effect);

Starts an effect.

[edit] void awn_effect_stop (AwnEffects *fx, const AwnEffect effect);

Stop a single effect.

[edit] void awn_effects_set_title (AwnEffects *fx, AwnTitle *title, AwnTitleCallback title_func);

Makes AwnTitle appear on event-notify.

[edit] void awn_effect_start_ex (AwnEffects *fx, const AwnEffect effect, AwnEventNotify start, AwnEventNotify stop, gint max_loops);

Extended effect start, which provides callbacks for animation start, end and possibility to specify maximum number of loops.

[edit] void awn_draw_background (AwnEffects *, cairo_t *);

[edit] void awn_draw_icons (AwnEffects *, cairo_t *, GdkPixbuf *, GdkPixbuf *);

[edit] void awn_draw_foreground (AwnEffects *, cairo_t *);

[edit] void awn_draw_set_window_size (AwnEffects *, const gint, const gint);

[edit] void awn_draw_set_icon_size (AwnEffects *, const gint, const gint);

[edit] libawn/awn-gconf.h

[edit] libawn/awn-plug.h

[edit] libawn/awn-title.h

[edit] libawn/awn-vfs.h

Note: only in the desktop-agnostic branch.

[edit] void awn_vfs_init (void);

Initializes the VFS that AWN uses. Execute this only once, in your initialization function.

[edit] GList *awn_vfs_get_pathlist_from_string (gchar *paths, GError **err);

Creates a list of paths from a string with the MIME type text/uri-list (used in Drag and Drop operations). Returns a newly allocated GList* that should be freed when you're done with it.

[edit] Python Applet API

Make sure to see Python Applet Development for a quick introduction to creating applets and Example Python Applet for a well-commented example applet. Also note that AWNLib wraps around the AWN API and provides a much better interface to it. Beginning Python applet developers are encouraged to use that.

[edit] AWN Module

import awn
Imports the AWN module and gives you access the the applet API

awn.init(sys.argv[1:])
Initiates a new applet

awn.uid, awn.orient, awn.height
These values should be passed to the awn.AppletSimple constructor

awn.init_applet
Creates your applet. Should be passed a single parameter that is an object of type AppletSimple (or, usually, a class that inherits from AppletSimple)

awn.awn_title_get_default
Returns a title object that refers to the title shown when the mouse is over your icon.

awn.awn_effect_start(AwnEffects*, AwnEffect)
Starts an effect. Currently usable only with AppletSimple!
AwnEffects* can be get by calling AppletSimple.get_effects()
AwnEffect can be one of: "opening", "closing", "launching", "hover", "attention", "desaturate".

awn.awn_effect_start_ex(AwnEffects*, AwnEffect, start, stop, max_loops)
Extended effect start. Currently usable only with AppletSimple!
AwnEffects* can be get by calling AppletSimple.get_effects()
AwnEffect can be one of: "opening", "closing", "launching", "hover", "attention", "desaturate".
start, stop - not used at the moment, pass 0.
max_loops - Maximum number of animation loops.

awn.awn_effect_stop(AwnEffects*, AwnEffect)
Stops an effect. Currently usable only with AppletSimple!
AwnEffects* can be get by calling AppletSimple.get_effects()
AwnEffect can be one of: "opening", "closing", "launching", "hover", "attention", "desaturate".

awn.awn_unregister_effects(AwnEffects*)
Can be used to disable hover effects. Currently usable only with AppletSimple!

AppletDialog
Should be passed your applet object (descendant of AppletSimple). Returns a Dialog object that is used like a regular GTK window to create the popout-dialogs in your applet.

[edit] AWN.AppletSimple Class

set_icon
Should be passed a GTK icon. Sets an icon for your applet. Should only be used when the icon is not going to change.

set_temp_icon (deprecated! Please do not use!)
Should be passed a GTK icon. Sets an icon for your applet with the intent of changing it at some point.

get_effects
Returns AwnEffects*, which can be passed to awn_effect_start/stop etc.

register_effects(AwnEffects*)
Will register starting and stopping of "hover" effect on mouseover/-out. (currently done automatically by AppletSimple constructor, use only if you used awn_unregister_effects)

[edit] AWN.AppletDialog Class

This class inherits a lot of functionality from GTK widgets, so show_all, connect, etc. work with it.

dialog.set_title
Should be passed a string. Gives your dialog a title (like that seen in the main menu applet or stacks applet) with the text that you passed.

[edit] AWN.AppletTitle Class

hide
Hides the title. This should usually be done on mouse out and on the openning of a dialog.

show
Should be passed a string with the text of the title. Usually done on mouse in.


[edit] Proposed New/Revised APIs

A revised awn-effects API based on cairo surfaces instead of pixbufs.

Personal tools