[gnome-software] snap: Use title field if available



commit 7f1c0853910d8d128ba04545e6d9cf7568ef7339
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Jul 6 17:02:44 2017 +1200

    snap: Use title field if available

 meson.build                   |    2 +-
 plugins/snap/gs-plugin-snap.c |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index ee6ebe3..1acb878 100644
--- a/meson.build
+++ b/meson.build
@@ -164,7 +164,7 @@ if get_option('enable-gudev')
 endif
 
 if get_option('enable-snap')
-  snap = dependency('snapd-glib', version : '>= 1.11')
+  snap = dependency('snapd-glib', version : '>= 1.14')
 endif
 
 gnome = import('gnome')
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 8c7b816..741e3dc 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -202,7 +202,6 @@ snap_to_app (GsPlugin *plugin, SnapdSnap *snap)
        gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_SNAP);
        gs_app_set_management_plugin (app, "snap");
        gs_app_add_quirk (app, AS_APP_QUIRK_NOT_REVIEWABLE);
-       gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, snapd_snap_get_name (snap));
        if (gs_plugin_check_distro_id (plugin, "ubuntu"))
                gs_app_add_quirk (app, AS_APP_QUIRK_PROVENANCE);
        if (snapd_snap_get_confinement (snap) == SNAPD_CONFINEMENT_STRICT)
@@ -451,11 +450,14 @@ gs_plugin_refine_app (GsPlugin *plugin,
        local_snap = snapd_client_list_one_sync (client, id, cancellable, NULL);
        if (local_snap != NULL) {
                GPtrArray *apps;
-               const gchar *launch_name = NULL;
+               const gchar *name, *launch_name = NULL;
 
                if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN)
                        gs_app_set_state (app, AS_APP_STATE_INSTALLED);
-               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_name (local_snap));
+               name = snapd_snap_get_title (local_snap);
+               if (name == NULL || g_strcmp0 (name, "") == 0)
+                       name = snapd_snap_get_name (local_snap);
+               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, name);
                gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_summary (local_snap));
                gs_app_set_description (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_description (local_snap));
                gs_app_set_version (app, snapd_snap_get_version (local_snap));
@@ -479,12 +481,15 @@ gs_plugin_refine_app (GsPlugin *plugin,
        store_snap = get_store_snap (plugin, id, cancellable, NULL);
        if (store_snap != NULL) {
                GPtrArray *screenshots;
-               const gchar *screenshot_url = NULL;
+               const gchar *name, *screenshot_url = NULL;
 
                if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN)
                        gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
 
-               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_name (store_snap));
+               name = snapd_snap_get_title (store_snap);
+               if (name == NULL || g_strcmp0 (name, "") == 0)
+                       name = snapd_snap_get_name (store_snap);
+               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, name);
                gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_summary (store_snap));
                gs_app_set_description (app, GS_APP_QUALITY_NORMAL, snapd_snap_get_description (store_snap));
                gs_app_set_version (app, snapd_snap_get_version (store_snap));


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