[gnome-software] trivial: Add gs_plugin_set_appstream_id()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Add gs_plugin_set_appstream_id()
- Date: Fri, 23 Dec 2016 11:01:42 +0000 (UTC)
commit 6a560231cfa315e945ce443d56b77d9f6ab07627
Author: Richard Hughes <richard hughsie com>
Date: Fri Dec 23 10:41:27 2016 +0000
trivial: Add gs_plugin_set_appstream_id()
src/gs-plugin.c | 36 ++++++++++++++++++++++++++++++++++++
src/gs-plugin.h | 3 +++
src/plugins/gs-plugin-epiphany.c | 3 +++
src/plugins/gs-plugin-flatpak.c | 3 +++
src/plugins/gs-plugin-fwupd.c | 3 +++
src/plugins/gs-plugin-limba.c | 3 +++
src/plugins/gs-plugin-odrs.c | 3 +++
src/plugins/gs-plugin-snap.c | 3 +++
src/plugins/gs-plugin-steam.c | 3 +++
9 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 13fa242..e88ace6 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -72,6 +72,7 @@ typedef struct
gchar *locale; /* allow-none */
gchar *language; /* allow-none */
gchar *name;
+ gchar *appstream_id;
guint scale;
guint order;
guint priority;
@@ -190,6 +191,7 @@ gs_plugin_finalize (GObject *object)
if (priv->timer_id > 0)
g_source_remove (priv->timer_id);
g_free (priv->name);
+ g_free (priv->appstream_id);
g_free (priv->data);
g_free (priv->locale);
g_free (priv->language);
@@ -410,6 +412,40 @@ gs_plugin_get_name (GsPlugin *plugin)
}
/**
+ * gs_plugin_get_appstream_id:
+ * @plugin: a #GsPlugin
+ *
+ * Gets the plugin AppStream ID.
+ *
+ * Returns: a string, e.g. `org.gnome.Software.Plugin.Epiphany`
+ *
+ * Since: 3.24
+ **/
+const gchar *
+gs_plugin_get_appstream_id (GsPlugin *plugin)
+{
+ GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
+ return priv->appstream_id;
+}
+
+/**
+ * gs_plugin_get_appstream_id:
+ * @plugin: a #GsPlugin
+ * @appstream_id: an appstream ID, e.g. `org.gnome.Software.Plugin.Epiphany`
+ *
+ * Sets the plugin AppStream ID.
+ *
+ * Since: 3.24
+ **/
+const void
+gs_plugin_set_appstream_id (GsPlugin *plugin, const gchar *appstream_id)
+{
+ GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
+ g_free (priv->appstream_id);
+ appstream_id = g_strdup (appstream_id);
+}
+
+/**
* gs_plugin_get_scale:
* @plugin: a #GsPlugin
*
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 648bfcd..a2f0608 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -68,6 +68,9 @@ GsPluginData *gs_plugin_alloc_data (GsPlugin *plugin,
gsize sz);
GsPluginData *gs_plugin_get_data (GsPlugin *plugin);
const gchar *gs_plugin_get_name (GsPlugin *plugin);
+const gchar *gs_plugin_get_appstream_id (GsPlugin *plugin);
+void gs_plugin_set_appstream_id (GsPlugin *plugin,
+ const gchar *appstream_id);
gboolean gs_plugin_get_enabled (GsPlugin *plugin);
void gs_plugin_set_enabled (GsPlugin *plugin,
gboolean enabled);
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index da6ce23..61a7d7d 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -46,6 +46,9 @@ gs_plugin_initialize (GsPlugin *plugin)
gs_plugin_get_name (plugin));
}
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Epiphany");
+
/* need help from appstream */
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
}
diff --git a/src/plugins/gs-plugin-flatpak.c b/src/plugins/gs-plugin-flatpak.c
index 9155cee..b6220a7 100644
--- a/src/plugins/gs-plugin-flatpak.c
+++ b/src/plugins/gs-plugin-flatpak.c
@@ -63,6 +63,9 @@ gs_plugin_initialize (GsPlugin *plugin)
/* prioritize over packages */
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit");
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Flatpak");
+
/* if we can't update the AppStream database system-wide don't even
* pull the data as we can't do anything with it */
permission = gs_utils_get_permission (action_id);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 7da8768..0f9f2a0 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -114,6 +114,9 @@ gs_plugin_initialize (GsPlugin *plugin)
gs_plugin_set_enabled (plugin, FALSE);
return;
}
+
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Fwupd");
}
void
diff --git a/src/plugins/gs-plugin-limba.c b/src/plugins/gs-plugin-limba.c
index c2ed583..d39cbc0 100644
--- a/src/plugins/gs-plugin-limba.c
+++ b/src/plugins/gs-plugin-limba.c
@@ -43,6 +43,9 @@ gs_plugin_initialize (GsPlugin *plugin)
/* need help from appstream */
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "packagekit");
+
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Limba");
}
void
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index c519635..d4ea4fa 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -92,6 +92,9 @@ gs_plugin_initialize (GsPlugin *plugin)
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "flatpak-system");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "flatpak-user");
+
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Odrs");
}
static GArray *
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 7310c9f..0ae92f9 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -52,6 +52,9 @@ gs_plugin_initialize (GsPlugin *plugin)
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "desktop-categories");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "ubuntu-reviews");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit");
+
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Snap");
}
gboolean
diff --git a/src/plugins/gs-plugin-steam.c b/src/plugins/gs-plugin-steam.c
index 94f523c..07b7d59 100644
--- a/src/plugins/gs-plugin-steam.c
+++ b/src/plugins/gs-plugin-steam.c
@@ -31,6 +31,9 @@ gs_plugin_initialize (GsPlugin *plugin)
{
/* need metadata */
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
+
+ /* set name of MetaInfo file */
+ gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Steam");
}
typedef enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]