| Flutter Linux Embedder |

Functions
fl_settings_portal.h File Reference
`#include "flutter/shell/platform/linux/fl_settings.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS | G_DECLARE_FINAL_TYPE (FlSettingsPortal, fl_settings_portal, FL, SETTINGS_PORTAL, GObject)
FlSettingsPortal * | fl_settings_portal_new ()
FlSettingsPortal * | fl_settings_portal_new_with_values (GVariantDict *values)
gboolean | fl_settings_portal_start (FlSettingsPortal *portal, GError **error)

## Function Documentation

## ◆ fl_settings_portal_new()

FlSettingsPortal* fl_settings_portal_new | ( |  | ) |

FlSettingsPortal: #FlSettingsPortal reads settings from the XDG desktop portal. fl_settings_portal_new:

Creates a new settings portal instance.

Returns: a new #FlSettingsPortal.

Definition at line 267 of file fl_settings_portal.cc.

267 {
268 g_autoptr(GVariantDict) values = g_variant_dict_new(nullptr);
269 return fl_settings_portal_new_with_values(values);
270 }
g_autoptr
g_autoptr(GMutexLocker) locker
fl_settings_portal_new_with_values
FlSettingsPortal * fl_settings_portal_new_with_values(GVariantDict *values)
Definition: fl_settings_portal.cc:272

References fl_settings_portal_new_with_values(), and g_autoptr().

Referenced by fl_settings_new().

## ◆ fl_settings_portal_new_with_values()

FlSettingsPortal* fl_settings_portal_new_with_values | ( | GVariantDict * | values | ) |

fl_settings_portal_new_with_values: @values: (nullable): a #GVariantDict.

Creates a new settings portal instance with initial values for testing.

Returns: a new #FlSettingsPortal.

Definition at line 272 of file fl_settings_portal.cc.

272 {
273 g_return_val_if_fail(values != nullptr, nullptr);
274 FlSettingsPortal* portal =
275 FL_SETTINGS_PORTAL(g_object_new(fl_settings_portal_get_type(), nullptr));
276 portal->values = g_variant_dict_ref(values);
277 return portal;
278 }

Referenced by fl_settings_portal_new(), and TEST().

## ◆ fl_settings_portal_start()

gboolean fl_settings_portal_start | ( | FlSettingsPortal * | portal,
|  | GError ** | error
| ) |  |

fl_settings_portal_start: @portal: an #FlSettingsPortal. @error: (allow-none): #GError location to store the error occurring, or NULL

Reads the current settings and starts monitoring for changes in the desktop portal settings.

Returns: TRUE on success, or FALSE if the portal is not available.

Definition at line 280 of file fl_settings_portal.cc.

280 {
281 g_return_val_if_fail(FL_IS_SETTINGS_PORTAL(self), false);
282 g_return_val_if_fail(self->dbus_proxy == nullptr, false);
283
284 self->dbus_proxy = g_dbus_proxy_new_for_bus_sync(
285 G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, nullptr, kPortalName,
286 kPortalPath, kPortalSettings, nullptr, error);
287
288 if (self->dbus_proxy == nullptr) {
289 return FALSE;
290 }
291
292 for (const FlSetting setting : kAllSettings) {
293 g_autoptr(GVariant) value = nullptr;
294 if (settings_portal_read(self->dbus_proxy, setting.ns, setting.key,
295 &value)) {
296 set_value(self, &setting, value);
297 }
298 }
299
300 g_signal_connect_object(self->dbus_proxy, "g-signal",
301 G_CALLBACK(settings_portal_changed_cb), self,
302 static_cast<GConnectFlags>(0));
303
304 return true;
305 }
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
settings_portal_read
static gboolean settings_portal_read(GDBusProxy *proxy, const gchar *ns, const gchar *key, GVariant **out)
Definition: fl_settings_portal.cc:117
set_value
static void set_value(FlSettingsPortal *portal, const FlSetting *setting, GVariant *value)
Definition: fl_settings_portal.cc:98
settings_portal_changed_cb
static void settings_portal_changed_cb(GDBusProxy *proxy, const char *sender_name, const char *signal_name, GVariant *parameters, gpointer user_data)
Definition: fl_settings_portal.cc:151
kAllSettings
static const FlSetting kAllSettings[]
Definition: fl_settings_portal.cc:57
kPortalPath
static constexpr char kPortalPath[]
Definition: fl_settings_portal.cc:11
kPortalName
static constexpr char kPortalName[]
Definition: fl_settings_portal.cc:10
kPortalSettings
static constexpr char kPortalSettings[]
Definition: fl_settings_portal.cc:12
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
FlSetting
Definition: fl_settings_portal.cc:14

References error, g_autoptr(), kAllSettings, kPortalName, kPortalPath, kPortalSettings, set_value(), settings_portal_changed_cb(), settings_portal_read(), and value.

Referenced by fl_settings_new().

## ◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE | ( | FlSettingsPortal | ,
|  | fl_settings_portal | ,
|  | FL | ,
|  | SETTINGS_PORTAL | ,
|  | GObject |
| ) |  |