Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libportal/portal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <libportal/remote.h>
#include <libportal/screenshot.h>
#include <libportal/session.h>
#include <libportal/settings.h>
#include <libportal/spawn.h>
#include <libportal/trash.h>
#include <libportal/types.h>
Expand Down
34 changes: 17 additions & 17 deletions libportal/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ xdp_settings_class_init (XdpSettingsClass *klass)
/**
* XdpSettings::changed:
* @settings: the [class@Settings] object
* @namespace: the value namespace
* @namespace_: the value namespace
* @key: the value key
* @value: the value
*
Expand Down Expand Up @@ -136,22 +136,22 @@ settings_changed (GDBusConnection *bus,
/**
* xdp_settings_read_uint:
* @settings: the [class@Settings] object.
* @namespace: the namespace of the value.
* @namespace_: the namespace of the value.
* @key: the key of the value.
* @cancellable: a GCancellable or NULL.
* @error: return location for error or NULL.
*
* Read a setting value as unsigned int within @namespace, with @key.
* Read a setting value as unsigned int within @namespace_, with @key.
*
* Returns: the uint value, or 0 if not found or not
* the right type. If @error is not NULL, then the error is returned.
*/
guint32
xdp_settings_read_uint (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error)
xdp_settings_read_uint (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error)
{
g_autoptr(GVariant) value = NULL;

value = xdp_settings_read_value (settings, namespace, key, cancellable, error);
value = xdp_settings_read_value (settings, namespace_, key, cancellable, error);
if (value)
{
if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))
Expand All @@ -165,22 +165,22 @@ xdp_settings_read_uint (XdpSettings *settings, const char *namespace, const char
/**
* xdp_settings_read_string:
* @settings: the [class@Settings] object.
* @namespace: the namespace of the value.
* @namespace_: the namespace of the value.
* @key: the key of the value.
* @cancellable: a GCancellable or NULL.
* @error: return location for error or NULL.
*
* Read a setting value as unsigned int within @namespace, with @key.
* Read a setting value as unsigned int within @namespace_, with @key.
*
* Returns: (transfer full): the stringint value, or NULL if not found or not
* the right type. If @error is not NULL, then the error is returned.
*/
char *
xdp_settings_read_string (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error)
xdp_settings_read_string (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error)
{
g_autoptr(GVariant) value = NULL;

value = xdp_settings_read_value (settings, namespace, key, cancellable, error);
value = xdp_settings_read_value (settings, namespace_, key, cancellable, error);
if (value)
{
if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
Expand All @@ -194,14 +194,14 @@ xdp_settings_read_string (XdpSettings *settings, const char *namespace, const ch
/**
* xdp_settings_read:
* @settings: the [class@Settings] object.
* @namespace: the namespace of the value.
* @namespace_: the namespace of the value.
* @key: the key of the value.
* @cancellable: a GCancellable or NULL.
* @error: return location for error or NULL.
* @format: a #GVariant format string
* @...: arguments as per @format
*
* Read a setting value within @namespace, with @key.
* Read a setting value within @namespace_, with @key.
*
* A convenience function that combines xdp_settings_read_value() with
* g_variant_get().
Expand All @@ -210,12 +210,12 @@ xdp_settings_read_string (XdpSettings *settings, const char *namespace, const ch
* returned.
*/
void
xdp_settings_read (XdpSettings *settings, const char *namespace, const gchar *key, GCancellable *cancellable, GError **error, const gchar *format, ...)
xdp_settings_read (XdpSettings *settings, const char *namespace_, const gchar *key, GCancellable *cancellable, GError **error, const gchar *format, ...)
{
g_autoptr(GVariant) value = NULL;
va_list ap;

value = xdp_settings_read_value (settings, namespace, key, cancellable, error);
value = xdp_settings_read_value (settings, namespace_, key, cancellable, error);
if (value)
{
va_start (ap, format);
Expand All @@ -227,18 +227,18 @@ xdp_settings_read (XdpSettings *settings, const char *namespace, const gchar *ke
/**
* xdp_settings_read_value:
* @settings: the [class@Settings] object.
* @namespace: the namespace of the value.
* @namespace_: the namespace of the value.
* @key: the key of the value.
* @cancellable: a GCancellable or NULL.
* @error: return location for error or NULL.
*
* Read a setting value within @namespace, with @key.
* Read a setting value within @namespace_, with @key.
*
* Returns: (transfer full): the value, or %NULL if not
* found. If @error is not NULL, then the error is returned.
*/
GVariant *
xdp_settings_read_value (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error)
xdp_settings_read_value (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error)
{
g_autoptr(GVariant) ret = NULL;
g_autoptr(GVariant) inner = NULL;
Expand All @@ -248,7 +248,7 @@ xdp_settings_read_value (XdpSettings *settings, const char *namespace, const cha
PORTAL_OBJECT_PATH,
SETTINGS_INTERFACE,
"ReadOne",
g_variant_new ("(ss)", namespace, key),
g_variant_new ("(ss)", namespace_, key),
NULL,
G_DBUS_CALL_FLAGS_NONE,
5000,
Expand Down
8 changes: 4 additions & 4 deletions libportal/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ XDP_PUBLIC
G_DECLARE_FINAL_TYPE (XdpSettings, xdp_settings, XDP, SETTINGS, GObject)

XDP_PUBLIC
GVariant *xdp_settings_read_value (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
GVariant *xdp_settings_read_value (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error);

XDP_PUBLIC
void
xdp_settings_read (XdpSettings *settings, const char *namespace,
xdp_settings_read (XdpSettings *settings, const char *namespace_,
const gchar *key,
GCancellable *cancellable, GError **error,
const gchar *format, ...);

XDP_PUBLIC
guint xdp_settings_read_uint (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
guint xdp_settings_read_uint (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error);

XDP_PUBLIC
char *xdp_settings_read_string (XdpSettings *settings, const char *namespace, const char *key, GCancellable *cancellable, GError **error);
char *xdp_settings_read_string (XdpSettings *settings, const char *namespace_, const char *key, GCancellable *cancellable, GError **error);

XDP_PUBLIC
GVariant *xdp_settings_read_all_values (XdpSettings *settings, const char *const *namespaces, GCancellable *cancellable, GError **error);
Expand Down