Updates: libportal Reference Manual

## Updates Updates — installing software updates |

## Functions

void | xdp_portal_update_monitor_start ()
gboolean | xdp_portal_update_monitor_start_finish ()
void | xdp_portal_update_monitor_stop ()
void | xdp_portal_update_install ()
gboolean | xdp_portal_update_install_finish ()

## Types and Values

enum | XdpUpdateStatus
enum | XdpUpdateMonitorFlags
enum | XdpUpdateInstallFlags

## Description

These functions let applications be informed about available software updates (for themselves) and install those updates.

The underlying portal is org.freedesktop.portal.Flatpak.

## Functions

### xdp_portal_update_monitor_start ()

    void
    xdp_portal_update_monitor_start (XdpPortal *portal,
                                     XdpUpdateMonitorFlags flags,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer data);

Makes XdpPortal start monitoring for available software updates.

When a new update is available, the “update-available”. signal is emitted.

Use `xdp_portal_update_monitor_stop()` to stop monitoring.

#### Parameters

portal | a XdpPortal |
flags | options for this cal.. |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_update_monitor_start_finish ()

    gboolean
    xdp_portal_update_monitor_start_finish
                                   (XdpPortal *portal,
                                    GAsyncResult *result,
                                    GError **error);

Finishes an update-monitor request, and returns the result in the form of boolean.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

`TRUE` if the request succeeded

### xdp_portal_update_monitor_stop ()

    void
    xdp_portal_update_monitor_stop (XdpPortal *portal);

Stops update monitoring that was started with `xdp_portal_update_monitor_start()`.

#### Parameters

portal | a XdpPortal |

### xdp_portal_update_install ()

    void
    xdp_portal_update_install (XdpPortal *portal,
                               XdpParent *parent,
                               XdpUpdateInstallFlags flags,
                               GCancellable *cancellable,
                               GAsyncReadyCallback callback,
                               gpointer data);

Installs an available software update. This should be called in response to a “update-available” signal.

During the update installation, the “update-progress” signal will be emitted to provide progress information.

#### Parameters

portal | a XdpPortal |
parent | a XdpParent |
flags | options for this call |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_update_install_finish ()

    gboolean
    xdp_portal_update_install_finish (XdpPortal *portal,
                                      GAsyncResult *result,
                                      GError **error);

Finishes an update-installation request, and returns the result in the form of boolean.

Note that the update may not be completely installed by the time this function is called. You need to listen to the “update-progress” signal to learn when the installation is complete.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

`TRUE` if the update is being installed

## Types and Values

### enum XdpUpdateStatus

The values of this enum are returned in the “update-progress” signal to indicate the current progress of an installation.

#### Members

XDP_UPDATE_STATUS_RUNNING | Installation in progress |
XDP_UPDATE_STATUS_EMPTY | Nothing to install |
XDP_UPDATE_STATUS_DONE | Installation finished successfully |
XDP_UPDATE_STATUS_FAILED | Installation failed |

### enum XdpUpdateMonitorFlags

#### Members

XDP_UPDATE_MONITOR_FLAG_NONE |  |

### enum XdpUpdateInstallFlags

#### Members

XDP_UPDATE_INSTALL_FLAG_NONE |  |