The GNOME Panel Libraries
<<< Previous Page | Home | Up | Next Page >>>

# Context Menu

## Name

Context Menu -- Functions for adding and remove items from the applet's context menu.

## Synopsis

    #include <applet-widget.h>

    void        applet_widget_register_callback (AppletWidget *applet,
                                                 const char *name,
                                                 const char *menutext,
                                                 AppletCallbackFunc func,
                                                 gpointer data);
    void        applet_widget_register_stock_callback
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *stock_type,
                                                 const char *menutext,
                                                 AppletCallbackFunc func,
                                                 gpointer data);
    void        applet_widget_unregister_callback
                                                (AppletWidget *applet,
                                                 const char *name);
    void        applet_widget_register_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *menutext);
    void        applet_widget_register_stock_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *stock_type,
                                                 const char *menutext);
    void        applet_widget_unregister_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name);
    void        applet_widget_callback_set_sensitive
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 gboolean sensitive);

## Description

## Details

### applet_widget_register_callback ()

    void        applet_widget_register_callback (AppletWidget *applet,
                                                 const char *name,
                                                 const char *menutext,
                                                 AppletCallbackFunc func,
                                                 gpointer data);

Adds a menu item to the applet's context menu. The name should be a path that is separated by '/' and ends in the name of this item. You need to add any submenus with applet_widget_register_callback_dir.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.
`menutext` : | text for the menu item.
`func` : | AppletCallbacFunc to call when the menu item is activated.
`data` : | data passed to `func`.

### applet_widget_register_stock_callback ()

    void        applet_widget_register_stock_callback
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *stock_type,
                                                 const char *menutext,
                                                 AppletCallbackFunc func,
                                                 gpointer data);

Adds a menu item to the applet's context menu with a stock GNOME pixmap. This works almost exactly the same as applet_widget_register_callback.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.
`stock_type` : | GNOME_STOCK string to use for the pixmap
`menutext` : | text for the menu item.
`func` : | AppletCallbacFunc to call when the menu item is activated.
`data` : | data passed to `func`.

### applet_widget_unregister_callback ()

    void        applet_widget_unregister_callback
                                                (AppletWidget *applet,
                                                 const char *name);

Remove a menu item from the applet's context menu. The `name` should be the full path to the menu item. This will not remove any submenus.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.

### applet_widget_register_callback_dir ()

    void        applet_widget_register_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *menutext);

Adds a submenu to the applet's context menu. The `name` should be the full path of the new submenu with the name of the new submenu as the last part of the path. The `name` can, but doesn't have to be terminated with a '/'.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.
`menutext` : | text for the menu item.

### applet_widget_register_stock_callback_dir ()

    void        applet_widget_register_stock_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 const char *stock_type,
                                                 const char *menutext);

Adds a submenu to the applet's context menu with a stock GNOME pixmap. This is similiar to applet_widget_register_callback_dir.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.
`stock_type` : | GNOME_STOCK string to use for the pixmap
`menutext` : | text for the menu item.

### applet_widget_unregister_callback_dir ()

    void        applet_widget_unregister_callback_dir
                                                (AppletWidget *applet,
                                                 const char *name);

Removes a submenu from the applet's context menu. Use this instead of applet_widget_unregister_callback to remove submenus. The `name` can be, but doesn't have to be terminated with a '/'. If you have not removed the subitems of this menu, it will still be shown but without it's title or icon. So make sure to first remove any items and submenus before calling this function.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.

### applet_widget_callback_set_sensitive ()

    void        applet_widget_callback_set_sensitive
                                                (AppletWidget *applet,
                                                 const char *name,
                                                 gboolean sensitive);

Sets the sensitivity of a menu item in the applet's context menu.

`applet` : | AppletWidget to work on.
`name` : | path to the menu item.
`sensitive` : | whether menu item should be sensitive.

<<< Previous Page | Home | Up | Next Page >>>
Panel Interaction | Miscellaneous