[Libosinfo] [libosinfo PATCH] tree: Add "os" property

Fabiano Fidêncio fidencio at redhat.com
Wed Jul 17 07:00:07 UTC 2019


ping!

On Fri, Jul 5, 2019 at 9:31 AM Fabiano Fidêncio <fidencio at redhat.com> wrote:
>
> Similarly to what we have for media, let's add the "os" property to the
> trees.
>
> osinfo-detect code is already relying on having an "os" property and,
> since commit 722e7d1d4, it errors out due to the missing property:
>
> (osinfo-detect:7808): GLib-GObject-WARNING **: 09:27:58.656: g_object_get_is_valid_property: object class 'OsinfoTree' has no property named 'os
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  osinfo/osinfo_tree.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
> index b797cb4..a11eee6 100644
> --- a/osinfo/osinfo_tree.c
> +++ b/osinfo/osinfo_tree.c
> @@ -112,6 +112,7 @@ enum {
>      PROP_INITRD_PATH,
>      PROP_BOOT_ISO_PATH,
>      PROP_HAS_TREEINFO,
> +    PROP_OS,
>  };
>
>  static void
> @@ -173,6 +174,10 @@ osinfo_tree_get_property(GObject *object,
>                              osinfo_tree_has_treeinfo(tree));
>          break;
>
> +    case PROP_OS:
> +        g_value_take_object(value, osinfo_tree_get_os(tree));
> +        break;
> +
>      default:
>          /* We don't have any other property... */
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
> @@ -250,6 +255,10 @@ osinfo_tree_set_property(GObject      *object,
>                                          g_value_get_boolean(value));
>          break;
>
> +    case PROP_OS:
> +        osinfo_tree_set_os(tree, g_value_get_object(value));
> +        break;
> +
>      default:
>          /* We don't have any other property... */
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
> @@ -415,6 +424,22 @@ osinfo_tree_class_init(OsinfoTreeClass *klass)
>                                  G_PARAM_READWRITE |
>                                  G_PARAM_STATIC_STRINGS);
>      g_object_class_install_property(g_klass, PROP_TREEINFO_FAMILY, pspec);
> +
> +    /**
> +     * OsinfoTree:os:
> +     *
> +     * Os information for the current tree. For tree stored in an
> +     * #OsinfoDB, it will be filled when the database is loaded, otherwise
> +     * the property will be filled after a successful call to
> +     * osinfo_db_identify_tree().
> +     */
> +    pspec = g_param_spec_object("os",
> +                                "Os",
> +                                _("Information about the operating system on this tree"),
> +                                OSINFO_TYPE_OS,
> +                                G_PARAM_READWRITE |
> +                                G_PARAM_STATIC_STRINGS);
> +    g_object_class_install_property(g_klass, PROP_OS, pspec);
>  }
>
>  static void
> --
> 2.21.0
>




More information about the Libosinfo mailing list