[gnome-software] Do not use metadata to share the desktop filename
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not use metadata to share the desktop filename
- Date: Thu, 14 Jan 2016 17:39:42 +0000 (UTC)
commit ba87fc30720bbc49cb66caa2c28b97132eae9b41
Author: Richard Hughes <richard hughsie com>
Date: Thu Jan 14 13:53:18 2016 +0000
Do not use metadata to share the desktop filename
I'm trying to phase out the use of GsApp metadata and have less complexity.
src/gs-shell-details.c | 16 +---------------
src/plugins/appstream-common.c | 16 ----------------
src/plugins/gs-plugin-fwupd.c | 2 --
src/plugins/gs-plugin-packagekit-refine.c | 23 ++++++++++++++++++-----
4 files changed, 19 insertions(+), 38 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index a360701..bf50137 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -609,21 +609,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
gs_shell_details_set_description (self, tmp);
/* set the icon */
- tmp = gs_app_get_metadata_item (self->app, "DataDir::desktop-icon");
- if (tmp != NULL) {
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- tmp, 96,
- GTK_ICON_LOOKUP_USE_BUILTIN |
- GTK_ICON_LOOKUP_FORCE_SIZE,
- &error);
- if (pixbuf == NULL) {
- g_warning ("Failed to load desktop icon: %s",
- error->message);
- g_clear_error (&error);
- }
- }
- if (pixbuf == NULL)
- pixbuf = gs_app_get_pixbuf (self->app);
+ pixbuf = gs_app_get_pixbuf (self->app);
if (pixbuf != NULL) {
gs_image_set_from_pixbuf (GTK_IMAGE (self->application_details_icon), pixbuf);
gtk_widget_set_visible (self->application_details_icon, TRUE);
diff --git a/src/plugins/appstream-common.c b/src/plugins/appstream-common.c
index 95f21cc..194bf34 100644
--- a/src/plugins/appstream-common.c
+++ b/src/plugins/appstream-common.c
@@ -311,22 +311,6 @@ gs_appstream_refine_app (GsPlugin *plugin, GsApp *app, AsApp *item, GError **err
}
}
- /* allow the PackageKit plugin to match up installed local files
- * with packages when the component isn't in the AppStream XML */
- switch (as_app_get_source_kind (item)) {
- case AS_APP_SOURCE_KIND_DESKTOP:
- case AS_APP_SOURCE_KIND_APPDATA:
- case AS_APP_SOURCE_KIND_METAINFO:
- if (as_app_get_source_file (item) != NULL &&
- gs_app_get_metadata_item (app, "DataDir::desktop-filename") == NULL) {
- gs_app_set_metadata (app, "DataDir::desktop-filename",
- as_app_get_source_file (item));
- }
- break;
- default:
- break;
- }
-
/* set id */
if (as_app_get_id (item) != NULL && gs_app_get_id (app) == NULL)
gs_app_set_id (app, as_app_get_id (item));
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 0d9fad8..fe5a38b 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -363,7 +363,6 @@ gs_plugin_add_update_app (GsPlugin *plugin,
gs_app_add_category (app, "System");
gs_app_set_kind (app, GS_APP_KIND_FIRMWARE_UPDATE);
gs_app_set_metadata (app, "fwupd::DeviceID", id);
- gs_app_set_metadata (app, "DataDir::desktop-icon", "application-x-firmware");
gs_plugin_add_app (list, app);
/* create icon */
@@ -1065,7 +1064,6 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
/* get results */
app = gs_app_new (NULL);
- gs_app_set_metadata (app, "DataDir::desktop-icon", "application-x-firmware");
gs_app_set_id_kind (app, AS_ID_KIND_FIRMWARE);
gs_app_set_management_plugin (app, "fwupd");
gs_app_set_kind (app, GS_APP_KIND_FIRMWARE_UPDATE);
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 00c0d1c..69091d6 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -975,23 +975,36 @@ gs_plugin_refine (GsPlugin *plugin,
/* set the package-id for an installed desktop file */
ptask = as_profile_start_literal (plugin->profile,
- "packagekit-refine[desktop-filename->id]");
+ "packagekit-refine[installed-filename->id]");
for (l = *list; l != NULL; l = l->next) {
+ g_autofree gchar *fn = NULL;
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION) == 0)
continue;
app = GS_APP (l->data);
if (gs_app_get_source_id_default (app) != NULL)
continue;
- tmp = gs_app_get_metadata_item (app, "DataDir::desktop-filename");
+ tmp = gs_app_get_id (app);
if (tmp == NULL)
continue;
- if (!g_str_has_prefix (tmp, "/usr/share/")) {
- g_debug ("ignoring %s due to prefix", tmp);
+ switch (gs_app_get_id_kind (app)) {
+ case AS_ID_KIND_DESKTOP:
+ fn = g_strdup_printf ("/usr/share/applications/%s", tmp);
+ break;
+ case AS_ID_KIND_ADDON:
+ fn = g_strdup_printf ("/usr/share/appdata/%s.metainfo.xml", tmp);
+ break;
+ default:
+ break;
+ }
+ if (fn == NULL)
+ continue;
+ if (!g_file_test (fn, G_FILE_TEST_EXISTS)) {
+ g_debug ("ignoring %s as does not exist", fn);
continue;
}
ret = gs_plugin_packagekit_refine_from_desktop (plugin,
app,
- tmp,
+ fn,
cancellable,
error);
if (!ret)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]