summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornitinosiris <nitinwartkar58@gmail.com>2021-06-15 15:33:54 +0530
committernitinosiris <nitinwartkar58@gmail.com>2021-06-16 08:05:50 +0530
commit5b9a8e20486feb8910f2bafe90137258b6d9dde5 (patch)
tree9d090766588f58062d9b34c1f9d0f12225b2283f
parent9d2d99efe7da9fc37a7c4498a149cba9c8836382 (diff)
downloadglib-5b9a8e20486feb8910f2bafe90137258b6d9dde5.tar.gz
gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name()
Closes #402
-rw-r--r--docs/reference/gio/gio-sections-common.txt1
-rw-r--r--gio/gdbusutils.c22
-rw-r--r--gio/gdbusutils.h2
3 files changed, 25 insertions, 0 deletions
diff --git a/docs/reference/gio/gio-sections-common.txt b/docs/reference/gio/gio-sections-common.txt
index 5151a9d75..250491a42 100644
--- a/docs/reference/gio/gio-sections-common.txt
+++ b/docs/reference/gio/gio-sections-common.txt
@@ -2806,6 +2806,7 @@ g_dbus_is_name
g_dbus_is_unique_name
g_dbus_is_member_name
g_dbus_is_interface_name
+g_dbus_is_error_name
g_dbus_gvalue_to_gvariant
g_dbus_gvariant_to_gvalue
g_dbus_escape_object_path_bytestring
diff --git a/gio/gdbusutils.c b/gio/gdbusutils.c
index cd52208d2..f12e86204 100644
--- a/gio/gdbusutils.c
+++ b/gio/gdbusutils.c
@@ -268,6 +268,28 @@ g_dbus_is_interface_name (const gchar *string)
return ret;
}
+/**
+ * g_dbus_is_error_name:
+ * @string: The string to check.
+ *
+ * Check whether @string is a valid D-Bus error name.
+ *
+ * This function returns the same result as g_dbus_is_interface_name(),
+ * because D-Bus error names are defined to have exactly the
+ * same syntax as interface names.
+ *
+ * Returns: %TRUE if valid, %FALSE otherwise.
+ *
+ * Since: 2.70
+ */
+gboolean
+g_dbus_is_error_name (const gchar *string)
+{
+ /* Error names are the same syntax as interface names.
+ * See https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error */
+ return g_dbus_is_interface_name (string);
+}
+
/* ---------------------------------------------------------------------------------------------------- */
/* TODO: maybe move to glib? if so, it should conform to http://en.wikipedia.org/wiki/Guid and/or
diff --git a/gio/gdbusutils.h b/gio/gdbusutils.h
index fd7358fcf..da8e42280 100644
--- a/gio/gdbusutils.h
+++ b/gio/gdbusutils.h
@@ -42,6 +42,8 @@ GLIB_AVAILABLE_IN_ALL
gboolean g_dbus_is_member_name (const gchar *string);
GLIB_AVAILABLE_IN_ALL
gboolean g_dbus_is_interface_name (const gchar *string);
+GLIB_AVAILABLE_IN_2_70
+gboolean g_dbus_is_error_name (const gchar *string);
GLIB_AVAILABLE_IN_ALL
void g_dbus_gvariant_to_gvalue (GVariant *value,