IdeWorkbenchAddin: gnome-builder Reference Manual

## IdeWorkbenchAddin IdeWorkbenchAddin |

## Functions

gchar * | ide_workbench_addin_get_id ()
void | ide_workbench_addin_load ()
void | ide_workbench_addin_unload ()
gboolean | ide_workbench_addin_can_open ()
void | ide_workbench_addin_open_async ()
gboolean | ide_workbench_addin_open_finish ()

## Types and Values

#define | IDE_TYPE_WORKBENCH_ADDIN
struct | IdeWorkbenchAddinInterface
| IdeWorkbenchAddin

## Object Hierarchy

        GInterface
        ╰── IdeWorkbenchAddin

## Prerequisites

IdeWorkbenchAddin requires GObject.

## Known Implementations

IdeWorkbenchAddin is implemented by IdeEditorWorkbenchAddin.

## Description

## Functions

### ide_workbench_addin_get_id ()

    gchar *
    ide_workbench_addin_get_id (IdeWorkbenchAddin *self);

Gets the identifier for this workbench addin. By default this is the name of the classes GType (such as "MyObject").

This can be used as the hint to various open operations in IdeWorkbench to prefer a given loader.

#### Parameters

self | An IdeWorkbenchAddin. |

#### Returns

a newly allocated string.

[transfer full]

### ide_workbench_addin_load ()

    void
    ide_workbench_addin_load (IdeWorkbenchAddin *self,
                              IdeWorkbench *workbench);

This interface method is called to load `self` . Addin implementations should add any required UI or actions to `workbench` here. You should remove anything you've added in `ide_workbench_addin_unload()`, as that will be called when your plugin is deactivated or the workbench is in the destruction process.

#### Parameters

self | An IdeWorkbenchAddin |
workbench | An IdeWorkbench |

### ide_workbench_addin_unload ()

    void
    ide_workbench_addin_unload (IdeWorkbenchAddin *self,
                                IdeWorkbench *workbench);

This interface method should cleanup after anything added to `workbench` in `ide_workbench_addin_load()`.

This might be called when a plugin is deactivated, or the workbench is in the destruction process.

#### Parameters

self | An IdeWorkbenchAddin |
workbench | An IdeWorkbench |

### ide_workbench_addin_can_open ()

    gboolean
    ide_workbench_addin_can_open (IdeWorkbenchAddin *self,
                                  IdeUri *uri,
                                  const gchar *content_type,
                                  gint *priority);

This interface method indicates if the workbench addin can load the content found at `uri` . If so, `priority` should be set to an integer priority indicating how important it is for this addin to load `uri` .

The lowest integer value wins. However, a load fails, the next addin which returned `TRUE` from this method will be consulted.

#### Parameters

self | An IdeWorkbenchAddin. |
uri | An IdeUri. |
content_type | A content-type or `NULL`. | [nullable]
priority | the priority at which this loader should be used. | [out]

#### Returns

`TRUE` if `self` and open `uri` .

### ide_workbench_addin_open_async ()

    void
    ide_workbench_addin_open_async (IdeWorkbenchAddin *self,
                                    IdeUri *uri,
                                    const gchar *content_type,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

### ide_workbench_addin_open_finish ()

    gboolean
    ide_workbench_addin_open_finish (IdeWorkbenchAddin *self,
                                     GAsyncResult *result,
                                     GError **error);

## Types and Values

### IDE_TYPE_WORKBENCH_ADDIN

    #define IDE_TYPE_WORKBENCH_ADDIN (ide_workbench_addin_get_type())

### struct IdeWorkbenchAddinInterface

    struct IdeWorkbenchAddinInterface {
      GTypeInterface parent;

      gchar    *(*get_id)      (IdeWorkbenchAddin    *self);
      void      (*load)        (IdeWorkbenchAddin    *self,
                                IdeWorkbench         *workbench);
      void      (*unload)      (IdeWorkbenchAddin    *self,
                                IdeWorkbench         *workbench);
      gboolean  (*can_open)    (IdeWorkbenchAddin    *self,
                                IdeUri               *uri,
                                const gchar          *content_type,
                                gint                 *priority);
      void      (*open_async)  (IdeWorkbenchAddin    *self,
                                IdeUri               *uri,
                                const gchar          *content_type,
                                GCancellable         *cancellable,
                                GAsyncReadyCallback   callback,
                                gpointer              user_data);
      gboolean  (*open_finish) (IdeWorkbenchAddin    *self,
                                GAsyncResult         *result,
                                GError              **error);
    };

### IdeWorkbenchAddin

    typedef struct _IdeWorkbenchAddin IdeWorkbenchAddin;