## MxAction MxAction — Represents a user action |

## Synopsis

    struct              MxAction;
    struct              MxActionClass;
    MxAction *          mx_action_new                       (void);
    MxAction *          mx_action_new_with_parameter        (const gchar *name,
                                                             const GVariantType *parameter_type);
    MxAction *          mx_action_new_stateful              (const gchar *name,
                                                             const GVariantType *parameter_type,
                                                             GVariant *state);
    MxAction *          mx_action_new_full                  (const gchar *name,
                                                             const gchar *display_name,
                                                             GCallback activated_cb,
                                                             gpointer user_data);
    const gchar *       mx_action_get_name                  (MxAction *action);
    void                mx_action_set_name                  (MxAction *action,
                                                             const gchar *name);
    const gchar *       mx_action_get_display_name          (MxAction *action);
    void                mx_action_set_display_name          (MxAction *action,
                                                             const gchar *name);
    const gchar *       mx_action_get_icon                  (MxAction *action);
    void                mx_action_set_icon                  (MxAction *action,
                                                             const gchar *name);
    gboolean            mx_action_get_active                (MxAction *action);
    void                mx_action_set_active                (MxAction *action,
                                                             gboolean active);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----MxAction

## Implemented Interfaces

MxAction implements GAction.

## Properties

      "active"                   gboolean              : Read / Write
      "display-name"             gchar*                : Read / Write
      "icon"                     gchar*                : Read / Write

## Signals

      "activate"                                       : Run Last
      "activated"                                      : Run Last

## Description

Actions represent operations that the user can perform, such as items in a menu or toolbar.

## Details

### struct MxAction

    struct MxAction;

The contents of this structure are private and should only be accessed through the public API.

### struct MxActionClass

    struct MxActionClass {
      GInitiallyUnownedClass parent_class;

      void (*activated) (MxAction *action);

      /* padding for future expansion */
      void (*_padding_0) (void);
      void (*_padding_1) (void);
      void (*_padding_2) (void);
      void (*_padding_3) (void);
      void (*_padding_4) (void);
    };

### mx_action_new ()

    MxAction *          mx_action_new                       (void);

Creates a new, blank, MxAction

Returns : | a newly allocated MxAction. [transfer full]

### mx_action_new_with_parameter ()

    MxAction *          mx_action_new_with_parameter        (const gchar *name,
                                                             const GVariantType *parameter_type);

Creates a new action with a parameter.

The created action is stateless. See `mx_action_new_stateful()`.

`name` : | the name of the action
`parameter_type` : | the type of parameter to the activate function. [allow-none]
Returns : | a new MxAction

Since 1.4

### mx_action_new_stateful ()

    MxAction *          mx_action_new_stateful              (const gchar *name,
                                                             const GVariantType *parameter_type,
                                                             GVariant *state);

Creates a new stateful action.

`state` is the initial state of the action. All future state values must have the same GVariantType as the initial state.

`name` : | the name of the action
`parameter_type` : | the type of the parameter to the activate function. [allow-none]
`state` : | the initial state of the action
Returns : | a new MxAction

Since 1.4

### mx_action_new_full ()

    MxAction *          mx_action_new_full                  (const gchar *name,
                                                             const gchar *display_name,
                                                             GCallback activated_cb,
                                                             gpointer user_data);

Creates a new MxAction with the name and callback set

`name` : | name of the action
`display_name` : | name of the action to display to the user
`activated_cb` : | callback to connect to the activated signal. [type Mx.ActionCallbackFunc][scope async][allow-none]
`user_data` : | user data to be passed to the callback
Returns : | a newly allocated MxAction. [transfer full]

### mx_action_get_name ()

    const gchar *       mx_action_get_name                  (MxAction *action);

Get the name of the action

`action` : | A MxAction
Returns : | name of the action, owned by MxAction

### mx_action_set_name ()

    void                mx_action_set_name                  (MxAction *action,
                                                             const gchar *name);

Set the name of the action

`action` : | A MxAction
`name` : | new name to set

### mx_action_get_display_name ()

    const gchar *       mx_action_get_display_name          (MxAction *action);

Get the display name of the action

`action` : | A MxAction
Returns : | display-name of the action, owned by MxAction

### mx_action_set_display_name ()

    void                mx_action_set_display_name          (MxAction *action,
                                                             const gchar *name);

Set the name of the action to display to the user

`action` : | A MxAction
`name` : | new display name to set

### mx_action_get_icon ()

    const gchar *       mx_action_get_icon                  (MxAction *action);

Get the icon of the action

`action` : | A MxAction
Returns : | icon of the action, owned by MxAction

### mx_action_set_icon ()

    void                mx_action_set_icon                  (MxAction *action,
                                                             const gchar *name);

The icon to be used in a visual representation of an action.

`action` : | A MxAction
`name` : | new icon to set

### mx_action_get_active ()

    gboolean            mx_action_get_active                (MxAction *action);

Get the value of the active property

`action` : | A MxAction
Returns : | TRUE if the action is active

### mx_action_set_active ()

    void                mx_action_set_active                (MxAction *action,
                                                             gboolean active);

Set the value of the active property

`action` : | A MxAction
`active` : | the value to set

## Property Details

### The `"active"` property

      "active"                   gboolean              : Read / Write

### Warning

`MxAction:active` has been deprecated since version 1.4 and should not be used in newly-written code. use the "enabled" property instead

Whether the action is active.

Default value: TRUE

### The `"display-name"` property

      "display-name"             gchar*                : Read / Write

Localised name to use for display.

Default value: NULL

### The `"icon"` property

      "icon"                     gchar*                : Read / Write

Icon name or path to to be used if this action is displayed.

Default value: NULL

## Signal Details

### The `"activate"` signal

    void                user_function                      (MxAction *action,
                                                            GVariant *parameter,
                                                            gpointer  user_data)      : Run Last

Indicates that the action was just activated.

`parameter` will always be of the expected type. In the event that an incorrect type was given, no signal will be emitted.

`action` : | the MxAction
`parameter` : | the parameter to the activation. [allow-none]
`user_data` : | user data set when the signal handler was connected.

Since 1.4

### The `"activated"` signal

    void                user_function                      (MxAction *action,
                                                            gpointer  user_data)      : Run Last

### Warning

`MxAction::activated` has been deprecated since version 1.4 and should not be used in newly-written code. Use MxAction::activate instead.

Emitted when the MxAction is activated.

`action` : | the object that received the signal
`user_data` : | user data set when the signal handler was connected.