lib/remote: Add implementation of flatpak_remote_get_remote_type()

This is declared in the header file, but was never actually implemented.
Oops.

If anybody is hit by this issue, they can work around it by using
g_object_get() to get the FlatpakRemote:type property, which this is the
getter for.

Add it to the tests as well, so it gets exercised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
tingping/wmclass
Philip Withnall 2017-08-23 16:55:31 +01:00
parent 00e5a0d325
commit 15df314ca4
3 changed files with 22 additions and 1 deletions

View File

@ -839,3 +839,22 @@ flatpak_remote_commit (FlatpakRemote *self,
return flatpak_dir_modify_remote (dir, priv->name, config, priv->local_gpg_key, cancellable, error);
}
/**
* flatpak_remote_get_remote_type:
* @self: a #FlatpakRemote
*
* Get the value of #FlatpakRemote:type.
*
* Returns: the type of remote this is
* Since: 0.9.8
*/
FlatpakRemoteType
flatpak_remote_get_remote_type (FlatpakRemote *self)
{
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
g_return_val_if_fail (FLATPAK_IS_REMOTE (self), FLATPAK_REMOTE_TYPE_STATIC);
return priv->type;
}

View File

@ -363,8 +363,9 @@ main (int argc, char *argv[])
collection_id = flatpak_remote_get_collection_id (remote);
#endif /* !FLATPAK_ENABLE_P2P */
g_print ("\nRemote: %s %d %s %s %s %s %d %d %s\n",
g_print ("\nRemote: %s %u %d %s %s %s %s %d %d %s\n",
flatpak_remote_get_name (remote),
flatpak_remote_get_remote_type (remote),
flatpak_remote_get_prio (remote),
flatpak_remote_get_url (remote),
collection_id,

View File

@ -250,6 +250,7 @@ test_remote_by_name (void)
g_assert_cmpstr (flatpak_remote_get_name (remote), ==, repo_name);
g_assert_cmpstr (flatpak_remote_get_url (remote), ==, repo_url);
g_assert_cmpstr (flatpak_remote_get_title (remote), ==, NULL);
g_assert_cmpint (flatpak_remote_get_remote_type (remote), ==, FLATPAK_REMOTE_TYPE_STATIC);
g_assert_false (flatpak_remote_get_noenumerate (remote));
g_assert_false (flatpak_remote_get_disabled (remote));
g_assert_true (flatpak_remote_get_gpg_verify (remote));