[gnome-software] Do not allow the management plugin to be changed
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not allow the management plugin to be changed
- Date: Sat, 6 Aug 2016 20:07:43 +0000 (UTC)
commit 09c984f9000005b61c4f4b83b7ac64ce6aaf6789
Author: Richard Hughes <richard hughsie com>
Date: Thu Aug 4 08:08:54 2016 +0100
Do not allow the management plugin to be changed
src/gs-app.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 253b62b..a850b63 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1893,16 +1893,30 @@ gs_app_get_management_plugin (GsApp *app)
*
* The management plugin is the plugin that can handle doing install and remove
* operations on the #GsApp.
- * Typical values include "packagekit" and "jhbuild"
+ * Typical values include "packagekit" and "flatpak"
+ *
+ * It is an error to attempt to change the management plugin once
+ * it has been previously set.
**/
void
gs_app_set_management_plugin (GsApp *app, const gchar *management_plugin)
{
g_return_if_fail (GS_IS_APP (app));
+ /* same */
if (g_strcmp0 (app->management_plugin, management_plugin) == 0)
return;
+ /* trying to change */
+ if (app->management_plugin != NULL && management_plugin != NULL) {
+ g_warning ("automatically prevented from changing "
+ "management plugin on %s from %s to %s!",
+ gs_app_get_id (app),
+ app->management_plugin,
+ management_plugin);
+ return;
+ }
+
g_free (app->management_plugin);
app->management_plugin = g_strdup (management_plugin);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]