| Flutter Linux Embedder |

Enumerations | Functions
fl_settings_channel.h File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"`

Go to the source code of this file.

## Enumerations
enum | FlSettingsChannelPlatformBrightness { FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT , FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK }

## Functions
| G_DECLARE_FINAL_TYPE (FlSettingsChannel, fl_settings_channel, FL, SETTINGS_CHANNEL, GObject)
FlSettingsChannel * | fl_settings_channel_new (FlBinaryMessenger *messenger)
void | fl_settings_channel_send (FlSettingsChannel *channel, double text_scale_factor, gboolean always_use_24_hour_format, FlSettingsChannelPlatformBrightness platform_brightness)

## Enumeration Type Documentation

## ◆ FlSettingsChannelPlatformBrightness

enum FlSettingsChannelPlatformBrightness

Enumerator
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT |
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK |

Definition at line 12 of file fl_settings_channel.h.

12 {
13 FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT,
14 FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK
15 } FlSettingsChannelPlatformBrightness;
FlSettingsChannelPlatformBrightness
FlSettingsChannelPlatformBrightness
Definition: fl_settings_channel.h:12
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK
@ FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK
Definition: fl_settings_channel.h:14
FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT
@ FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT
Definition: fl_settings_channel.h:13

## Function Documentation

## ◆ fl_settings_channel_new()

FlSettingsChannel* fl_settings_channel_new | ( | FlBinaryMessenger * | messenger | ) |

FlSettingsChannel:

#FlSettingsChannel is a channel that implements the Flutter user settings channel. fl_settings_channel_new: @messenger: an #FlBinaryMessenger

Creates a new channel that sends user settings to the platform.

Returns: a new #FlSettingsChannel

Definition at line 39 of file fl_settings_channel.cc.

39 {
40 FlSettingsChannel* self = FL_SETTINGS_CHANNEL(
41 g_object_new(fl_settings_channel_get_type(), nullptr));
42
43 g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
44 self->channel = fl_basic_message_channel_new(messenger, kChannelName,
45 FL_MESSAGE_CODEC(codec));
46
47 return self;
48 }
fl_basic_message_channel_new
G_MODULE_EXPORT FlBasicMessageChannel * fl_basic_message_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMessageCodec *codec)
Definition: fl_basic_message_channel.cc:154
fl_json_message_codec_new
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
Definition: fl_json_message_codec.cc:306
kChannelName
static constexpr char kChannelName[]
Definition: fl_settings_channel.cc:10

References fl_basic_message_channel_new(), fl_json_message_codec_new(), and kChannelName.

Referenced by fl_settings_handler_new().

## ◆ fl_settings_channel_send()

void fl_settings_channel_send | ( | FlSettingsChannel * | channel,
|  | double | text_scale_factor,
|  | gboolean | always_use_24_hour_format,
|  | FlSettingsChannelPlatformBrightness | platform_brightness
| ) |  |

Definition at line 50 of file fl_settings_channel.cc.

54 {
55 g_return_if_fail(FL_IS_SETTINGS_CHANNEL(self));
56
57 g_autoptr(FlValue) message = fl_value_new_map();
58 fl_value_set_string_take(message, kTextScaleFactorKey,
59 fl_value_new_float(text_scale_factor));
60 fl_value_set_string_take(message, kAlwaysUse24HourFormatKey,
61 fl_value_new_bool(always_use_24_hour_format));
62 const gchar* platform_brightness_string;
63 switch (platform_brightness) {
64 case FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT:
65 platform_brightness_string = kPlatformBrightnessLight;
66 break;
67 case FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK:
68 platform_brightness_string = kPlatformBrightnessDark;
69 break;
70 default:
71 g_assert_not_reached();
72 }
73 fl_value_set_string_take(message, kPlatformBrightnessKey,
74 fl_value_new_string(platform_brightness_string));
75 fl_basic_message_channel_send(self->channel, message, nullptr, nullptr,
76 nullptr);
77 }
fl_basic_message_channel_send
G_MODULE_EXPORT void fl_basic_message_channel_send(FlBasicMessageChannel *self, FlValue *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_basic_message_channel.cc:226
kTextScaleFactorKey
static constexpr char kTextScaleFactorKey[]
Definition: fl_settings_channel.cc:11
kPlatformBrightnessKey
static constexpr char kPlatformBrightnessKey[]
Definition: fl_settings_channel.cc:13
kPlatformBrightnessLight
static constexpr char kPlatformBrightnessLight[]
Definition: fl_settings_channel.cc:14
kAlwaysUse24HourFormatKey
static constexpr char kAlwaysUse24HourFormatKey[]
Definition: fl_settings_channel.cc:12
kPlatformBrightnessDark
static constexpr char kPlatformBrightnessDark[]
Definition: fl_settings_channel.cc:15
fl_value_new_float
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:269
fl_value_set_string_take
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:650
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

References fl_basic_message_channel_send(), FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_DARK, FL_SETTINGS_CHANNEL_PLATFORM_BRIGHTNESS_LIGHT, fl_value_new_bool(), fl_value_new_float(), fl_value_new_map(), fl_value_new_string(), fl_value_set_string_take(), kAlwaysUse24HourFormatKey, kPlatformBrightnessDark, kPlatformBrightnessKey, kPlatformBrightnessLight, and kTextScaleFactorKey.

Referenced by update_settings().

## ◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE | ( | FlSettingsChannel | ,
|  | fl_settings_channel | ,
|  | FL | ,
|  | SETTINGS_CHANNEL | ,
|  | GObject |
| ) |  |