[gnome-software] Fix warning when browsing some installed shell extensions



commit aaeed0ff5fa61379906ac58d2bf82f3deeebf259
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 2 11:30:56 2016 +0000

    Fix warning when browsing some installed shell extensions
    
    Look for shell extension versions when the it is specified as only major.minor

 src/plugins/gs-plugin-shell-extensions.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index 7489b30..a57d85c 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -356,14 +356,29 @@ gs_plugin_shell_extensions_parse_version (GsPlugin *plugin,
        g_autofree gchar *shell_version = NULL;
        g_autoptr(AsRelease) release = NULL;
 
-       /* look for version, FIXME: either major.minor or major.minor.micro */
+       /* look for version, major.minor.micro */
        if (json_object_has_member (ver_map, plugin->priv->shell_version)) {
                json_ver = json_object_get_object_member (ver_map,
                                                          plugin->priv->shell_version);
        }
+
+       /* look for version, major.minor */
+       if (json_ver == NULL) {
+               g_auto(GStrv) ver_majmin = NULL;
+               ver_majmin = g_strsplit (plugin->priv->shell_version, ".", -1);
+               if (g_strv_length (ver_majmin) >= 2) {
+                       g_autofree gchar *tmp = NULL;
+                       tmp = g_strdup_printf ("%s.%s", ver_majmin[0], ver_majmin[1]);
+                       if (json_object_has_member (ver_map, tmp))
+                               json_ver = json_object_get_object_member (ver_map, tmp);
+               }
+       }
+
+       /* FIXME: mark as incompatible? */
        if (json_ver == NULL) {
-               g_warning ("no shell_version_map for %s",
-                          plugin->priv->shell_version);
+               g_debug ("no version_map for %s: %s",
+                        as_app_get_id (app),
+                        plugin->priv->shell_version);
                return TRUE;
        }
 


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