[Libosinfo] [PATCH 2/2] db: _identify_media() should also set media ID

Michal Privoznik mprivozn at redhat.com
Sat Dec 29 13:17:23 UTC 2012


On 29.12.2012 01:30, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> For the new _identify_media() method to be able to easily replace
> _db_guess_os_from_media() usage in apps as it intends to, it must
> provide the ID of the media in the DB.
> 
> This fixes a recent regression in Boxes caused by switching to
> _identify_media():
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=685826#c35 (and following
> comments)
> ---
>  osinfo/osinfo_db.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
> index e3f6f45..adf2737 100644
> --- a/osinfo/osinfo_db.c
> +++ b/osinfo/osinfo_db.c
> @@ -624,6 +624,7 @@ static void fill_media (OsinfoDb *db, OsinfoMedia *media,
>      gboolean is_installer;
>      gboolean is_live;
>      gint reboots;
> +    const gchar *id;
>      const gchar *kernel_path;
>      const gchar *initrd_path;
>      const gchar *arch;
> @@ -634,6 +635,9 @@ static void fill_media (OsinfoDb *db, OsinfoMedia *media,
>          osinfo_media_set_languages(media, languages);
>      g_list_free(languages);
>  
> +    id = osinfo_entity_get_id(OSINFO_ENTITY(matched_media));
> +    g_object_set(G_OBJECT(media), "id", id, NULL);
> +
>      arch = osinfo_media_get_architecture(matched_media);
>      if (arch != NULL)
>          g_object_set(G_OBJECT(media), "architecture", arch, NULL);
> @@ -670,9 +674,9 @@ static void fill_media (OsinfoDb *db, OsinfoMedia *media,
>   *
>   * Try to match a newly created @media with a media description from @db.
>   * If found, @media will be filled with the corresponding information
> - * stored in @db. In particular, after a call to
> - * osinfo_db_identify_media(), if the media could be identified, its
> - * OsinfoMedia::os property will be set.
> + * stored in @db. In particular, after a call to osinfo_db_identify_media(), if
> + * the media could be identified, its OsinfoEntify::id and OsinfoMedia::os
> + * properties will be set.
>   *
>   * Returns: TRUE if @media was found in @db, FALSE otherwise
>   */
> 

ACK series

Michal




More information about the Libosinfo mailing list