Flutter Linux Embedder
fl_settings.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
8 
9 G_DEFINE_INTERFACE(FlSettings, fl_settings, G_TYPE_OBJECT)
10 
11 enum {
14 };
15 
16 static guint signals[kSignalLastSignal];
17 
18 static void fl_settings_default_init(FlSettingsInterface* iface) {
19  /**
20  * FlSettings::changed:
21  * @settings: an #FlSettings
22  *
23  * This signal is emitted after the settings have been changed.
24  */
26  g_signal_new("changed", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST,
27  0, NULL, NULL, NULL, G_TYPE_NONE, 0);
28 }
29 
31  return FL_SETTINGS_GET_IFACE(self)->get_clock_format(self);
32 }
33 
35  return FL_SETTINGS_GET_IFACE(self)->get_color_scheme(self);
36 }
37 
38 gboolean fl_settings_get_enable_animations(FlSettings* self) {
39  return FL_SETTINGS_GET_IFACE(self)->get_enable_animations(self);
40 }
41 
42 gboolean fl_settings_get_high_contrast(FlSettings* self) {
43  return FL_SETTINGS_GET_IFACE(self)->get_high_contrast(self);
44 }
45 
46 gdouble fl_settings_get_text_scaling_factor(FlSettings* self) {
47  return FL_SETTINGS_GET_IFACE(self)->get_text_scaling_factor(self);
48 }
49 
50 void fl_settings_emit_changed(FlSettings* self) {
51  g_return_if_fail(FL_IS_SETTINGS(self));
52  g_signal_emit(self, signals[kSignalChanged], 0);
53 }
54 
55 FlSettings* fl_settings_new() {
56  g_autoptr(FlSettingsPortal) portal = fl_settings_portal_new();
57 
58  g_autoptr(GError) error = nullptr;
59  if (!fl_settings_portal_start(portal, &error)) {
60  g_debug("XDG desktop portal settings unavailable: %s", error->message);
61  return fl_gnome_settings_new();
62  }
63 
64  return FL_SETTINGS(g_object_ref(portal));
65 }
signals
static guint signals[kSignalLastSignal]
Definition: fl_settings.cc:16
kSignalLastSignal
@ kSignalLastSignal
Definition: fl_settings.cc:13
fl_settings_get_color_scheme
FlColorScheme fl_settings_get_color_scheme(FlSettings *self)
Definition: fl_settings.cc:34
kSignalChanged
@ kSignalChanged
Definition: fl_settings.cc:12
fl_settings_new
FlSettings * fl_settings_new()
Definition: fl_settings.cc:55
fl_settings_portal.h
fl_settings_get_enable_animations
gboolean fl_settings_get_enable_animations(FlSettings *self)
Definition: fl_settings.cc:38
fl_settings_portal_start
gboolean fl_settings_portal_start(FlSettingsPortal *self, GError **error)
Definition: fl_settings_portal.cc:276
fl_settings_default_init
static void fl_settings_default_init(FlSettingsInterface *iface)
Definition: fl_settings.cc:18
G_DEFINE_INTERFACE
G_DEFINE_INTERFACE(FlKeyboardViewDelegate, fl_keyboard_view_delegate, G_TYPE_OBJECT) static void fl_keyboard_view_delegate_default_init(FlKeyboardViewDelegateInterface *iface)
Definition: fl_keyboard_view_delegate.cc:7
fl_gnome_settings_new
FlSettings * fl_gnome_settings_new()
Definition: fl_gnome_settings.cc:164
fl_gnome_settings.h
FlColorScheme
FlColorScheme
Definition: fl_settings.h:35
fl_settings_get_high_contrast
gboolean fl_settings_get_high_contrast(FlSettings *self)
Definition: fl_settings.cc:42
fl_settings_emit_changed
void fl_settings_emit_changed(FlSettings *self)
Definition: fl_settings.cc:50
fl_settings_get_text_scaling_factor
gdouble fl_settings_get_text_scaling_factor(FlSettings *self)
Definition: fl_settings.cc:46
fl_settings.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
FlClockFormat
FlClockFormat
Definition: fl_settings.h:21
fl_settings_get_clock_format
FlClockFormat fl_settings_get_clock_format(FlSettings *self)
Definition: fl_settings.cc:30
fl_settings_portal_new
FlSettingsPortal * fl_settings_portal_new()
Definition: fl_settings_portal.cc:263