diff options
author | Richard Hughes <richard@hughsie.com> | 2015-08-10 12:28:38 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-08-10 12:28:38 +0100 |
commit | 97cfb9b6af3c141df07c00bf2a071b441469e2ef (patch) | |
tree | 50989258bda8e26232284b66a82e9adcc083121f | |
parent | 3e2d63ef770b99001a460fb1a143b1407a391108 (diff) | |
download | appstream-glib-97cfb9b6af3c141df07c00bf2a071b441469e2ef.tar.gz |
Fix the name of the D-Bus session enum
If we're breaking API, we might as well fix up some of the legacy stuff.
-rw-r--r-- | libappstream-builder/plugins/asb-plugin-dbus.c | 2 | ||||
-rw-r--r-- | libappstream-glib/as-provide.c | 23 | ||||
-rw-r--r-- | libappstream-glib/as-provide.h | 4 |
3 files changed, 18 insertions, 11 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-dbus.c b/libappstream-builder/plugins/asb-plugin-dbus.c index 6519f93..c7f09d4 100644 --- a/libappstream-builder/plugins/asb-plugin-dbus.c +++ b/libappstream-builder/plugins/asb-plugin-dbus.c @@ -92,7 +92,7 @@ asb_plugin_process_dbus (AsbApp *app, /* add provide */ provide = as_provide_new (); as_provide_set_kind (provide, is_system ? AS_PROVIDE_KIND_DBUS_SYSTEM : - AS_PROVIDE_KIND_DBUS); + AS_PROVIDE_KIND_DBUS_SESSION); as_provide_set_value (provide, name); as_app_add_provide (AS_APP (app), provide); return TRUE; diff --git a/libappstream-glib/as-provide.c b/libappstream-glib/as-provide.c index 306df03..0a97257 100644 --- a/libappstream-glib/as-provide.c +++ b/libappstream-glib/as-provide.c @@ -109,8 +109,8 @@ as_provide_kind_from_string (const gchar *kind) return AS_PROVIDE_KIND_PYTHON2; if (g_strcmp0 (kind, "python3") == 0) return AS_PROVIDE_KIND_PYTHON3; - if (g_strcmp0 (kind, "dbus") == 0) - return AS_PROVIDE_KIND_DBUS; + if (g_strcmp0 (kind, "dbus-session") == 0) + return AS_PROVIDE_KIND_DBUS_SESSION; if (g_strcmp0 (kind, "dbus-system") == 0) return AS_PROVIDE_KIND_DBUS_SYSTEM; return AS_PROVIDE_KIND_UNKNOWN; @@ -143,7 +143,7 @@ as_provide_kind_to_string (AsProvideKind kind) return "python2"; if (kind == AS_PROVIDE_KIND_PYTHON3) return "python3"; - if (kind == AS_PROVIDE_KIND_DBUS) + if (kind == AS_PROVIDE_KIND_DBUS_SESSION) return "dbus"; if (kind == AS_PROVIDE_KIND_DBUS_SYSTEM) return "dbus-system"; @@ -238,7 +238,7 @@ as_provide_node_insert (AsProvide *provide, GNode *parent, AsNodeContext *ctx) switch (priv->kind) { case AS_PROVIDE_KIND_UNKNOWN: break; - case AS_PROVIDE_KIND_DBUS: + case AS_PROVIDE_KIND_DBUS_SESSION: n = as_node_insert (parent, "dbus", priv->value, AS_NODE_INSERT_FLAG_NONE, @@ -300,10 +300,17 @@ as_provide_node_parse (AsProvide *provide, GNode *node, AsNodeContext *ctx, GError **error) { AsProvidePrivate *priv = GET_PRIVATE (provide); - priv->kind = as_provide_kind_from_string (as_node_get_name (node)); - if (priv->kind == AS_PROVIDE_KIND_DBUS && - g_strcmp0 (as_node_get_attribute (node, "type"), "system") == 0) - priv->kind = AS_PROVIDE_KIND_DBUS_SYSTEM; + + if (g_strcmp0 (as_node_get_name (node), "dbus") == 0) { + const gchar *tmp; + tmp = as_node_get_attribute (node, "type"); + if (g_strcmp0 (tmp, "system") == 0) + priv->kind = AS_PROVIDE_KIND_DBUS_SYSTEM; + else if (g_strcmp0 (tmp, "session") == 0) + priv->kind = AS_PROVIDE_KIND_DBUS_SESSION; + } else { + priv->kind = as_provide_kind_from_string (as_node_get_name (node)); + } g_free (priv->value); priv->value = as_node_take_data (node); return TRUE; diff --git a/libappstream-glib/as-provide.h b/libappstream-glib/as-provide.h index bbec6e4..040ab73 100644 --- a/libappstream-glib/as-provide.h +++ b/libappstream-glib/as-provide.h @@ -69,7 +69,7 @@ struct _AsProvideClass * @AS_PROVIDE_KIND_FIRMWARE: A firmware file * @AS_PROVIDE_KIND_PYTHON2: A Python 2 module * @AS_PROVIDE_KIND_PYTHON3: A Python 3 module - * @AS_PROVIDE_KIND_DBUS: A D-Bus service + * @AS_PROVIDE_KIND_DBUS_SESSION: A D-Bus session service * @AS_PROVIDE_KIND_DBUS_SYSTEM: A D-Bus system service * * The provide type. @@ -83,7 +83,7 @@ typedef enum { AS_PROVIDE_KIND_FIRMWARE, AS_PROVIDE_KIND_PYTHON2, AS_PROVIDE_KIND_PYTHON3, - AS_PROVIDE_KIND_DBUS, /* Since: 0.1.7 */ + AS_PROVIDE_KIND_DBUS_SESSION, /* Since: 0.1.7 */ AS_PROVIDE_KIND_DBUS_SYSTEM, /* Since: 0.2.4 */ /*< private >*/ AS_PROVIDE_KIND_LAST |