| Flutter Linux Embedder |

Classes | Functions | Variables
fl_settings_channel.cc File Reference
`#include "flutter/shell/platform/linux/fl_settings_channel.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_basic_message_channel.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_json_message_codec.h"`

Go to the source code of this file.

## Classes
struct | _FlSettingsChannel

## Functions
static void | fl_settings_channel_dispose (GObject *object)
static void | fl_settings_channel_class_init (FlSettingsChannelClass *klass)
static void | fl_settings_channel_init (FlSettingsChannel *self)
FlSettingsChannel * | fl_settings_channel_new (FlBinaryMessenger *messenger)
void | fl_settings_channel_send (FlSettingsChannel *self, double text_scale_factor, gboolean always_use_24_hour_format, FlSettingsChannelPlatformBrightness platform_brightness)

## Variables
static constexpr char | kChannelName [] = "flutter/settings"
static constexpr char | kTextScaleFactorKey [] = "textScaleFactor"
static constexpr char | kAlwaysUse24HourFormatKey [] = "alwaysUse24HourFormat"
static constexpr char | kPlatformBrightnessKey [] = "platformBrightness"
static constexpr char | kPlatformBrightnessLight [] = "light"
static constexpr char | kPlatformBrightnessDark [] = "dark"

## Function Documentation

## ◆ fl_settings_channel_class_init()

static void fl_settings_channel_class_init | ( | FlSettingsChannelClass * | klass | ) |
| static

Definition at line 33 of file fl_settings_channel.cc.

33 {
34 G_OBJECT_CLASS(klass)->dispose = fl_settings_channel_dispose;
35 }
fl_settings_channel_dispose
static void fl_settings_channel_dispose(GObject *object)
Definition: fl_settings_channel.cc:25

References fl_settings_channel_dispose().

## ◆ fl_settings_channel_dispose()

static void fl_settings_channel_dispose | ( | GObject * | object | ) |
| static

Definition at line 25 of file fl_settings_channel.cc.

25 {
26 FlSettingsChannel* self = FL_SETTINGS_CHANNEL(object);
27
28 g_clear_object(&self->channel);
29
30 G_OBJECT_CLASS(fl_settings_channel_parent_class)->dispose(object);
31 }

Referenced by fl_settings_channel_class_init().

## ◆ fl_settings_channel_init()

static void fl_settings_channel_init | ( | FlSettingsChannel * | self | ) |
| static

Definition at line 37 of file fl_settings_channel.cc.

37 {}

## ◆ 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
g_autoptr
g_autoptr(GMutexLocker) locker
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(), g_autoptr(), and kChannelName.

Referenced by fl_settings_handler_new().

## ◆ fl_settings_channel_send()

void fl_settings_channel_send | ( | FlSettingsChannel * | self,
|  | 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_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
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(), g_autoptr(), kAlwaysUse24HourFormatKey, kPlatformBrightnessDark, kPlatformBrightnessKey, kPlatformBrightnessLight, and kTextScaleFactorKey.

Referenced by update_settings().

## Variable Documentation

## ◆ kAlwaysUse24HourFormatKey

constexpr char kAlwaysUse24HourFormatKey[] = "alwaysUse24HourFormat"
| staticconstexpr

Definition at line 12 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_send().

## ◆ kChannelName

constexpr char kChannelName[] = "flutter/settings"
| staticconstexpr

Definition at line 10 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_new().

## ◆ kPlatformBrightnessDark

constexpr char kPlatformBrightnessDark[] = "dark"
| staticconstexpr

Definition at line 15 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_send().

## ◆ kPlatformBrightnessKey

constexpr char kPlatformBrightnessKey[] = "platformBrightness"
| staticconstexpr

Definition at line 13 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_send().

## ◆ kPlatformBrightnessLight

constexpr char kPlatformBrightnessLight[] = "light"
| staticconstexpr

Definition at line 14 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_send().

## ◆ kTextScaleFactorKey

constexpr char kTextScaleFactorKey[] = "textScaleFactor"
| staticconstexpr

Definition at line 11 of file fl_settings_channel.cc.

Referenced by fl_settings_channel_send().