From 00e5a0d325c36f2593f342d8e362dcc8d8a4b426 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 23 Aug 2017 16:55:02 +0100 Subject: [PATCH 1/2] lib/remote: Add documentation for the class properties Signed-off-by: Philip Withnall --- lib/flatpak-remote.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/flatpak-remote.c b/lib/flatpak-remote.c index 2b70d4a6..403382a5 100644 --- a/lib/flatpak-remote.c +++ b/lib/flatpak-remote.c @@ -171,6 +171,14 @@ flatpak_remote_class_init (FlatpakRemoteClass *klass) object_class->set_property = flatpak_remote_set_property; object_class->finalize = flatpak_remote_finalize; + /** + * FlatpakRemote:name: + * + * Name of the remote, as used in configuration files and when interfacing + * with OSTree. This is typically human readable, but could be generated, and + * must conform to ostree_validate_remote_name(). It should typically not be + * presented in the UI. + */ g_object_class_install_property (object_class, PROP_NAME, g_param_spec_string ("name", @@ -179,6 +187,17 @@ flatpak_remote_class_init (FlatpakRemoteClass *klass) NULL, G_PARAM_READWRITE)); + /** + * FlatpakRemote:type: + * + * The type of the remote: whether it comes from static configuration files + * (@FLATPAK_REMOTE_TYPE_STATIC) or has been dynamically found from the local + * network or a mounted USB drive (@FLATPAK_REMOTE_TYPE_LAN, + * @FLATPAK_REMOTE_TYPE_USB). Dynamic remotes may be added and removed over + * time. + * + * Since: 0.9.8 + */ g_object_class_install_property (object_class, PROP_TYPE, g_param_spec_enum ("type", From 15df314ca4bf63083e8d6cdd85de24455a2bf4b7 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 23 Aug 2017 16:55:31 +0100 Subject: [PATCH 2/2] 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 --- lib/flatpak-remote.c | 19 +++++++++++++++++++ lib/test-lib.c | 3 ++- tests/testlibrary.c | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/flatpak-remote.c b/lib/flatpak-remote.c index 403382a5..03644266 100644 --- a/lib/flatpak-remote.c +++ b/lib/flatpak-remote.c @@ -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; +} diff --git a/lib/test-lib.c b/lib/test-lib.c index 84518fd2..38566bee 100644 --- a/lib/test-lib.c +++ b/lib/test-lib.c @@ -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, diff --git a/tests/testlibrary.c b/tests/testlibrary.c index 60bd167a..d409f62c 100644 --- a/tests/testlibrary.c +++ b/tests/testlibrary.c @@ -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));