[gnome-software] Only run the plugin actions if the management plugin matches the plugin name
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Only run the plugin actions if the management plugin matches the plugin name
- Date: Thu, 24 Mar 2016 09:41:41 +0000 (UTC)
commit 57d718f7dd2f130bb8043eaee4683b4d6226c1b0
Author: Richard Hughes <richard hughsie com>
Date: Wed Mar 23 12:39:12 2016 +0000
Only run the plugin actions if the management plugin matches the plugin name
This allows us to remove a lot of code, but does means we have to rename quite
a few places to match the lowercases plugin names.
src/gs-plugin-loader.c | 19 +++++++++++
src/plugins/gs-appstream.c | 6 ++--
src/plugins/gs-plugin-epiphany.c | 19 +----------
src/plugins/gs-plugin-packagekit-offline.c | 2 +-
src/plugins/gs-plugin-packagekit-origin.c | 2 +-
src/plugins/gs-plugin-packagekit-refine.c | 10 +++---
src/plugins/gs-plugin-packagekit-refresh.c | 4 +-
src/plugins/gs-plugin-packagekit.c | 29 ++---------------
src/plugins/gs-plugin-shell-extensions.c | 34 +++++++------------
src/plugins/gs-plugin-steam.c | 18 ++---------
src/plugins/gs-plugin-xdg-app.c | 48 +++++++++++----------------
11 files changed, 72 insertions(+), 119 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index e18b0e0..292c8a9 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -549,11 +549,15 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
GsPluginActionFunc plugin_func = NULL;
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
GsPlugin *plugin;
+ const gchar *management_plugin;
gboolean anything_ran = FALSE;
gboolean exists;
gboolean ret;
guint i;
+ /* don't force each plugin to check this */
+ management_plugin = gs_app_get_management_plugin (app);
+
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
g_autoptr(AsProfileTask) ptask = NULL;
@@ -569,6 +573,14 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
(gpointer *) &plugin_func);
if (!exists)
continue;
+
+ /* only run method for the correct management plugin */
+ if (g_strcmp0 (management_plugin, plugin->name) != 0) {
+ g_debug ("skipping %s:%s as invalid (%s)",
+ plugin->name, function_name, management_plugin);
+ continue;
+ }
+
ptask = as_profile_start (priv->profile,
"GsPlugin::%s(%s)",
plugin->name,
@@ -584,6 +596,13 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
}
+ /* fall back to generic helper */
+ if (!anything_ran &&
+ g_strcmp0 (function_name, "gs_plugin_launch") == 0) {
+ g_debug ("using launch helper for %s", gs_app_get_id (app));
+ return gs_plugin_app_launch (NULL, app, error);
+ }
+
/* nothing ran */
if (!anything_ran) {
g_set_error (error,
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index d7132d1..d5ca7f0 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -331,7 +331,7 @@ gs_refine_item_management_plugin (GsApp *app, AsApp *item)
for (i = 0; i < bundles->len; i++) {
AsBundle *bundle = g_ptr_array_index (bundles, i);
if (as_bundle_get_kind (bundle) == AS_BUNDLE_KIND_XDG_APP) {
- management_plugin = "XgdApp";
+ management_plugin = "xdg-app";
gs_app_add_source (app, as_bundle_get_id (bundle));
/* automatically add runtime */
@@ -348,7 +348,7 @@ gs_refine_item_management_plugin (GsApp *app, AsApp *item)
break;
}
if (as_bundle_get_kind (bundle) == AS_BUNDLE_KIND_LIMBA) {
- management_plugin = "Limba";
+ management_plugin = "limba";
gs_app_add_source (app, as_bundle_get_id (bundle));
break;
}
@@ -357,7 +357,7 @@ gs_refine_item_management_plugin (GsApp *app, AsApp *item)
/* fall back to PackageKit */
if (management_plugin == NULL &&
as_app_get_pkgname_default (item) != NULL)
- management_plugin = "PackageKit";
+ management_plugin = "packagekit";
if (management_plugin != NULL)
gs_app_set_management_plugin (app, management_plugin);
}
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index cda1a62..74bcacd 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -234,7 +234,7 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
g_autoptr(GFile) file_app = NULL;
/* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "Epiphany") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "epiphany") != 0)
return TRUE;
epi_desktop = gs_app_get_source_id_default (app);
if (epi_desktop == NULL)
@@ -291,24 +291,9 @@ gs_plugin_refine_app (GsPlugin *plugin,
if (g_file_test (fn, G_FILE_TEST_EXISTS)) {
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_add_source_id (app, fn);
- gs_app_set_management_plugin (app, "Epiphany");
+ gs_app_set_management_plugin (app, "epiphany");
return TRUE;
}
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
return TRUE;
}
-
-/**
- * gs_plugin_launch:
- */
-gboolean
-gs_plugin_launch (GsPlugin *plugin,
- GsApp *app,
- GCancellable *cancellable,
- GError **error)
-{
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "Epiphany") != 0)
- return TRUE;
- return gs_plugin_app_launch (plugin, app, error);
-}
diff --git a/src/plugins/gs-plugin-packagekit-offline.c b/src/plugins/gs-plugin-packagekit-offline.c
index ea5c62d..dc46087 100644
--- a/src/plugins/gs-plugin-packagekit-offline.c
+++ b/src/plugins/gs-plugin-packagekit-offline.c
@@ -193,7 +193,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
split = g_strsplit (package_ids[i], ";", 4);
gs_app_add_source (app, split[0]);
gs_app_set_update_version (app, split[1]);
- gs_app_set_management_plugin (app, "PackageKit");
+ gs_app_set_management_plugin (app, "packagekit");
gs_app_add_source_id (app, package_ids[i]);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
diff --git a/src/plugins/gs-plugin-packagekit-origin.c b/src/plugins/gs-plugin-packagekit-origin.c
index 56c601f..ea9abd3 100644
--- a/src/plugins/gs-plugin-packagekit-origin.c
+++ b/src/plugins/gs-plugin-packagekit-origin.c
@@ -143,7 +143,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN) == 0)
return TRUE;
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
return TRUE;
if (gs_app_get_origin (app) == NULL)
return TRUE;
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 61c9b70..714c340 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -155,7 +155,7 @@ gs_plugin_packagekit_set_metadata_from_package (GsPlugin *plugin,
{
const gchar *data;
- gs_app_set_management_plugin (app, "PackageKit");
+ gs_app_set_management_plugin (app, "packagekit");
gs_app_add_source (app, pk_package_get_name (package));
gs_app_add_source_id (app, pk_package_get_id (package));
switch (pk_package_get_info (package)) {
@@ -314,7 +314,7 @@ gs_plugin_packagekit_resolve_packages (GsPlugin *plugin,
packages = pk_results_get_package_array (results);
for (l = list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_metadata_item (app, "PackageKit::local-filename") != NULL)
+ if (gs_app_get_metadata_item (app, "packagekit::local-filename") != NULL)
continue;
gs_plugin_packagekit_resolve_packages_app (plugin, packages, app);
}
@@ -663,7 +663,7 @@ gs_plugin_refine_require_details (GsPlugin *plugin,
app = GS_APP (l->data);
if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
continue;
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
continue;
if (gs_app_get_source_id_default (app) == NULL)
continue;
@@ -835,7 +835,7 @@ gs_plugin_refine (GsPlugin *plugin,
app = GS_APP (l->data);
if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
continue;
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
continue;
sources = gs_app_get_sources (app);
if (sources->len == 0)
@@ -903,7 +903,7 @@ gs_plugin_refine (GsPlugin *plugin,
app = GS_APP (l->data);
if (gs_app_get_state (app) != AS_APP_STATE_UPDATABLE)
continue;
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
continue;
if (gs_plugin_refine_requires_update_details (app, flags))
updatedetails_all = g_list_prepend (updatedetails_all, app);
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 722f8ff..2b1bd92 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -363,7 +363,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
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_management_plugin (app, "packagekit");
gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE_LOCAL);
if (pk_details_get_summary (item))
@@ -372,7 +372,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
else
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_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);
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 8bbe1e5..9a9699b 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -264,7 +264,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
rd = g_ptr_array_index (array, i);
id = pk_repo_detail_get_id (rd);
app = gs_app_new (id);
- gs_app_set_management_plugin (app, "PackageKit");
+ gs_app_set_management_plugin (app, "packagekit");
gs_app_set_kind (app, AS_APP_KIND_SOURCE);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_name (app,
@@ -334,10 +334,6 @@ gs_plugin_app_install (GsPlugin *plugin,
data.plugin = plugin;
data.ptask = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
- return TRUE;
-
/* we enable the repo */
if (gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
@@ -434,7 +430,7 @@ gs_plugin_app_install (GsPlugin *plugin,
return FALSE;
break;
case AS_APP_STATE_AVAILABLE_LOCAL:
- package_id = gs_app_get_metadata_item (app, "PackageKit::local-filename");
+ package_id = gs_app_get_metadata_item (app, "packagekit::local-filename");
if (package_id == NULL) {
g_set_error_literal (error,
GS_PLUGIN_ERROR,
@@ -453,7 +449,7 @@ gs_plugin_app_install (GsPlugin *plugin,
return FALSE;
/* get the new icon from the package */
- gs_app_set_metadata (app, "PackageKit::local-filename", NULL);
+ gs_app_set_metadata (app, "packagekit::local-filename", NULL);
gs_app_set_icon (app, NULL);
gs_app_set_pixbuf (app, NULL);
break;
@@ -568,10 +564,6 @@ gs_plugin_app_remove (GsPlugin *plugin,
data.plugin = plugin;
data.ptask = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
- return TRUE;
-
/* remove repo and all apps in it */
if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE) {
return gs_plugin_app_source_remove (plugin, app,
@@ -739,18 +731,3 @@ gs_plugin_add_search_what_provides (GsPlugin *plugin,
/* add results */
return gs_plugin_packagekit_add_results (plugin, list, results, error);
}
-
-/**
- * gs_plugin_launch:
- */
-gboolean
-gs_plugin_launch (GsPlugin *plugin,
- GsApp *app,
- GCancellable *cancellable,
- GError **error)
-{
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
- return TRUE;
- return gs_plugin_app_launch (plugin, app, error);
-}
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index 609b1ab..1029bc4 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -121,8 +121,8 @@ gs_plugin_shell_extensions_add_app (const gchar *uuid,
id = gs_plugin_shell_extensions_id_from_uuid (uuid);
id_prefix = g_strdup_printf ("user:%s", id);
app = gs_app_new (id_prefix);
- gs_app_set_management_plugin (app, "ShellExtensions");
- gs_app_set_metadata (app, "ShellExtensions::uuid", uuid);
+ gs_app_set_management_plugin (app, "shell-extensions");
+ gs_app_set_metadata (app, "shell-extensions::uuid", uuid);
gs_app_set_kind (app, AS_APP_KIND_SHELL_EXTENSION);
gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "GPL-2.0+");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "GNOME Shell Extension");
@@ -194,17 +194,17 @@ gs_plugin_shell_extensions_add_app (const gchar *uuid,
}
if (g_strcmp0 (str, "hasPrefs") == 0) {
if (g_variant_get_boolean (val))
- gs_app_set_metadata (app, "ShellExtensions::has-prefs", "");
+ gs_app_set_metadata (app, "shell-extensions::has-prefs", "");
continue;
}
if (g_strcmp0 (str, "extension-id") == 0) {
tmp = g_variant_get_string (val, NULL);
- gs_app_set_metadata (app, "ShellExtensions::extension-id", tmp);
+ gs_app_set_metadata (app, "shell-extensions::extension-id", tmp);
continue;
}
if (g_strcmp0 (str, "path") == 0) {
tmp = g_variant_get_string (val, NULL);
- gs_app_set_metadata (app, "ShellExtensions::path", tmp);
+ gs_app_set_metadata (app, "shell-extensions::path", tmp);
continue;
}
}
@@ -217,7 +217,7 @@ gs_plugin_shell_extensions_add_app (const gchar *uuid,
/* add categories */
gs_app_add_category (app, "Addons");
- gs_app_add_category (app, "ShellExtensions");
+ gs_app_add_category (app, "shell-extensions");
return g_steal_pointer (&app);
}
@@ -312,7 +312,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
/* adopt any here */
if (gs_app_get_management_plugin (app) == NULL)
- gs_app_set_management_plugin (app, "ShellExtensions");
+ gs_app_set_management_plugin (app, "shell-extensions");
/* assume apps are available if they exist in AppStream metadata */
if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN)
@@ -416,7 +416,7 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
g_autofree gchar *id = NULL;
id = gs_plugin_shell_extensions_id_from_uuid (tmp);
as_app_set_id (app, id);
- as_app_add_metadata (app, "ShellExtensions::uuid", tmp);
+ as_app_add_metadata (app, "shell-extensions::uuid", tmp);
}
tmp = json_object_get_string_member (json_app, "link");
if (tmp != NULL) {
@@ -473,11 +473,11 @@ gs_plugin_shell_extensions_parse_app (GsPlugin *plugin,
/* required to match categories in gnome-software */
as_app_add_category (app, "Addons");
- as_app_add_category (app, "ShellExtensions");
+ as_app_add_category (app, "shell-extensions");
/* we have no data :/ */
as_app_set_comment (app, NULL, "GNOME Shell Extension");
- as_app_add_metadata (app, "ManagementPlugin", "ShellExtensions");
+ as_app_add_metadata (app, "ManagementPlugin", "shell-extensions");
return app;
}
@@ -713,16 +713,12 @@ gs_plugin_app_remove (GsPlugin *plugin,
gboolean ret;
g_autoptr(GVariant) retval = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "ShellExtensions") != 0)
- return TRUE;
-
/* connect to gnome-shell */
if (!gs_plugin_setup (plugin, cancellable, error))
return FALSE;
/* install */
- uuid = gs_app_get_metadata_item (app, "ShellExtensions::uuid");
+ uuid = gs_app_get_metadata_item (app, "shell-extensions::uuid");
retval = g_dbus_proxy_call_sync (plugin->priv->proxy,
"UninstallExtension",
g_variant_new ("(s)", uuid),
@@ -760,16 +756,12 @@ gs_plugin_app_install (GsPlugin *plugin,
const gchar *retstr;
g_autoptr(GVariant) retval = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "ShellExtensions") != 0)
- return TRUE;
-
/* connect to gnome-shell */
if (!gs_plugin_setup (plugin, cancellable, error))
return FALSE;
/* install */
- uuid = gs_app_get_metadata_item (app, "ShellExtensions::uuid");
+ uuid = gs_app_get_metadata_item (app, "shell-extensions::uuid");
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
retval = g_dbus_proxy_call_sync (plugin->priv->proxy,
"InstallRemoteExtension",
@@ -816,7 +808,7 @@ gs_plugin_launch (GsPlugin *plugin,
return FALSE;
/* install */
- uuid = gs_app_get_metadata_item (app, "ShellExtensions::uuid");
+ uuid = gs_app_get_metadata_item (app, "shell-extensions::uuid");
if (uuid == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
diff --git a/src/plugins/gs-plugin-steam.c b/src/plugins/gs-plugin-steam.c
index 46f0494..e3c6f06 100644
--- a/src/plugins/gs-plugin-steam.c
+++ b/src/plugins/gs-plugin-steam.c
@@ -957,13 +957,9 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
const gchar *gameid;
g_autofree gchar *cmdline = NULL;
- /* check is us */
- gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
- if (gameid == NULL)
- return TRUE;
-
/* this is async as steam is a different process: FIXME: use D-Bus */
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+ gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
cmdline = g_strdup_printf ("steam steam://install/%s", gameid);
return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
}
@@ -978,13 +974,9 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
const gchar *gameid;
g_autofree gchar *cmdline = NULL;
- /* check is us */
- gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
- if (gameid == NULL)
- return TRUE;
-
/* this is async as steam is a different process: FIXME: use D-Bus */
gs_app_set_state (app, AS_APP_STATE_REMOVING);
+ gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
cmdline = g_strdup_printf ("steam steam://uninstall/%s", gameid);
return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
}
@@ -999,12 +991,8 @@ gs_plugin_launch (GsPlugin *plugin, GsApp *app,
const gchar *gameid;
g_autofree gchar *cmdline = NULL;
- /* check is us */
- gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
- if (gameid == NULL)
- return TRUE;
-
/* this is async as steam is a different process: FIXME: use D-Bus */
+ gameid = gs_app_get_metadata_item (app, "X-Steam-GameID");
cmdline = g_strdup_printf ("steam steam://run/%s", gameid);
return g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, error);
}
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index ac3b9a3..5c5d729 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -21,8 +21,8 @@
/* Notes:
*
- * All GsApp's created have management-plugin set to XgdApp
- * Some GsApp's created have have XgdApp::kind of app or runtime
+ * All GsApp's created have management-plugin set to xdg-app
+ * Some GsApp's created have have xdg-app::kind of app or runtime
* The GsApp:origin is the remote name, e.g. test-repo
*
* Some outstanding notes:
@@ -93,15 +93,15 @@ gs_plugin_destroy (GsPlugin *plugin)
}
/* helpers */
-#define gs_app_get_xdgapp_kind_as_str(app) gs_app_get_metadata_item(app,"XgdApp::kind")
-#define gs_app_get_xdgapp_name(app) gs_app_get_metadata_item(app,"XgdApp::name")
-#define gs_app_get_xdgapp_arch(app) gs_app_get_metadata_item(app,"XgdApp::arch")
-#define gs_app_get_xdgapp_branch(app) gs_app_get_metadata_item(app,"XgdApp::branch")
-#define gs_app_get_xdgapp_commit(app) gs_app_get_metadata_item(app,"XgdApp::commit")
-#define gs_app_set_xdgapp_name(app,val) gs_app_set_metadata(app,"XgdApp::name",val)
-#define gs_app_set_xdgapp_arch(app,val) gs_app_set_metadata(app,"XgdApp::arch",val)
-#define gs_app_set_xdgapp_branch(app,val) gs_app_set_metadata(app,"XgdApp::branch",val)
-#define gs_app_set_xdgapp_commit(app,val) gs_app_set_metadata(app,"XgdApp::commit",val)
+#define gs_app_get_xdgapp_kind_as_str(app) gs_app_get_metadata_item(app,"xdg-app::kind")
+#define gs_app_get_xdgapp_name(app) gs_app_get_metadata_item(app,"xdg-app::name")
+#define gs_app_get_xdgapp_arch(app) gs_app_get_metadata_item(app,"xdg-app::arch")
+#define gs_app_get_xdgapp_branch(app) gs_app_get_metadata_item(app,"xdg-app::branch")
+#define gs_app_get_xdgapp_commit(app) gs_app_get_metadata_item(app,"xdg-app::commit")
+#define gs_app_set_xdgapp_name(app,val) gs_app_set_metadata(app,"xdg-app::name",val)
+#define gs_app_set_xdgapp_arch(app,val) gs_app_set_metadata(app,"xdg-app::arch",val)
+#define gs_app_set_xdgapp_branch(app,val) gs_app_set_metadata(app,"xdg-app::branch",val)
+#define gs_app_set_xdgapp_commit(app,val) gs_app_set_metadata(app,"xdg-app::commit",val)
/**
* gs_app_get_xdgapp_kind:
@@ -109,7 +109,7 @@ gs_plugin_destroy (GsPlugin *plugin)
static XdgAppRefKind
gs_app_get_xdgapp_kind (GsApp *app)
{
- const gchar *kind = gs_app_get_metadata_item (app, "XgdApp::kind");
+ const gchar *kind = gs_app_get_metadata_item (app, "xdg-app::kind");
if (g_strcmp0 (kind, "app") == 0)
return XDG_APP_REF_KIND_APP;
if (g_strcmp0 (kind, "runtime") == 0)
@@ -125,9 +125,9 @@ static void
gs_app_set_xdgapp_kind (GsApp *app, XdgAppRefKind kind)
{
if (kind == XDG_APP_REF_KIND_APP)
- gs_app_set_metadata (app, "XgdApp::kind", "app");
+ gs_app_set_metadata (app, "xdg-app::kind", "app");
else if (kind == XDG_APP_REF_KIND_RUNTIME)
- gs_app_set_metadata (app, "XgdApp::kind", "runtime");
+ gs_app_set_metadata (app, "xdg-app::kind", "runtime");
else
g_assert_not_reached ();
}
@@ -306,7 +306,7 @@ gs_plugin_ensure_installation (GsPlugin *plugin,
static void
gs_plugin_xdg_app_set_metadata (GsApp *app, XdgAppRef *xref)
{
- gs_app_set_management_plugin (app, "XgdApp");
+ gs_app_set_management_plugin (app, "xdg-app");
gs_app_set_xdgapp_kind (app, xdg_app_ref_get_kind (xref));
gs_app_set_xdgapp_name (app, xdg_app_ref_get_name (xref));
gs_app_set_xdgapp_arch (app, xdg_app_ref_get_arch (xref));
@@ -531,7 +531,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
continue;
app = gs_app_new (xdg_app_remote_get_name (xremote));
- gs_app_set_management_plugin (app, "XgdApp");
+ gs_app_set_management_plugin (app, "xdg-app");
gs_app_set_kind (app, AS_APP_KIND_SOURCE);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_name (app,
@@ -851,7 +851,7 @@ gs_plugin_refine_item_metadata (GsPlugin *plugin,
g_autoptr(XdgAppRef) xref = NULL;
/* already set */
- if (gs_app_get_metadata_item (app, "XgdApp::kind") != NULL)
+ if (gs_app_get_metadata_item (app, "xdg-app::kind") != NULL)
return TRUE;
/* AppStream sets the source to appname/arch/branch, if this isn't set
@@ -1132,7 +1132,7 @@ gs_plugin_xdg_app_refine_app (GsPlugin *plugin,
g_autoptr(AsProfileTask) ptask = NULL;
/* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "XgdApp") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "xdg-app") != 0)
return TRUE;
/* profile */
@@ -1199,10 +1199,6 @@ gs_plugin_launch (GsPlugin *plugin,
{
const gchar *branch = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "XgdApp") != 0)
- return TRUE;
-
/* ensure we can set up the repo */
if (!gs_plugin_ensure_installation (plugin, cancellable, error))
return FALSE;
@@ -1231,7 +1227,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
GsPluginHelper helper;
/* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "XgdApp") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "xdg-app") != 0)
return TRUE;
/* ensure we can set up the repo */
@@ -1266,7 +1262,7 @@ gs_plugin_app_install (GsPlugin *plugin,
g_autoptr(XdgAppInstalledRef) xref = NULL;
/* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "XgdApp") != 0)
+ if (g_strcmp0 (gs_app_get_management_plugin (app), "xdg-app") != 0)
return TRUE;
/* ensure we can set up the repo */
@@ -1368,10 +1364,6 @@ gs_plugin_app_update (GsPlugin *plugin,
GsPluginHelper helper;
g_autoptr(XdgAppInstalledRef) xref = NULL;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app), "XgdApp") != 0)
- return TRUE;
-
/* ensure we can set up the repo */
if (!gs_plugin_ensure_installation (plugin, cancellable, error))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]