[gnome-software] details: Show the filename for local package installation



commit 5b14c4c5407bbc25f895ec67cba07d6f92efe5ef
Author: Kalev Lember <kalevlember gmail com>
Date:   Fri Feb 21 17:26:25 2014 +0100

    details: Show the filename for local package installation
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724669

 src/gs-shell-details.c                     |    6 ++++--
 src/plugins/gs-plugin-packagekit-refresh.c |    5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 8d7f6a0..2748c9f 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -655,11 +655,13 @@ gs_shell_details_refresh_all (GsShellDetails *shell_details)
                gtk_label_set_label (GTK_LABEL (widget), tmp);
        }
        gtk_widget_set_visible (widget,
-                               gs_app_get_state (priv->app) == GS_APP_STATE_INSTALLED);
+                               gs_app_get_state (priv->app) == GS_APP_STATE_INSTALLED ||
+                               gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
                                                     "label_details_origin_title"));
        gtk_widget_set_visible (widget,
-                               gs_app_get_state (priv->app) == GS_APP_STATE_INSTALLED);
+                               gs_app_get_state (priv->app) == GS_APP_STATE_INSTALLED ||
+                               gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL);
 
        /* set the rating */
        switch (gs_app_get_id_kind (priv->app)) {
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 08c4efb..a16a960 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -205,6 +205,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
 {
        const gchar *package_id;
        gboolean ret = TRUE;
+       gchar *basename = NULL;
        gchar **files;
        gchar **split = NULL;
        GPtrArray *array = NULL;
@@ -257,12 +258,14 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
        app = gs_app_new (NULL);
        package_id = pk_details_get_package_id (item);
        split = pk_package_id_split (package_id);
+       basename = g_path_get_basename (filename);
        gs_app_set_management_plugin (app, "PackageKit");
        gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
        gs_app_set_state (app, GS_APP_STATE_LOCAL);
        gs_app_set_name (app, GS_APP_QUALITY_LOWEST, split[PK_PACKAGE_ID_NAME]);
        gs_app_set_version (app, split[PK_PACKAGE_ID_VERSION]);
        gs_app_set_metadata (app, "PackageKit::local-filename", filename);
+       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,
@@ -276,6 +279,8 @@ out:
                g_object_unref (app);
        if (array != NULL)
                g_ptr_array_unref (array);
+       if (basename != NULL)
+               g_free (basename);
        g_strfreev (split);
        g_strfreev (files);
        return ret;


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