[gnome-software/wip/kalev/gnome-3-22: 13/96] packagekit-local: Do not use the description first line as the summary



commit 574f5e55d36bc7be2e8a9d219802c43aff02421f
Author: Richard Hughes <richard hughsie com>
Date:   Wed Nov 9 09:59:15 2016 +0000

    packagekit-local: Do not use the description first line as the summary
    
    Just trust the data we get from PackageKit as it is likely going to be replaced
    with translated AppStream information anyway...

 src/gs-self-test.c                       |    2 +-
 src/plugins/gs-plugin-packagekit-local.c |   37 +----------------------------
 2 files changed, 3 insertions(+), 36 deletions(-)
---
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 1898052..c760aef 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -806,7 +806,7 @@ gs_plugin_loader_packagekit_local_func (GsPluginLoader *plugin_loader)
        g_assert_cmpstr (gs_app_get_summary (app), ==, "Single line synopsis");
        g_assert_cmpstr (gs_app_get_description (app), ==,
                         "This is the first paragraph in the example "
-                        "package spec file.  This is the second paragraph.");
+                        "package spec file.\n\nThis is the second paragraph.");
 }
 
 static void
diff --git a/src/plugins/gs-plugin-packagekit-local.c b/src/plugins/gs-plugin-packagekit-local.c
index 1a42913..e613dbe 100644
--- a/src/plugins/gs-plugin-packagekit-local.c
+++ b/src/plugins/gs-plugin-packagekit-local.c
@@ -76,39 +76,6 @@ gs_plugin_packagekit_progress_cb (PkProgress *progress,
        }
 }
 
-/*
- * gs_plugin_packagekit_refresh_set_text:
- *
- * The cases we have to deal with:
- *  - Single line text, so all to summary
- *  - Single line long text, so all to description
- *  - Multiple line text, so first line to summary and the rest to description
- */
-static void
-gs_plugin_packagekit_refresh_set_text (GsApp *app, const gchar *text)
-{
-       gchar *nl;
-       g_autofree gchar *tmp = NULL;
-
-       if (text == NULL || text[0] == '\0')
-               return;
-
-       /* look for newline */
-       tmp = g_strdup (text);
-       nl = g_strstr_len (tmp, -1, "\n");
-       if (nl == NULL) {
-               if (strlen (text) < 40) {
-                       gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, text);
-                       return;
-               }
-               gs_app_set_description (app, GS_APP_QUALITY_LOWEST, text);
-               return;
-       }
-       *nl = '\0';
-       gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, tmp);
-       gs_app_set_description (app, GS_APP_QUALITY_LOWEST, nl + 1);
-}
-
 static gboolean
 gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin,
                                           GsApp *app,
@@ -253,8 +220,8 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        gs_app_set_origin (app, basename);
        gs_app_add_source (app, split[PK_PACKAGE_ID_NAME]);
        gs_app_add_source_id (app, package_id);
-       gs_plugin_packagekit_refresh_set_text (app,
-                                              pk_details_get_description (item));
+       gs_app_set_description (app, GS_APP_QUALITY_LOWEST,
+                               pk_details_get_description (item));
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, pk_details_get_url (item));
        gs_app_set_size_installed (app, pk_details_get_size (item));
        gs_app_set_size_download (app, 0);


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