[gnome-packagekit] Always show the correct data for the source label



commit 10e536e45cb13f3d8c2f25edc0e5fe5e3cbe5a75
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jul 19 12:10:46 2016 +0100

    Always show the correct data for the source label
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=768945

 src/gpk-application.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/src/gpk-application.c b/src/gpk-application.c
index ab07ab2..eee222e 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -962,6 +962,10 @@ gpk_application_get_full_repo_name (GpkApplicationPrivate *priv, const gchar *da
                return _("Invalid");
        }
 
+       /* trim prefix */
+       if (g_str_has_prefix (data, "installed:"))
+               data += 10;
+
        /* try to find in cached repo array */
        repo_name = (const gchar *) g_hash_table_lookup (priv->repos, data);
        if (repo_name == NULL) {
@@ -1903,21 +1907,11 @@ gpk_application_get_details_cb (PkClient *client, GAsyncResult *res, GpkApplicat
                gtk_widget_hide (widget);
        }
 
-       /* set the repo text, or hide if installed */
-       if (!installed && g_strcmp0 (split[PK_PACKAGE_ID_DATA], "meta") != 0) {
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_source_title"));
-               gtk_widget_show (widget);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_source"));
-               /* get the full name of the repo from the repo_id */
-               repo_name = gpk_application_get_full_repo_name (priv, split[PK_PACKAGE_ID_DATA]);
-               gtk_label_set_label (GTK_LABEL (widget), repo_name);
-               gtk_widget_show (widget);
-       } else {
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_source_title"));
-               gtk_widget_hide (widget);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_source"));
-               gtk_widget_hide (widget);
-       }
+       /* set the repo text */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_source"));
+       /* get the full name of the repo from the repo_id */
+       repo_name = gpk_application_get_full_repo_name (priv, split[PK_PACKAGE_ID_DATA]);
+       gtk_label_set_label (GTK_LABEL (widget), repo_name);
 }
 
 static void


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