lib/remote: Add a getter for OstreeRemote.name

Now that we’ve got a public, sealed OstreeRemote structure, we can start
carefully exposing members of it as API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #875
Approved by: cgwalters
This commit is contained in:
Philip Withnall 2017-05-18 08:11:32 +01:00 committed by Atomic Bot
parent a8fd37b6a0
commit d2eaded90d
4 changed files with 29 additions and 0 deletions

View File

@ -3,4 +3,5 @@
OstreeRemote OstreeRemote
ostree_remote_ref ostree_remote_ref
ostree_remote_unref ostree_remote_unref
ostree_remote_get_name
</SECTION> </SECTION>

View File

@ -29,3 +29,8 @@ global:
ostree_remote_ref; ostree_remote_ref;
ostree_remote_unref; ostree_remote_unref;
} LIBOSTREE_2017.6; } LIBOSTREE_2017.6;
LIBOSTREE_2016.7_EXPERIMENTAL {
global:
ostree_remote_get_name;
} LIBOSTREE_2017.6_EXPERIMENTAL;

View File

@ -148,3 +148,23 @@ G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote,
ostree_remote_ref, ostree_remote_ref,
ostree_remote_unref); ostree_remote_unref);
#endif #endif
/**
* ostree_remote_get_name:
* @remote: an #OstreeRemote
*
* Get the human-readable name of the remote. This is what the user configured,
* if the remote was explicitly configured; and will otherwise be a stable,
* arbitrary, string.
*
* Returns: remotes name
* Since: 2017.7
*/
const gchar *
ostree_remote_get_name (OstreeRemote *remote)
{
g_return_val_if_fail (remote != NULL, NULL);
g_return_val_if_fail (remote->ref_count > 0, NULL);
return remote->name;
}

View File

@ -60,4 +60,7 @@ void ostree_remote_unref (OstreeRemote *remote);
#endif /* GI_SCANNER */ #endif /* GI_SCANNER */
#endif #endif
_OSTREE_PUBLIC
const gchar *ostree_remote_get_name (OstreeRemote *remote);
G_END_DECLS G_END_DECLS