mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
Merge branch 'g_dbus' into 'main'
gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name() Closes #402 See merge request GNOME/glib!2156
This commit is contained in:
commit
4d6dbe0904
@ -2806,6 +2806,7 @@ g_dbus_is_name
|
|||||||
g_dbus_is_unique_name
|
g_dbus_is_unique_name
|
||||||
g_dbus_is_member_name
|
g_dbus_is_member_name
|
||||||
g_dbus_is_interface_name
|
g_dbus_is_interface_name
|
||||||
|
g_dbus_is_error_name
|
||||||
g_dbus_gvalue_to_gvariant
|
g_dbus_gvalue_to_gvariant
|
||||||
g_dbus_gvariant_to_gvalue
|
g_dbus_gvariant_to_gvalue
|
||||||
g_dbus_escape_object_path_bytestring
|
g_dbus_escape_object_path_bytestring
|
||||||
|
@ -3204,7 +3204,7 @@ g_dbus_message_set_error_name (GDBusMessage *message,
|
|||||||
const gchar *value)
|
const gchar *value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
|
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
|
||||||
g_return_if_fail (value == NULL || g_dbus_is_interface_name (value));
|
g_return_if_fail (value == NULL || g_dbus_is_error_name (value));
|
||||||
set_string_header (message, G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME, value);
|
set_string_header (message, G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +268,28 @@ g_dbus_is_interface_name (const gchar *string)
|
|||||||
return ret;
|
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
|
/* TODO: maybe move to glib? if so, it should conform to http://en.wikipedia.org/wiki/Guid and/or
|
||||||
|
@ -42,6 +42,8 @@ GLIB_AVAILABLE_IN_ALL
|
|||||||
gboolean g_dbus_is_member_name (const gchar *string);
|
gboolean g_dbus_is_member_name (const gchar *string);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
gboolean g_dbus_is_interface_name (const gchar *string);
|
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
|
GLIB_AVAILABLE_IN_ALL
|
||||||
void g_dbus_gvariant_to_gvalue (GVariant *value,
|
void g_dbus_gvariant_to_gvalue (GVariant *value,
|
||||||
|
@ -1162,9 +1162,15 @@ test_validate_names (void)
|
|||||||
g_assert (!g_dbus_is_unique_name (names[n].string));
|
g_assert (!g_dbus_is_unique_name (names[n].string));
|
||||||
|
|
||||||
if (names[n].interface)
|
if (names[n].interface)
|
||||||
g_assert (g_dbus_is_interface_name (names[n].string));
|
{
|
||||||
|
g_assert (g_dbus_is_interface_name (names[n].string));
|
||||||
|
g_assert (g_dbus_is_error_name (names[n].string));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_assert (!g_dbus_is_interface_name (names[n].string));
|
{
|
||||||
|
g_assert (!g_dbus_is_interface_name (names[n].string));
|
||||||
|
g_assert (!g_dbus_is_error_name (names[n].string));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user