## XfceAppMenuItem

XfceAppMenuItem — a GtkMenuItem for app launchers.

## Synopsis

    #include <libxfcegui4/libxfcegui4.h>

                        XfceAppMenuItem;
    GtkWidget*          xfce_app_menu_item_new              ();
    GtkWidget*          xfce_app_menu_item_new_with_label   (const gchar *label);
    GtkWidget*          xfce_app_menu_item_new_with_mnemonic
                                                            (const gchar *label);
    GtkWidget*          xfce_app_menu_item_new_with_command (const gchar *label,
                                                             const gchar *command);
    GtkWidget*          xfce_app_menu_item_new_full         (const gchar *label,
                                                             const gchar *command,
                                                             const gchar *icon_filename,
                                                             gboolean needs_term,
                                                             gboolean snotify);
    GtkWidget*          xfce_app_menu_item_new_from_desktop_entry
                                                            (XfceDesktopEntry *entry,
                                                             gboolean show_icon);
    void                xfce_app_menu_item_set_name         (XfceAppMenuItem *app_menu_item,
                                                             const gchar *name);
    void                xfce_app_menu_item_set_icon_name    (XfceAppMenuItem *app_menu_item,
                                                             const gchar *filename);
    void                xfce_app_menu_item_set_command      (XfceAppMenuItem *app_menu_item,
                                                             const gchar *command);
    void                xfce_app_menu_item_set_needs_term   (XfceAppMenuItem *app_menu_item,
                                                             gboolean needs_term);
    void                xfce_app_menu_item_set_startup_notification
                                                            (XfceAppMenuItem *app_menu_item,
                                                             gboolean snotify);
    #define             xfce_app_menu_item_set_image        (mi, img)
    const gchar*        xfce_app_menu_item_get_name         (XfceAppMenuItem *app_menu_item);
    const gchar*        xfce_app_menu_item_get_icon_name    (XfceAppMenuItem *app_menu_item);
    const gchar*        xfce_app_menu_item_get_command      (XfceAppMenuItem *app_menu_item);
    gboolean            xfce_app_menu_item_get_needs_term   (XfceAppMenuItem *app_menu_item);
    gboolean            xfce_app_menu_item_get_startup_notification
                                                            (XfceAppMenuItem *app_menu_item);
    #define             xfce_app_menu_item_get_image        (mi)
    void                xfce_app_menu_item_set_icon_size    (guint icon_size);
    void                xfce_app_menu_item_set_icon_theme_name
                                                            (const gchar *theme_name);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkItem
                                           +----GtkMenuItem
                                                 +----GtkImageMenuItem
                                                       +----XfceAppMenuItem

## Implemented Interfaces

XfceAppMenuItem implements AtkImplementorIface and GtkBuildable.

## Properties

      "command"                  gchar*                : Read / Write
      "icon-name"                gchar*                : Read / Write
      "label"                    gchar*                : Read / Write
      "needs-term"               gboolean              : Read / Write
      "snotify"                  gboolean              : Read / Write
      "use-underline"            gboolean              : Read / Write

## Description

XfceAppMenuItem is a direct subclass of GtkImageMenuItem, and is intended for use in application menus. XfceAppMenuItem essentially wraps an application: it knows how to run the application, what it is called, and what icon is used to represent it. An XfceAppMenuItem can also be generated directly from an XfceDesktopEntry.

## Details

### XfceAppMenuItem

    typedef struct _XfceAppMenuItem XfceAppMenuItem;

### xfce_app_menu_item_new ()

    GtkWidget*          xfce_app_menu_item_new              ();

Creates a new XfceAppMenuItem with an empty label.

Since 4.1

Returns : | A new XfceAppMenuItem.

### xfce_app_menu_item_new_with_label ()

    GtkWidget*          xfce_app_menu_item_new_with_label   (const gchar *label);

Creates a new XfceAppMenuItem containing a label.

Since 4.1

`label` : | The text of the menu item.
Returns : | A new XfceAppMenuItem.

### xfce_app_menu_item_new_with_mnemonic ()

    GtkWidget*          xfce_app_menu_item_new_with_mnemonic
                                                            (const gchar *label);

Creates a new XfceAppMenuItem containing a label. The label will be created using `gtk_label_new_with_mnemonic()`, so underscores in `label` indicate the mnemonic for the menu item.

Since 4.1

`label` : | The text of the menu item, with an underscore in front of the mnemonic character.
Returns : | A new XfceAppMenuItem.

### xfce_app_menu_item_new_with_command ()

    GtkWidget*          xfce_app_menu_item_new_with_command (const gchar *label,
                                                             const gchar *command);

Creates a new XfceAppMenuItem containing a label. The item's `activate` signal will be connected such that `command` will run when it is clicked.

Since 4.1

`label` : | The text of the menu item.
`command` : | The command associated with the menu item.
Returns : | A new XfceAppMenuItem.

### xfce_app_menu_item_new_full ()

    GtkWidget*          xfce_app_menu_item_new_full         (const gchar *label,
                                                             const gchar *command,
                                                             const gchar *icon_filename,
                                                             gboolean needs_term,
                                                             gboolean snotify);

Single-function interface to create an XfceAppMenuItem. Has the effect of calling `xfce_app_menu_item_new_with_label()` followed by all the xfce_app_menu_item_set_*() functions.

Since 4.1

`label` : | The text of the menu item.
`command` : | The command associated with the menu item.
`icon_filename` : | The filename of the icon.
`needs_term` : | TRUE if the application needs a terminal, FALSE if not.
`snotify` : | TRUE if the application supports startup notification, FALSE if not.
Returns : | A new XfceAppMenuItem.

### xfce_app_menu_item_new_from_desktop_entry ()

    GtkWidget*          xfce_app_menu_item_new_from_desktop_entry
                                                            (XfceDesktopEntry *entry,
                                                             gboolean show_icon);

Creates a new XfceAppMenuItem using parameters from the application specified in a XfceDesktopEntry object. This has the effect of calling `xfce_app_menu_item_new_with_command()`, `xfce_app_menu_item_set_needs_term()`, `xfce_app_menu_item_set_icon_name()`, and `xfce_app_menu_item_set_startup_notification()`.

Since 4.1

`entry` : | An XfceDesktopEntry describing the menu item to create.
`show_icon` : | Sets whether or not to show an icon in the menu item.
Returns : | A new XfceAppMenuItem, or `NULL` on error.

### xfce_app_menu_item_set_name ()

    void                xfce_app_menu_item_set_name         (XfceAppMenuItem *app_menu_item,
                                                             const gchar *name);

Sets `name` as the displayed name of the XfceAppMenuItem.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
`name` : | The name of the menu item the menu item.

### xfce_app_menu_item_set_icon_name ()

    void                xfce_app_menu_item_set_icon_name    (XfceAppMenuItem *app_menu_item,
                                                             const gchar *filename);

Sets the icon of the XfceAppMenuItem using the specified filename. If the filename doesn't have a full pathname, standard icon search paths will be used. If the filename doesn't have an extension, the best image format found (if any) will be used. If there is already an icon set, the current one is freed, regardless if the icon is found or not.

Since 4.1

`app_menu_item` : | an XfceAppMenuItem.
`filename` : | The filename of the icon.

### xfce_app_menu_item_set_command ()

    void                xfce_app_menu_item_set_command      (XfceAppMenuItem *app_menu_item,
                                                             const gchar *command);

Sets `command` as the command run when the XfceAppMenuItem is clicked.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
`command` : | The command to associate with the menu item.

### xfce_app_menu_item_set_needs_term ()

    void                xfce_app_menu_item_set_needs_term   (XfceAppMenuItem *app_menu_item,
                                                             gboolean needs_term);

Sets whether or not the command executed by this XfceAppMenuItem requires a terminal window to run.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
`needs_term` : | TRUE if the application needs a terminal, FALSE if not.

### xfce_app_menu_item_set_startup_notification ()

    void                xfce_app_menu_item_set_startup_notification
                                                            (XfceAppMenuItem *app_menu_item,
                                                             gboolean snotify);

Sets whether or not the application supports startup notification.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
`snotify` : | TRUE if the application supports startup notification, FALSE if not.

### xfce_app_menu_item_set_image()

    #define xfce_app_menu_item_set_image(mi, img) gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img)

Sets `img` as the GtkImage widget that displays the icon for XfceAppMenuItem `mi`.

`mi` : | An XfceAppMenuItem.
`img` : | A GtkImage.

### xfce_app_menu_item_get_name ()

    const gchar*        xfce_app_menu_item_get_name         (XfceAppMenuItem *app_menu_item);

Returns the current name/label set for the XfceAppMenuItem, or NULL.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
Returns : | A name/label string.

### xfce_app_menu_item_get_icon_name ()

    const gchar*        xfce_app_menu_item_get_icon_name    (XfceAppMenuItem *app_menu_item);

Returns the current icon name set for the XfceAppMenuItem, or NULL.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
Returns : | An icon name string.

### xfce_app_menu_item_get_command ()

    const gchar*        xfce_app_menu_item_get_command      (XfceAppMenuItem *app_menu_item);

Returns the current command set for the XfceAppMenuItem, or NULL.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
Returns : | A command string.

### xfce_app_menu_item_get_needs_term ()

    gboolean            xfce_app_menu_item_get_needs_term   (XfceAppMenuItem *app_menu_item);

Checks whether or not the command executed by this XfceAppMenuItem requires a terminal window to run.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
Returns : | TRUE if the item will spawn a terminal, FALSE if not.

### xfce_app_menu_item_get_startup_notification ()

    gboolean            xfce_app_menu_item_get_startup_notification
                                                            (XfceAppMenuItem *app_menu_item);

Checks whether or not the command executed by this XfceAppMenuItem supports startup notification.

Since 4.1

`app_menu_item` : | An XfceAppMenuItem.
Returns : | TRUE if the item supports startup notification, FALSE if not.

### xfce_app_menu_item_get_image()

    #define xfce_app_menu_item_get_image(mi) gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(mi))

Gets the GtkImage widget associated with XfceAppMenuItem `mi`.

`mi` : | An XfceAppMenuItem.
Returns : | A GtkImage.

### xfce_app_menu_item_set_icon_size ()

    void                xfce_app_menu_item_set_icon_size    (guint icon_size);

### Warning

`xfce_app_menu_item_set_icon_size` is deprecated and should not be used in newly-written code. This function currently does nothing; the 'menu' icon size is always used.

Since 4.1

Sets the icon size that should be used when constructing XfceAppMenuItems with icons. This is a `static` method and does not need an instance of XfceAppMenuItem to exist before it is called.

`icon_size` : | An icon size, in pixels.

### xfce_app_menu_item_set_icon_theme_name ()

    void                xfce_app_menu_item_set_icon_theme_name
                                                            (const gchar *theme_name);

Sets the icon theme name that should be used when looking for icons for XfceAppMenuItems. This is a `static` method and does not need an instance of XfceAppMenuItem to exist before it is called.

Since 4.1

`theme_name` : | A theme name.

## Property Details

### The `"command"` property

      "command"                  gchar*                : Read / Write

The command to run when the item is clicked.

Default value: NULL

### The `"icon-name"` property

      "icon-name"                gchar*                : Read / Write

The name of the themed icon to display next to the item.

Default value: NULL

### The `"label"` property

      "label"                    gchar*                : Read / Write

The label displayed in the item.

Default value: NULL

### The `"needs-term"` property

      "needs-term"               gboolean              : Read / Write

Whether or not the command needs a terminal to execute.

Default value: FALSE

### The `"snotify"` property

      "snotify"                  gboolean              : Read / Write

Whether or not the app supports startup notification.

Default value: FALSE

### The `"use-underline"` property

      "use-underline"            gboolean              : Read / Write

Whether or not to use an underscore in the label as a keyboard mnemonic.

Default value: FALSE