lib: Add xdg_app_installation_update_appdata_sync

tingping/wmclass
Alexander Larsson 2016-01-15 16:15:25 +01:00
parent d114069b8a
commit 22b30f7074
2 changed files with 49 additions and 0 deletions

View File

@ -1117,6 +1117,49 @@ xdg_app_installation_fetch_remote_ref_sync (XdgAppInstallation *self,
return NULL;
}
static void
no_progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
{
}
/**
* xdg_app_installation_update_appdata_sync:
* @self: a #XdgAppInstallation
* @remote_name: the name of the remote
* @arch: Architecture to update, or %NULL for the local machine arch
* @out_changed: (nullable): Set to %TRUE if the contents of the appdata changed, %FALSE if nothing changed
* @cancellable: (nullable): a #GCancellable
* @error: return location for a #GError
*
* Updates the local copy of appdata for @remote_name for the specified @arch.
*
* Returns: %TRUE on success, or %FALSE on error
*/
gboolean
xdg_app_installation_update_appdata_sync (XdgAppInstallation *self,
const char *remote_name,
const char *arch,
gboolean *out_changed,
GCancellable *cancellable,
GError **error)
{
XdgAppInstallationPrivate *priv = xdg_app_installation_get_instance_private (self);
g_autoptr(XdgAppDir) dir_clone = NULL;
g_autoptr(OstreeAsyncProgress) ostree_progress = NULL;
/* Pull, prune, etc are not threadsafe, so we work on a copy */
dir_clone = xdg_app_dir_clone (priv->dir);
ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
return xdg_app_dir_update_appdata (dir_clone,
remote_name,
arch,
out_changed,
ostree_progress,
cancellable,
error);
}
/**
* xdg_app_installation_create_monitor:
* @self: a #XdgAppInstallation

View File

@ -163,5 +163,11 @@ XDG_APP_EXTERN XdgAppRemoteRef *xdg_app_installation_fetch_remote_ref_sync
const char *branch,
GCancellable *cancellable,
GError **error);
XDG_APP_EXTERN gboolean xdg_app_installation_update_appdata_sync (XdgAppInstallation *self,
const char *remote_name,
const char *arch,
gboolean *out_changed,
GCancellable *cancellable,
GError **error);
#endif /* __XDG_APP_INSTALLATION_H__ */