[gnome-software] repos plugin: Store repo url in GsApp homepage url metadata



commit c5429ac56f2a18f6d3f63f7fdecb062f26a77c0f
Author: Kalev Lember <klember redhat com>
Date:   Wed Feb 14 22:11:15 2018 +0100

    repos plugin: Store repo url in GsApp homepage url metadata
    
    Similar to what the fwupd plugin does.

 plugins/repos/gs-plugin-repos.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/plugins/repos/gs-plugin-repos.c b/plugins/repos/gs-plugin-repos.c
index 468a6f3d..ae422487 100644
--- a/plugins/repos/gs-plugin-repos.c
+++ b/plugins/repos/gs-plugin-repos.c
@@ -187,11 +187,22 @@ gs_plugin_refine_app (GsPlugin *plugin,
                return FALSE;
 
        /* find hostname */
-       if (gs_app_get_origin (app) == NULL)
-               return TRUE;
-       tmp = g_hash_table_lookup (priv->urls, gs_app_get_origin (app));
-       if (tmp != NULL)
-               gs_app_set_origin_hostname (app, tmp);
+       switch (gs_app_get_kind (app)) {
+       case AS_APP_KIND_SOURCE:
+               if (gs_app_get_id (app) == NULL)
+                       return TRUE;
+               tmp = g_hash_table_lookup (priv->urls, gs_app_get_id (app));
+               if (tmp != NULL)
+                       gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, tmp);
+               break;
+       default:
+               if (gs_app_get_origin (app) == NULL)
+                       return TRUE;
+               tmp = g_hash_table_lookup (priv->urls, gs_app_get_origin (app));
+               if (tmp != NULL)
+                       gs_app_set_origin_hostname (app, tmp);
+               break;
+       }
 
        return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]