![]() |
![]() |
![]() |
libxfcegui4 Reference Manual | ![]() |
---|---|---|---|---|
XfceAppMenuItemXfceAppMenuItem — a GtkMenuItem for app launchers. |
#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);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkItem +----GtkMenuItem +----GtkImageMenuItem +----XfceAppMenuItem
"command" gchararray : Read / Write "icon-name" gchararray : Read / Write "needs-term" gboolean : Read / Write
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.
GtkWidget* xfce_app_menu_item_new ();
Creates a new XfceAppMenuItem with an empty label.
Since 4.1
Returns : |
A new XfceAppMenuItem. |
GtkWidget* xfce_app_menu_item_new_with_label (const gchar *label);
Creates a new XfceAppMenuItem containing a label.
Since 4.1
|
The text of the menu item. |
Returns : |
A new XfceAppMenuItem. |
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
|
The text of the menu item, with an underscore in front of the mnemonic character. |
Returns : |
A new XfceAppMenuItem. |
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
|
The text of the menu item. |
|
The command associated with the menu item. |
Returns : |
A new XfceAppMenuItem. |
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
|
The text of the menu item. |
|
The command associated with the menu item. |
|
The filename of the icon. |
|
TRUE if the application needs a terminal, FALSE if not. |
|
TRUE if the application supports startup notification, FALSE if not. |
Returns : |
A new XfceAppMenuItem. |
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
|
An XfceDesktopEntry describing the menu item to create. |
|
Sets whether or not to show an icon in the menu item. |
Returns : |
A new XfceAppMenuItem, or NULL on error.
|
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
|
An XfceAppMenuItem. |
|
The name of the menu item the menu item. |
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
|
an XfceAppMenuItem. |
|
The filename of the icon. |
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
|
An XfceAppMenuItem. |
|
The command to associate with the menu item. |
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
|
An XfceAppMenuItem. |
|
TRUE if the application needs a terminal, FALSE if not. |
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
|
An XfceAppMenuItem. |
|
TRUE if the application supports startup notification, FALSE if not. |
#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
.
|
An XfceAppMenuItem. |
|
A GtkImage. |
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
|
An XfceAppMenuItem. |
Returns : |
A name/label string. |
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
|
An XfceAppMenuItem. |
Returns : |
An icon name string. |
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
|
An XfceAppMenuItem. |
Returns : |
A command string. |
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
|
An XfceAppMenuItem. |
Returns : |
TRUE if the item will spawn a terminal, FALSE if not. |
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
|
An XfceAppMenuItem. |
Returns : |
TRUE if the item supports startup notification, FALSE if not. |
#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
.
|
An XfceAppMenuItem. |
Returns : |
A GtkImage. |
void xfce_app_menu_item_set_icon_size (guint icon_size);
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.
Since 4.1
|
An icon size, in pixels. |
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
|
A theme name. |
command
" property"command" gchararray : Read / Write
The command to run when the item is clicked.
Default value: NULL
icon-name
" property"icon-name" gchararray : Read / Write
The name of the themed icon to display next to the item.
Default value: NULL
needs-term
" property"needs-term" gboolean : Read / Write
Whether or not the command needs a terminal to execute.
Default value: FALSE