Added new public API: flatpak_installation_update_remote_sync()

Provides access to the functionality offered by the new internal API
flatpak_dir_update_remote_configuration(), in a similar way to what
can be done via the command 'flatpak remote-modify --update-metadata'.
This commit is contained in:
Mario Sanchez Prada
2016-10-13 18:12:36 +01:00
parent 2cbb1da935
commit 8decac7d7f
3 changed files with 44 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ flatpak_installation_install_bundle
flatpak_installation_drop_caches
flatpak_installation_modify_remote
flatpak_installation_remove_remote
flatpak_installation_update_remote_sync
flatpak_get_default_arch
FlatpakProgressCallback
FlatpakUpdateFlags

View File

@@ -798,6 +798,45 @@ flatpak_installation_remove_remote (FlatpakInstallation *self,
return TRUE;
}
/**
* flatpak_installation_update_remote_sync:
* @self: a #FlatpakInstallation
* @name: the name of the remote to update
* @cancellable: (nullable): a #GCancellable
* @error: return location for a #GError
*
* Updates the local configuration of a remote repository by fetching
* the related information from the summary file in the remote OSTree
* repository and committing the changes to the local installation.
*
* Returns: %TRUE if the remote has been updated successfully
*
* Since: 0.6.13
*/
gboolean
flatpak_installation_update_remote_sync (FlatpakInstallation *self,
const char *name,
GCancellable *cancellable,
GError **error)
{
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
g_autoptr(FlatpakDir) dir_clone = NULL;
/* We clone the dir here to make sure we re-read the latest ostree repo config, in case
it has local changes */
dir_clone = flatpak_dir_clone (dir);
if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return FALSE;
if (!flatpak_dir_update_remote_configuration (dir, name, cancellable, error))
return FALSE;
/* Make sure we pick up the new config */
flatpak_installation_drop_caches (self, NULL, NULL);
return TRUE;
}
/**
* flatpak_installation_get_remote_by_name:
* @self: a #FlatpakInstallation

View File

@@ -158,6 +158,10 @@ FLATPAK_EXTERN gboolean flatpak_installation_remove_remote (Flatpak
const char *name,
GCancellable *cancellable,
GError **error);
FLATPAK_EXTERN gboolean flatpak_installation_update_remote_sync (FlatpakInstallation *self,
const char *name,
GCancellable *cancellable,
GError **error);
FLATPAK_EXTERN char * flatpak_installation_load_app_overrides (FlatpakInstallation *self,
const char *app_id,
GCancellable *cancellable,