IdeCommand: Builder SDK Reference

## IdeCommand IdeCommand |

## Functions

GIcon * | ide_command_get_icon ()
gint | ide_command_get_priority ()
gchar * | ide_command_get_title ()
gchar * | ide_command_get_subtitle ()
void | ide_command_run_async ()
gboolean | ide_command_run_finish ()

## Types and Values

#define | IDE_TYPE_COMMAND
struct | IdeCommandInterface
| IdeCommand

## Object Hierarchy

        GInterface
        ╰── IdeCommand

## Prerequisites

IdeCommand requires IdeObject.

## Description

## Functions

### ide_command_get_icon ()

    GIcon *
    ide_command_get_icon (IdeCommand *self);

Gets the icon for the command to be displayed in UI if necessary.

#### Parameters

self | a IdeCommand |

#### Returns

a GIcon or `NULL`.

[transfer full][nullable]

Since: 3.34

### ide_command_get_priority ()

    gint
    ide_command_get_priority (IdeCommand *self);

Gets the priority for the command.

This is generally just useful when using the command bar so that the items may be sorted in a useful manner.

Command providers may want to use the typed_text for the query operation to calculate a score with fuzzy matching.

The lower the value, the higher priority.

#### Parameters

self | a IdeCommand |

#### Returns

an integer with the sort priority

Since: 3.34

### ide_command_get_title ()

    gchar *
    ide_command_get_title (IdeCommand *self);

Gets the title for the command.

#### Parameters

self | a IdeCommand |

#### Returns

a string containing the title

Since: 3.32

### ide_command_get_subtitle ()

    gchar *
    ide_command_get_subtitle (IdeCommand *self);

Gets the subtitle for the command.

#### Parameters

self | a IdeCommand |

#### Returns

a string containing the subtitle

Since: 3.32

### ide_command_run_async ()

    void
    ide_command_run_async (IdeCommand *self,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Runs the command, asynchronously.

Use `ide_command_run_finish()` to get the result of the operation.

#### Parameters

self | an IdeCommand |
cancellable | a GCancellable. | [nullable]
callback | a GAsyncReadyCallback to execute upon completion |
user_data | closure data for `callback` |

Since: 3.32

### ide_command_run_finish ()

    gboolean
    ide_command_run_finish (IdeCommand *self,
                            GAsyncResult *result,
                            GError **error);

#### Parameters

self | an IdeCommand |
result | a GAsyncResult provided to callback |
error | a location for a GError, or `NULL` |

#### Returns

`TRUE` if the command was successful; otherwise `FALSE` and `error` is set.

Since: 3.32

## Types and Values

### IDE_TYPE_COMMAND

    #define IDE_TYPE_COMMAND (ide_command_get_type())

### struct IdeCommandInterface

    struct IdeCommandInterface {
      GTypeInterface parent_iface;

      gchar    *(*get_title)     (IdeCommand           *self);
      gchar    *(*get_subtitle)  (IdeCommand           *self);
      void      (*run_async)     (IdeCommand           *self,
                                  GCancellable         *cancellable,
                                  GAsyncReadyCallback   callback,
                                  gpointer              user_data);
      gboolean  (*run_finish)    (IdeCommand           *self,
                                  GAsyncResult         *result,
                                  GError              **error);
      gint      (*get_priority)  (IdeCommand           *self);
      GIcon    *(*get_icon)      (IdeCommand           *self);
    };

### IdeCommand

    typedef struct _IdeCommand IdeCommand;