diff --git a/apidoc/ostree-experimental-sections.txt b/apidoc/ostree-experimental-sections.txt index 790feb33..998a4f9c 100644 --- a/apidoc/ostree-experimental-sections.txt +++ b/apidoc/ostree-experimental-sections.txt @@ -3,4 +3,5 @@ OstreeRemote ostree_remote_ref ostree_remote_unref +ostree_remote_get_name diff --git a/src/libostree/libostree-experimental.sym b/src/libostree/libostree-experimental.sym index e2ab4ea8..1d4feeda 100644 --- a/src/libostree/libostree-experimental.sym +++ b/src/libostree/libostree-experimental.sym @@ -29,3 +29,8 @@ global: ostree_remote_ref; ostree_remote_unref; } LIBOSTREE_2017.6; + +LIBOSTREE_2016.7_EXPERIMENTAL { +global: + ostree_remote_get_name; +} LIBOSTREE_2017.6_EXPERIMENTAL; diff --git a/src/libostree/ostree-remote.c b/src/libostree/ostree-remote.c index 86fae8d8..f34fafa4 100644 --- a/src/libostree/ostree-remote.c +++ b/src/libostree/ostree-remote.c @@ -148,3 +148,23 @@ G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote, ostree_remote_ref, ostree_remote_unref); #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: remote’s 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; +} diff --git a/src/libostree/ostree-remote.h b/src/libostree/ostree-remote.h index 8e96213c..5505bc1d 100644 --- a/src/libostree/ostree-remote.h +++ b/src/libostree/ostree-remote.h @@ -60,4 +60,7 @@ void ostree_remote_unref (OstreeRemote *remote); #endif /* GI_SCANNER */ #endif +_OSTREE_PUBLIC +const gchar *ostree_remote_get_name (OstreeRemote *remote); + G_END_DECLS